diff --git a/src/dataPlotsFX/scroller/TDAcousticScroller.java b/src/dataPlotsFX/scroller/TDAcousticScroller.java index 65ca2429..6eb144f8 100644 --- a/src/dataPlotsFX/scroller/TDAcousticScroller.java +++ b/src/dataPlotsFX/scroller/TDAcousticScroller.java @@ -184,15 +184,21 @@ public class TDAcousticScroller extends AcousticScrollerFX implements PamSetting //add a listener so the visible amount changes of the spinner changes value. spinner.valueProperty().addListener((obsVal, oldVal, newVal)->{ - if (spinnerCall) return ; //prevent overflow. - if (newVal<=this.getRangeMillis()) { -// Debug.out.println("TDAcousticScroller: TimeRangeSpinner: " + newVal); - Platform.runLater(()->{ //why? But seems necessary - super.setVisibleMillis(newVal); - }); - } - else spinner.getValueFactory().decrement(1); //need to use decrement here instead of set time because otherwise arrow buttons - //don't work. + if (spinnerCall) return ; //prevent overflow + + /** + * There are two slightly different modes here- in viewer mode we want the spinner to set + * only the visible range. However in real time mode we want it to set the visible time and + * the data keep time. + */ + if (newVal<=this.getRangeMillis() || !isViewer) { + // Debug.out.println("TDAcousticScroller: TimeRangeSpinner: " + newVal); + Platform.runLater(()->{ //why? But seems necessary + super.setVisibleMillis(newVal); + super.setRangeMillis(0, newVal, false); + }); + } + else spinner.getValueFactory().decrement(1); //need to use decrement here instead of set time because otherwise arrow buttons }); } diff --git a/src/matchedTemplateClassifer/MTClassifier.java b/src/matchedTemplateClassifer/MTClassifier.java index 763d921b..0b573d5b 100644 --- a/src/matchedTemplateClassifer/MTClassifier.java +++ b/src/matchedTemplateClassifer/MTClassifier.java @@ -11,6 +11,9 @@ import com.jmatio.types.MLDouble; import com.jmatio.types.MLStructure; import Filters.SmoothingFilter; +import Localiser.DelayMeasurementParams; +import Localiser.algorithms.Correlations; +import Localiser.algorithms.TimeDelayData; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; @@ -92,7 +95,16 @@ public class MTClassifier implements Serializable, Cloneable, ManagedParameters * Decimates waveforms. */ transient private WavInterpolator wavInterpolator = new WavInterpolator(); + + /** + * The delay measurment parameters. + */ + private transient DelayMeasurementParams delayMeasurementParams = defualtDelayParams(); + /** + * Runs the cross correlation algorithm. + */ + private transient Correlations correlations = new Correlations(); /** * Default MT classifier @@ -101,6 +113,14 @@ public class MTClassifier implements Serializable, Cloneable, ManagedParameters fft= new FastFFT(); } + private DelayMeasurementParams defualtDelayParams() { + DelayMeasurementParams delayMeasurementParams = new DelayMeasurementParams(); + //delayMeasurementParams.setUpSample(4); + delayMeasurementParams.setFftFilterParams(null); + + return delayMeasurementParams; + } + /** * Get the match waveform FFT for the sampleRate. * @param fftLength - the FFTlength to use. Bins around waveform peak are used. @@ -376,7 +396,7 @@ public class MTClassifier implements Serializable, Cloneable, ManagedParameters int fftLength = click.length()*2; ComplexArray matchResult= new ComplexArray(fftLength); - ComplexArray matchTemplate = getWaveformMatchFFT(sR,fftLength); + ComplexArray matchTemplate = getWaveformMatchFFT(sR,fftLength); //remember this is the complex conjugate //System.out.println("matchTemplate interp: len: " + interpWaveformMatch.length+ " max: " + PamArrayUtils.max(interpWaveformMatch)); //System.out.println("matchTemplate: len: " + waveformMatch.waveform.length+ " max: " + PamArrayUtils.max(waveformMatch.waveform)); @@ -386,7 +406,7 @@ public class MTClassifier implements Serializable, Cloneable, ManagedParameters } ComplexArray rejectResult= new ComplexArray(fftLength); - ComplexArray rejectTemplate = getWaveformRejectFFT(sR, fftLength); + ComplexArray rejectTemplate = getWaveformRejectFFT(sR, fftLength); //remember this is the complex conjugate for (int i=0; i