This commit is contained in:
Gianpaolo Coro 2014-02-03 13:57:08 +00:00
parent 01a355420b
commit 834f19eb06
1 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package org.gcube.dataanalysis.ecoengine.signals;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JPanel;
@ -278,6 +279,18 @@ public class SignalConversions {
return spectrum;
}
public static void displaySpectrogram(double[][] spectrum, String name, int samplingRate, int windowshift, int frameslength, boolean display) throws Exception {
SpectrogramCustom spec = new SpectrogramCustom(null, samplingRate, Window.get(Window.HAMMING, frameslength), windowshift, frameslength, 640, 480);
spec.spectra = new ArrayList<double[]>();
for (int i=0;i<spectrum.length;i++){
spec.spectra.add(spectrum[i]);
}
spec.showInJFrame(name, true, true);
}
public static float spectrumTimeFromIndex(int index, float windowShiftTime) {
return index * windowShiftTime;
}