org.openuat.features
Class TimeSeriesUtil

java.lang.Object
  extended by org.openuat.features.TimeSeriesUtil

public class TimeSeriesUtil
extends java.lang.Object

This class contains utility functions for dealing with time series.

Version:
1.0
Author:
Rene Mayrhofer

Constructor Summary
TimeSeriesUtil()
           
 
Method Summary
static double[][] cutSegmentsToEqualLength(double[] segment1, double[] segment2)
          This method equalizes the length of two time series segments by cutting the longer to the length of the shorter.
static int getMaxInd(int numFftPoints, int samplerate, int cutOffFrequency)
          Compute the maximum index of a vector of FFT coefficients that needs to considered when using them only up to the specified cut-off frequency.
static double[][] slice(double[] segment, int maxSegmentLength, int segmentSkip)
          Slices a time series into multiple parts pf a specified length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeSeriesUtil

public TimeSeriesUtil()
Method Detail

cutSegmentsToEqualLength

public static double[][] cutSegmentsToEqualLength(double[] segment1,
                                                  double[] segment2)
This method equalizes the length of two time series segments by cutting the longer to the length of the shorter.

Parameters:
segment1 - The first time series segment to use.
segment2 - The second time series segment to use.
Returns:
An array of two time series segments. Both arrays will have the same length and will contain copies of the first parts of segment1 and segment2 respectively. That is, return[0] will contain segment1[0:len] and return[1] will contain segment2[0:len] with len being the minimum of segment1.length and segment2.length.

slice

public static double[][] slice(double[] segment,
                               int maxSegmentLength,
                               int segmentSkip)
Slices a time series into multiple parts pf a specified length.

Parameters:
segment - The time series segment to slice.
maxSegmentLength - The number of samples that the slices should have. If set to -1, no slicing will happen.
segmentSkip - How many samples to skip when generating the next slice. Slices will overlap by (maxSegmentLength-segmentSkip) samples.
Returns:
An array of slices generated from the time series. If segment is <=maxSegmentLength or maxSegmentLength is <=0, then no slicing will be done and the original time series passed in segment will be returned as the first and only element in this array. Otherwise, all elements of the returned array will have the same length, namely maxSegmentLength samples. Attention:If segment can not be divided into slices without remainder, the remainder will be ignored and will not be returned.

getMaxInd

public static int getMaxInd(int numFftPoints,
                            int samplerate,
                            int cutOffFrequency)
Compute the maximum index of a vector of FFT coefficients that needs to considered when using them only up to the specified cut-off frequency.



2005-2006, Rene Mayrhofer.