public SequenceAnalyzer(int numSequences, int windowSize) { // Set the basic parameters. Take two times the size of the window for ringbuffers _numbuffers = numSequences; _windowsize = windowSize; _ringbuffersize = windowSize * 2; // Set the pointer initially to -1, and therefore the // startpointer to the end of the ringbuffer Pointer = -1; // Initialize jagged array: one ringbuffer for each sequence // each ringbuffer is initialized with its fixed size _ringBuffers = new double[_numbuffers][]; for (int k = 0; k < _numbuffers; k++) _ringBuffers[k] = new double[_ringbuffersize]; // Initialize jagged array: one ring buffer for each sequence _fftBuffers = new Complex[_numbuffers][]; for (int k = 0; k < _numbuffers; k++) _fftBuffers[k] = new Complex[_windowsize]; // Initialize result storage: this object is reused every time. // Its contents are overwritten instead of creating a new object everytime _result = new AnalysisResult(numSequences); }
public void ReadFromAnalysisResult(AnalysisResult analysisresult) { RotationX = analysisresult.CurrentValues[0]; RotationY = analysisresult.CurrentValues[1]; RotationZ = analysisresult.CurrentValues[2]; RotationXMean = analysisresult.Means[0]; RotationYMean = analysisresult.Means[1]; RotationZMean = analysisresult.Means[2]; RotationXStdDev = analysisresult.StandardDeviations[0]; RotationYStdDev = analysisresult.StandardDeviations[1]; RotationZStdDev = analysisresult.StandardDeviations[2]; RotationCorrelationXY = analysisresult.CorrelationMatrix[0, 1]; RotationCorrelationXZ = analysisresult.CorrelationMatrix[0, 2]; RotationCorrelationYZ = analysisresult.CorrelationMatrix[1, 2]; RotationXEnergy = analysisresult.Energies[0]; RotationYEnergy = analysisresult.Energies[1]; RotationZEnergy = analysisresult.Energies[2]; }