Merge branch 'main' into main

This commit is contained in:
Douglas Gillespie 2022-09-27 16:40:45 +01:00 committed by GitHub
commit 12eee1ef40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 67 additions and 21 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId>
<version>2.02.04aa</version>
<version>2.02.04ac</version>
<name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>

View File

@ -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

View File

@ -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);
}

View File

@ -123,7 +123,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);
}
else {

View File

@ -10,6 +10,7 @@ import clickTrainDetector.CTDataUnit;
import clickTrainDetector.CTDetectionGroupDataUnit;
import clickTrainDetector.ClickTrainControl;
import clickTrainDetector.ClickTrainDataBlock;
import clickTrainDetector.classification.CTClassification;
import clickTrainDetector.layout.dataselector.CTDataSelectPane;
import clickTrainDetector.layout.dataselector.CTDataSelectPanel;
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
@ -112,8 +113,8 @@ public class CTDataSelector extends DataSelector {
if (ctSelectParams.needsLoc && !pamDataUnit.getLocalisation().hasLocContent(LocContents.HAS_RANGE)) return 0;
return 1;
}
/**
@ -123,19 +124,38 @@ public class CTDataSelector extends DataSelector {
*/
private boolean isClassified(CTDetectionGroupDataUnit ctDataUnit) {
if (!ctSelectParams.needsClassification) return true;
if (ctSelectParams.allowAnyClassification) return true;
if (ctDataUnit instanceof CTDataUnit) {
CTDataUnit clickTrain = (CTDataUnit) ctDataUnit;
if (clickTrain.ctClassifications==null) return false;
//iterate through all the classifiers and allowed classification types.
for (int i=0; i<ctSelectParams.classifier.length; i++) {
for (int j=0; j<clickTrain.ctClassifications.size(); j++) {
if (clickTrain.ctClassifications.get(j).getSpeciesID()==ctSelectParams.classifier[i]) {
return true;
int nClass = clickTrain.ctClassifications.size();
if (ctSelectParams.allowMultipleChoices == false) {
int clsInd = clickTrain.getClassificationIndex();
if (clsInd < 0) {
return false;
}
if (clsInd >= clickTrain.ctClassifications.size()) {
return false;
}
CTClassification singleClass = clickTrain.ctClassifications.get(clsInd);
for (int i = 0; i < ctSelectParams.classifier.length; i++) {
if (ctSelectParams.classifier[i] == singleClass.getSpeciesID()) {
return true;
}
}
return false;
}
else {
//iterate through all the classifiers and allowed classification types.
for (int i=0; i<ctSelectParams.classifier.length; i++) {
for (int j=0; j<nClass; j++) {
if (clickTrain.ctClassifications.get(j).getSpeciesID()==ctSelectParams.classifier[i]) {
return true;
}
}
}
}

View File

@ -35,9 +35,22 @@ public class CTSelectParams extends DataSelectParams implements Serializable, Cl
public int minSubDetections = 10;
/**
* True of the click train detector needs a classifcation
* True of the click train detector needs a classifcation No !!!!
* This 'needsClassification' variable was been used the wrong way around throughout and is screwing the classiifer.
* I've therefore replaced it with the variable allowAll which is how this is actually used !
* Given that anything using this would have has screwed logic, I don't care if I break
* a config or two ! DG 22/9/22
*/
public boolean needsClassification = false;
public boolean allowAnyClassification = false;
// private boolean needsClassification = false;
/**
* In the data selector, if this is false it will only look at the best classifier, i.e. the
* one with the best classifier score. If set true it will check every species above min
* score even if it's not the first classification choice.
*/
public boolean allowMultipleChoices = false;
/**
* The classifier type(s) to select

View File

@ -77,6 +77,8 @@ public class CTDataSelectPanel implements PamDialogPanel {
private JPanel classification;
private JCheckBox[] classifierCheckBoxes;
private JCheckBox allowMultipleChoices; //
private JCheckBox unclassifiedCheckBox;
@ -232,6 +234,12 @@ public class CTDataSelectPanel implements PamDialogPanel {
classifierCheckBoxes[i].setSelected(true); //default should be selected
constraints.gridy++;
}
constraints.gridy++;
classification.add(allowMultipleChoices = new JCheckBox("Allow multiple classification options"), constraints);
allowMultipleChoices.setToolTipText("If not selected, then only the first choice classification is compared to the " +
"selected list. If selected, then all classifiers passing minimum score may be used");
classification.validate(); //make sure everything is laid out properly.
setClassifierParams();
@ -245,6 +253,7 @@ public class CTDataSelectPanel implements PamDialogPanel {
classifierCheckBoxes[i].setEnabled(!unclassifiedCheckBox.isSelected());
}
}
allowMultipleChoices.setEnabled(!unclassifiedCheckBox.isSelected());
}
@ -253,7 +262,7 @@ public class CTDataSelectPanel implements PamDialogPanel {
*/
private void setClassifierParams() {
unclassifiedCheckBox.setSelected(currentParams.needsClassification );
unclassifiedCheckBox.setSelected(currentParams.allowAnyClassification );
if (currentParams.classifier==null ) {
for (int i=0; i<classifierCheckBoxes.length; i++) {
@ -270,6 +279,7 @@ public class CTDataSelectPanel implements PamDialogPanel {
}
}
}
allowMultipleChoices.setSelected(currentParams.allowMultipleChoices);
}
@ -278,7 +288,9 @@ public class CTDataSelectPanel implements PamDialogPanel {
* Get the parameters for the classifiers to use.
*/
private void getClassifierParams() {
currentParams.needsClassification = unclassifiedCheckBox.isSelected();
currentParams.allowAnyClassification = unclassifiedCheckBox.isSelected();
currentParams.allowMultipleChoices = allowMultipleChoices.isSelected();
int count = 0;
for (int i=0; i<classifierCheckBoxes.length; i++) {

View File

@ -489,7 +489,7 @@ abstract public class PamCursor {
preparedUpdateStatement.setObject(iCol + 1, tableDef.getIndexItem().getValue());
int result = preparedUpdateStatement.executeUpdate();
if (result<1) {
System.out.println("update db result = " + String.valueOf(result));
// System.out.println("update db result = " + String.valueOf(result));
String msg = String.format("There was a problem updating row %d in table %s",
tableDef.getIndexItem().getValue(), tableDef.getTableName());
PamWarning dispWarning = new PamWarning("Database Error", msg, 2);