From f6e6cd0fde0c698742d059be2eab3aed8047da59 Mon Sep 17 00:00:00 2001 From: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com> Date: Thu, 22 Sep 2022 13:58:41 +0100 Subject: [PATCH] CTD Data Selector fixes (#66) * Plugin Help Small change to Help system so that plugins under development can more easily display their help * PamModel update Notes on how to add a plugin to the model during the plugin development phase. * Click Train Detector Help * Help for backup manager * Temp version 2.02.04ac CTD data selector fixes Fixed both the way the CTD uses data selectors from other detectors AND the way that it's own data selector works. --- pom.xml | 2 +- src/PamController/PamguardVersionInfo.java | 4 ++-- .../classification/CTClassifierManager.java | 8 ++++---- .../classification/CTClassifierParams.java | 13 ++++++++----- .../Chi2ThresholdClassifier.java | 3 ++- .../dataselector/CTDataSelector.java | 14 +++++++++++--- .../dataselector/CTSelectParams.java | 17 +++++++++++++++-- .../layout/dataselector/CTDataSelectPanel.java | 16 ++++++++++++++-- src/generalDatabase/pamCursor/PamCursor.java | 2 +- 9 files changed, 58 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 2f583f7f..c8e578f0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.pamguard Pamguard - 2.02.04aa + 2.02.04ac Pamguard Java12+ Pamguard for Java 12+, using Maven to control dependcies www.pamguard.org diff --git a/src/PamController/PamguardVersionInfo.java b/src/PamController/PamguardVersionInfo.java index 7c93b681..7e841d23 100644 --- a/src/PamController/PamguardVersionInfo.java +++ b/src/PamController/PamguardVersionInfo.java @@ -31,12 +31,12 @@ public class PamguardVersionInfo { * Version number, major version.minorversion.sub-release. * Note: can't go higher than sub-release 'f' */ - static public final String version = "2.02.04aa"; + static public final String version = "2.02.04ac"; /** * Release date */ - static public final String date = "13 September 2022"; + static public final String date = "22 September 2022"; // /** // * Release type - Beta or Core diff --git a/src/clickTrainDetector/classification/CTClassifierManager.java b/src/clickTrainDetector/classification/CTClassifierManager.java index 2389d8ab..e125426c 100644 --- a/src/clickTrainDetector/classification/CTClassifierManager.java +++ b/src/clickTrainDetector/classification/CTClassifierManager.java @@ -238,10 +238,10 @@ public class CTClassifierManager { continue; } - if (ctParams[i].uniqueID ==null) { - //old versions may not have a unique ID so needs to be added. - ctParams[i].uniqueID = UUID.randomUUID().toString(); - } +// if (ctParams[i].uniqueID ==null) { +// //old versions may not have a unique ID so needs to be added. +// ctParams[i].uniqueID = UUID.randomUUID().toString(); +// } aClassifier.setParams(ctParams[i]); cTClassifiers.add(aClassifier); } diff --git a/src/clickTrainDetector/classification/CTClassifierParams.java b/src/clickTrainDetector/classification/CTClassifierParams.java index 2841b1ab..2e8841b0 100644 --- a/src/clickTrainDetector/classification/CTClassifierParams.java +++ b/src/clickTrainDetector/classification/CTClassifierParams.java @@ -22,7 +22,7 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam public CTClassifierParams() { - this.uniqueID = UUID.randomUUID().toString(); +// this.uniqueID = UUID.randomUUID().toString(); // see comment below } @@ -32,10 +32,13 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam public String classifierName = ""; - /** - * A unique ID for the classifier that never changes. This is important for accessing data selectors. - */ - public String uniqueID; +// /** +// * A unique ID for the classifier that never changes. This is important for accessing data selectors. +// * GET RID OF THIS, Every time you make a new set of params you get a new ID and it then creates a new +// * classifier selector with default settings, so the classifier selectors never work. +// Classifier selectors need to be names on something that's not oging to change, so the module name and the classifier species ame. +// */ +// public String uniqueID; /** diff --git a/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java b/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java index 20473840..3bafa3b3 100644 --- a/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java +++ b/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java @@ -120,7 +120,8 @@ public class Chi2ThresholdClassifier implements CTClassifier { //create the data selector //System.out.println("Data selector: " + dataSelector); if (source!=null) { - dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + " " + clssfrParams.uniqueID + + dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.classifierName + "_X2_threshold_classifier", false, null); //System.out.println("Data selector: " + dataSelector); } diff --git a/src/clickTrainDetector/dataselector/CTDataSelector.java b/src/clickTrainDetector/dataselector/CTDataSelector.java index 97e14554..2ed55c9a 100644 --- a/src/clickTrainDetector/dataselector/CTDataSelector.java +++ b/src/clickTrainDetector/dataselector/CTDataSelector.java @@ -112,8 +112,8 @@ public class CTDataSelector extends DataSelector { if (ctSelectParams.needsLoc && !pamDataUnit.getLocalisation().hasLocContent(LocContents.HAS_RANGE)) return 0; - return 1; + } /** @@ -123,7 +123,11 @@ public class CTDataSelector extends DataSelector { */ private boolean isClassified(CTDetectionGroupDataUnit ctDataUnit) { - if (!ctSelectParams.needsClassification) return true; + if (ctSelectParams.allowAnyClassification) return true; + + if (this.getSelectorName().contains("Dolphin")) { + System.out.println("Dolphin classifier looking at " + ctDataUnit); + } if (ctDataUnit instanceof CTDataUnit) { @@ -131,9 +135,13 @@ public class CTDataSelector extends DataSelector { if (clickTrain.ctClassifications==null) return false; + int nClass = clickTrain.ctClassifications.size(); + if (ctSelectParams.allowMultipleChoices == false) { + nClass = Math.min(nClass, 1); + } //iterate through all the classifiers and allowed classification types. for (int i=0; i