This commit is contained in:
Gianpaolo Coro 2014-04-30 15:53:11 +00:00
parent e3418858f7
commit 557c12a56f
1 changed files with 10 additions and 3 deletions

View File

@ -145,6 +145,7 @@ public class TimeSeriesAnalysis extends StandardLocalExternalAlgorithm {
if (display)
SignalProcessing.displaySignalWithTime(ts.getValues(), ts.getTime(), "Time Series", chartpattern);
signalImg = SignalProcessing.renderSignalWithTime(ts.getValues(), ts.getTime(), "Original Time Series", chartpattern);
int originalSignalLength = ts.getValues().length;
ts.convertToUniformSignal(0);
AnalysisLogger.getLogger().debug("TimeSeriesAnalysis->Uniform sampling finished");
status = 30;
@ -153,6 +154,12 @@ public class TimeSeriesAnalysis extends StandardLocalExternalAlgorithm {
AnalysisLogger.getLogger().debug("TimeSeriesAnalysis->Detecting periodicity");
PeriodicityDetector pd = new PeriodicityDetector();
double F = pd.detectFrequency(ts.getValues(), 1, 0.01f, 0.5f, frequencyResDouble, display);
outputParameters.put("Original Time Series Length", ""+originalSignalLength);
outputParameters.put("Uniformly Samples Time Series Length", ""+ts.getValues().length);
outputParameters.put("Spectral Analysis Window Length", ""+pd.currentWindowAnalysisSamples);
outputParameters.put("Spectral Analysis Window Shift", ""+pd.currentWindowShiftSamples);
outputParameters.put("Spectral Analysis Sampling Rate", ""+MathFunctions.roundDecimal(pd.currentSamplingRate,2));
outputParameters.put("Spectrogram Sections", ""+pd.currentspectrum.length);
outputParameters.put("Detected Frequency (samples^-1)", ""+MathFunctions.roundDecimal(F,2));
outputParameters.put("Indecision on Frequency", "["+MathFunctions.roundDecimal(pd.lowermeanF,2)+" , "+MathFunctions.roundDecimal(pd.uppermeanF,2) + "]");
outputParameters.put("Average detected Period (samples)", ""+MathFunctions.roundDecimal(pd.meanPeriod,2));
@ -172,11 +179,11 @@ public class TimeSeriesAnalysis extends StandardLocalExternalAlgorithm {
Date[] newtimes = ts.extendTime(pointsToReconstruct);
SSADataset ssa = null;
if (windowLength<newtimes.length)
if (windowLength<ts.getValues().length)
ssa = SSAWorkflow.applyCompleteWorkflow(values, windowLength, eigenvaluespercthr, pointsToReconstruct, false);
else{
AnalysisLogger.getLogger().debug("TimeSeriesAnalysis->SSA analysis impossible to complete");
outputParameters.put("SSA Note:", "The window length is higher than the signal length. Please reduce the value.");
outputParameters.put("SSA Note:", "The window length is higher than the signal length. Please reduce the value to less than the signal length.");
return;
}
AnalysisLogger.getLogger().debug("TimeSeriesAnalysis->SSA analysis completed");
@ -255,7 +262,7 @@ public class TimeSeriesAnalysis extends StandardLocalExternalAlgorithm {
inputs.add(p1);
addDoubleInput(frequencyResolution, "The precision in detecting the period. The lower this number the less the number of points in the Spectrogram (higher number of samples used at each step). Reducing this, the spectrogram will be finer and sharper, but you should tune it. Too many samples will make the Spectrogram noisy.", "1");
addEnumerateInput(AggregationFunctions.values(), aggregationFunction, "Function to apply to samples with the same time instant", AggregationFunctions.SUM.name());
addIntegerInput(SSAAnalysisWindowSamples, "The number of samples in the produced uniformly sampled signal, to use in the SSA algorithm. Must be less than the Time Series length. This number should identify a portion of the signal long enough to make the system guess the nature of the trend", "20");
addIntegerInput(SSAAnalysisWindowSamples, "The number of samples in the produced uniformly sampled signal, to use in the SSA algorithm. Must be strictly less than the Time Series length. This number should identify a portion of the signal long enough to make the system guess the nature of the trend", "20");
addDoubleInput(SSAEigenvaluesThreshold, "The threshold under which an SSA eigenvalue will be ignored, along with its eigenvector, for the reconstruction of the signal", "0.7");
addIntegerInput(SSAPointsToForecast, "The number of points to forecast over the original length of the time series", "10");
DatabaseType.addDefaultDBPars(inputs);