Examples

These examples demonstrate how to use the TSWindowing operator.

In this example, a Hann window function is applied to electrocardiography (ECG) time series data:


composite Main {
  	graph
  		stream<float64 ECGValue> rawECGStream = FileSource() 
			{
            param
               	file : "test.dat";
              	format : csv;
        	}

		stream <list<float64> newTS> HannStream =  TSWindowing(rawECGStream) 
		{
			window rawECGStream: tumbling,count(10);
			param
        		inputTimeSeries : rawECGStream.ECGValue;
				algorithm: Hann;
				flushOnFinal: true;
			output 
				HannStream: newTS = windowedTimeSeries();
		}

        () as writer = FileSink(HannStream)   
		{
        	param
          	file : "hannstream.csv";
		}
}

The following graphs show an example of time series data before and after you run the TSWindowing operator with the Hann algorithm: