mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 16:42:27 +00:00
Merge fixes to click train detector
This commit is contained in:
parent
d9d4b0fee8
commit
628b965a8b
@ -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,14 +17,13 @@ import clickTrainDetector.layout.classification.standardClassifier.StandardClass
|
||||
|
||||
/**
|
||||
* Combines the IDI, CHI2, BEARING and TEMPLATE classifier into one.
|
||||
|
||||
* @author Jamie Macaulay
|
||||
*
|
||||
*/
|
||||
public class StandardClassifier implements CTClassifier {
|
||||
|
||||
/**
|
||||
* It's quite complicated to keep track of the species ID for all sub classifier but just set them
|
||||
* It's quite complicated to keep track of the species ID for all sub classifier but just set them
|
||||
* to 1 to check whether the classifier has passed or not,
|
||||
*/
|
||||
public int SUB_CLASSIFIER_SPECIESID = 1;
|
||||
@ -50,6 +47,13 @@ public class StandardClassifier implements CTClassifier {
|
||||
* Click train control.
|
||||
*/
|
||||
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;
|
||||
@ -57,7 +61,7 @@ public class StandardClassifier implements CTClassifier {
|
||||
standardClssfrParams.speciesFlag=speciesID;
|
||||
|
||||
//load the settings
|
||||
createClassifiers();
|
||||
createClassifiers();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,19 +69,32 @@ public class StandardClassifier implements CTClassifier {
|
||||
*/
|
||||
private void createClassifiers() {
|
||||
classifiers = new ArrayList<CTClassifier>();
|
||||
|
||||
classifiers.add(new Chi2ThresholdClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
|
||||
|
||||
classifiers.add(new IDIClassifier(clickTrainControl,SUB_CLASSIFIER_SPECIESID));
|
||||
|
||||
classifiers.add(new CTTemplateClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
|
||||
|
||||
classifiers.add(new BearingClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
|
||||
|
||||
|
||||
//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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the parameters for the individual classifiers
|
||||
*/
|
||||
@ -107,7 +124,7 @@ public class StandardClassifier implements CTClassifier {
|
||||
@Override
|
||||
public CTClassification classifyClickTrain(CTDataUnit clickTrain) {
|
||||
|
||||
int speciesID = standardClssfrParams.speciesFlag;
|
||||
int speciesID = standardClssfrParams.speciesFlag;
|
||||
|
||||
System.out.println("Standard Classificiation: " );
|
||||
|
||||
@ -168,4 +185,4 @@ public class StandardClassifier implements CTClassifier {
|
||||
return classifiers;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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...
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -128,6 +128,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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user