Merge fixes to click train detector

This commit is contained in:
Jamie Mac 2022-04-20 11:21:25 +01:00
parent d9d4b0fee8
commit 628b965a8b
3 changed files with 37 additions and 18 deletions

View File

@ -7,11 +7,9 @@ import clickTrainDetector.ClickTrainControl;
import clickTrainDetector.classification.CTClassification;
import clickTrainDetector.classification.CTClassifier;
import clickTrainDetector.classification.CTClassifierParams;
import clickTrainDetector.classification.CTClassifierType;
import clickTrainDetector.classification.bearingClassifier.BearingClassifier;
import clickTrainDetector.classification.bearingClassifier.BearingClassifierParams;
import clickTrainDetector.classification.idiClassifier.IDIClassification;
import clickTrainDetector.classification.idiClassifier.IDIClassifier;
import clickTrainDetector.classification.simplechi2classifier.Chi2CTClassification;
import clickTrainDetector.classification.simplechi2classifier.Chi2ThresholdClassifier;
import clickTrainDetector.classification.templateClassifier.CTTemplateClassifier;
import clickTrainDetector.layout.classification.CTClassifierGraphics;
@ -19,7 +17,6 @@ import clickTrainDetector.layout.classification.standardClassifier.StandardClass
/**
* Combines the IDI, CHI2, BEARING and TEMPLATE classifier into one.
* @author Jamie Macaulay
*
*/
@ -51,6 +48,13 @@ public class StandardClassifier implements CTClassifier {
*/
private ClickTrainControl clickTrainControl;
/**
* The classifier types used in the standard classifier.
* ****New types MUST BE ADDED HERE****
*/
public static CTClassifierType[] CLASSIFIER_TYPES = {CTClassifierType.CHI2THRESHOLD, CTClassifierType.IDICLASSIFIER, CTClassifierType.TEMPLATECLASSIFIER, CTClassifierType.BEARINGCLASSIFIER};
public StandardClassifier(ClickTrainControl clickTrainControl, int speciesID) {
this.clickTrainControl = clickTrainControl;
standardClassifierGraphics = new StandardClassifierGraphics(clickTrainControl, this);
@ -66,14 +70,27 @@ public class StandardClassifier implements CTClassifier {
private void createClassifiers() {
classifiers = new ArrayList<CTClassifier>();
//do this so that is CLASSIFIER_TYPES changes order things still work.
for (int i=0; i<CLASSIFIER_TYPES.length; i++) {
switch (CLASSIFIER_TYPES[i]) {
default:
break;
case CHI2THRESHOLD:
classifiers.add(new Chi2ThresholdClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
break;
case IDICLASSIFIER:
classifiers.add(new IDIClassifier(clickTrainControl,SUB_CLASSIFIER_SPECIESID));
break;
case TEMPLATECLASSIFIER:
classifiers.add(new CTTemplateClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
break;
case BEARINGCLASSIFIER:
classifiers.add(new BearingClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
break;
}
}
setClassifierParams();
}

View File

@ -16,7 +16,7 @@ public class SpectrumTemplateDataUnit extends PamDataUnit {
public SpectrumTemplateDataUnit(MatchTemplate spectrumTemplate) {
super(0L);
this.spectrumTemplate=spectrumTemplate;
this.setSampleDuration(1000L); //needed for some plots sometimes...
}
}

View File

@ -129,6 +129,8 @@ public abstract class SpectrumPlot <D extends PamDataUnit> implements Detection
@Override
public void setupAxis(D data, double sR, DetectionPlotProjector plotProjector) {
if (data ==null) return;
this.sR=sR;
int[] minmax = getAxisMinMaxSamples(plotProjector);