Updates to click train detector

New GUI for click train classification - more intuitive and allows users to build more powerful classifiers.
CPOD data can now build average waveforms.
CPOD click trains can be viewed in TDisplayFX pop up menu displays
Fixed Peak Frequency symbol chooser so it saves the colour box settings
This commit is contained in:
Jamie Mac 2022-02-17 16:04:57 +00:00
parent b0d64c1fe3
commit 6ad6bde40f
7 changed files with 35 additions and 26 deletions

View File

@ -81,7 +81,7 @@ public class IDIClassification implements CTClassification {
@Override
public String getSummaryString() {
return String.format("IDI Classifier: Mean IDI %.5fs Median IDI %.5fs Std IDI%.5fs",
return String.format("IDI Classifier: Mean IDI %.4f\u00B0/s Median IDI %.4f\u00B0/s Std IDI%.4f\u00B0/s",
meanIDI, medianIDI, stdIDI);
}

View File

@ -37,13 +37,12 @@ public class IDIClassifier implements CTClassifier {
//check IDI classification is passed
boolean passesIDI = checkIDIMeasurements(clickTrain);
int speciesID = CTClassifier.NOSPECIES;
int speciesID = CTClassifier.NOSPECIES;
if (passesIDI) {
speciesID = idiParams.speciesFlag;
}
return new IDIClassification( speciesID, clickTrain.getIDIInfo().medianIDI, clickTrain.getIDIInfo().meanIDI, clickTrain.getIDIInfo().stdIDI);
}
@Override

View File

@ -1,8 +1,11 @@
package clickTrainDetector.classification.standardClassifier;
import clickTrainDetector.ClickTrainControl;
import clickTrainDetector.classification.CTClassification;
import clickTrainDetector.classification.CTClassifierType;
import clickTrainDetector.classification.ClassifierJSONLogging;
import clickTrainDetector.classification.bearingClassifier.BearingClassifierJSON;
/**
* A classification object for a standard classification
@ -12,6 +15,12 @@ import clickTrainDetector.classification.ClassifierJSONLogging;
*/
public class StandardClassification implements CTClassification {
/**
* Reference to the click control.
*/
private ClickTrainControl clickTrainControl;
/**
* The current species ID.
*/
@ -21,19 +30,17 @@ public class StandardClassification implements CTClassification {
* All the classifications.
*/
private CTClassification[] ctClassifications;
/**
* Standard classifier JSON logging.
*/
private StandardClassificationJSON standardClassifierJSONLogging;
public StandardClassification(CTClassification[] ctClassifications, int speciesID) {
this.ctClassifications=ctClassifications;
standardClassifierJSONLogging = new StandardClassificationJSON(ctClassifications);
this.speciesID=speciesID;
public StandardClassification(ClickTrainControl clickTrainControl, CTClassification[] ctClassifications, int speciesID) {
this.clickTrainControl=clickTrainControl;
this.ctClassifications=ctClassifications;
standardClassifierJSONLogging = new StandardClassificationJSON();
}
/**

View File

@ -58,7 +58,5 @@ public class StandardClassificationJSON extends SimpleClassifierJSONLogging {
return stClassification;
}
}

View File

@ -26,7 +26,7 @@ import clickTrainDetector.layout.classification.standardClassifier.StandardClass
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;
@ -57,7 +57,7 @@ public class StandardClassifier implements CTClassifier {
standardClssfrParams.speciesFlag=speciesID;
//load the settings
createClassifiers();
createClassifiers();
}
/**
@ -73,6 +73,7 @@ public class StandardClassifier implements CTClassifier {
classifiers.add(new CTTemplateClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
classifiers.add(new BearingClassifier(clickTrainControl, SUB_CLASSIFIER_SPECIESID));
setClassifierParams();
}
@ -106,7 +107,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: " );

View File

@ -4,6 +4,7 @@ import clickTrainDetector.classification.CTClassifierParams;
import clickTrainDetector.classification.CTClassifierType;
/**
* Standard classifier parameters.
*/
@ -24,15 +25,13 @@ public class StandardClassifierParams extends CTClassifierParams {
* List of which classifiers are enabled.
*/
public boolean[] enable;
public StandardClassifierParams(){
///very important to set this or else the clasifier manager does not
//know which classifier to create.
type = CTClassifierType.STANDARDCLASSIFIER;
}
//
// /**
// * Standard classifier parameters.

View File

@ -39,37 +39,41 @@ public class StandardClassifierPane extends SettingsPane<StandardClassifierPara
PamVBox vBox = new PamVBox();
vBox.setSpacing(5);
labels = new Label[standardClassifier.getClassifiers().size()];
labels = new Label[standardClassifier.getClassifiers().size()];
enableSwitch = new PamToggleSwitch[standardClassifier.getClassifiers().size()];
for (int i=0; i<standardClassifier.getClassifiers().size(); i++) {
enableSwitch[i] = new PamToggleSwitch("");
labels[i] = new Label(standardClassifier.getClassifiers().get(i).getName());
labels[i] = new Label(standardClassifier.getClassifiers().get(i).getName());
PamGuiManagerFX.titleFont2style(labels[i]);
final int ii = i;
enableSwitch[i].selectedProperty().addListener((obsVal, oldVal, newVal)->{
standardClassifier.getClassifiers().get(ii).getCTClassifierGraphics().getCTClassifierPane().setDisable(!enableSwitch[ii].isSelected());
labels[ii].setDisable(!enableSwitch[ii].isSelected());
labels[ii].setDisable(!enableSwitch[ii].isSelected());
});
PamHBox hBox = new PamHBox();
hBox.setSpacing(5);
hBox.getChildren().addAll(enableSwitch[i], labels[i]);
hBox.getChildren().addAll(enableSwitch[i], labels[i]);
vBox.getChildren().addAll(hBox, standardClassifier.getClassifiers().get(i).getCTClassifierGraphics().getCTClassifierPane());
}
return vBox;
}
private void disableClassifierPane(int ii) {
standardClassifier.getClassifiers().get(ii).getCTClassifierGraphics().getCTClassifierPane().setDisable(!enableSwitch[ii].isSelected());
labels[ii].setDisable(!enableSwitch[ii].isSelected());
}
@Override
public StandardClassifierParams getParams(StandardClassifierParams currParams) {
for (int i=0; i<standardClassifier.getClassifiers().size(); i++) {
@ -84,7 +88,8 @@ public class StandardClassifierPane extends SettingsPane<StandardClassifierPara
for (int i=0; i<standardClassifier.getClassifiers().size(); i++) {
standardClassifier.getClassifiers().get(i).getCTClassifierGraphics().setParams(input.ctClassifierParams[i]);
enableSwitch[i].setSelected(input.enable[i]);
disableClassifierPane(i);
disableClassifierPane(i);
}
}