diff --git a/.classpath b/.classpath index 188c7291..cc3e50cf 100644 --- a/.classpath +++ b/.classpath @@ -16,5 +16,6 @@ + diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgdf" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgdf" new file mode 100644 index 00000000..c6b75a01 Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgdf" differ diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgdx" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgdx" new file mode 100644 index 00000000..c7ee4668 Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgdx" differ diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgnf" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgnf" new file mode 100644 index 00000000..83e757de Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Clicks_20190601_224002.pgnf" differ diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Trigger_Background_20190601_224002.pgdf" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Trigger_Background_20190601_224002.pgdf" new file mode 100644 index 00000000..23617a0f Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Trigger_Background_20190601_224002.pgdf" differ diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Trigger_Background_20190601_224002.pgdx" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Trigger_Background_20190601_224002.pgdx" new file mode 100644 index 00000000..75ee16e2 Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/Click_Detector_Click_Detector_Trigger_Background_20190601_224002.pgdx" differ diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/PamguardSettings_20190601_224002.psfx" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/PamguardSettings_20190601_224002.psfx" new file mode 100644 index 00000000..f20953e2 Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/20190601/PamguardSettings_20190601_224002.psfx" differ diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/PamguardBinaryStoreUIDLog.xml" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/PamguardBinaryStoreUIDLog.xml" new file mode 100644 index 00000000..25604d7f --- /dev/null +++ "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/PamguardBinaryStoreUIDLog.xml" @@ -0,0 +1,17 @@ + + + + + Data_Acquisition_Sound_Acquisition_Raw_Data_ + 870 + + + Click_Detector_Click_Detector_Clicks_ + 13000083 + + + Click_Detector_Click_Detector_Trigger_Background_ + 13000003 + + + diff --git "a/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/serialisedBinaryMap.data" "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/serialisedBinaryMap.data" new file mode 100644 index 00000000..13d467ab Binary files /dev/null and "b/C:\\temp\\PamGuardTesting 2_02_04f\\PAMBinary/serialisedBinaryMap.data" differ diff --git a/pom.xml b/pom.xml index c8e578f0..50cfd095 100644 --- a/pom.xml +++ b/pom.xml @@ -778,7 +778,7 @@ pamguard.org x3 2.0.0 - + diff --git a/src/Acquisition/pamAudio/PamAudioSystem.java b/src/Acquisition/pamAudio/PamAudioSystem.java index 5e3f9d8e..e63b19bd 100644 --- a/src/Acquisition/pamAudio/PamAudioSystem.java +++ b/src/Acquisition/pamAudio/PamAudioSystem.java @@ -45,6 +45,14 @@ public class PamAudioSystem { } } + else if (file != null && isSudFile(file)) { + try { + return new SudAudioFileReader().getAudioInputStream(file); + } + catch (UnsupportedAudioFileException e) { + + } + } try { return AudioSystem.getAudioInputStream(file); } @@ -76,5 +84,21 @@ public class PamAudioSystem { String end = name.substring(name.length()-5).toLowerCase(); return (end.equals(".flac")); } + + /** + * Check whether a file is a .sud file. This is the file format used + * by SoundTraps which contains X3 compressed data. + * @param file - the file to check. + * @return true if a .sud file. + */ + private static boolean isSudFile(File file) { + String name = file.getName(); + if (name.length() < 5) { + return false; + } + String end = name.substring(name.length()-5).toLowerCase(); + return (end.equals(".sud")); + } + } diff --git a/src/Acquisition/pamAudio/SudAudioFileReader.java b/src/Acquisition/pamAudio/SudAudioFileReader.java new file mode 100644 index 00000000..0a88149e --- /dev/null +++ b/src/Acquisition/pamAudio/SudAudioFileReader.java @@ -0,0 +1,23 @@ +package Acquisition.pamAudio; + +import java.io.File; +import java.io.IOException; + +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.UnsupportedAudioFileException; + +/** + * Audio file reader for a .sud file. .sud files are a file format used by SoundTraps which contain + * blocks of X3 compressed data. + * @author Jamie Macaulay + * + */ +public class SudAudioFileReader { + + + public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/Acquisition/pamAudio/WavFileInputStream.java b/src/Acquisition/pamAudio/WavFileInputStream.java index 8216b71b..a0f2c0e5 100644 --- a/src/Acquisition/pamAudio/WavFileInputStream.java +++ b/src/Acquisition/pamAudio/WavFileInputStream.java @@ -79,6 +79,8 @@ public class WavFileInputStream extends AudioInputStream { return new WavFileInputStream(wavHeader, inputStream, audioFormat, nFrames); } + + static AudioFormat.Encoding getEncoding(int formatCode) { switch (formatCode) { case 1: diff --git a/src/PamUtils/PamAudioFileFilter.java b/src/PamUtils/PamAudioFileFilter.java index b21d057b..138689b7 100644 --- a/src/PamUtils/PamAudioFileFilter.java +++ b/src/PamUtils/PamAudioFileFilter.java @@ -15,6 +15,7 @@ public class PamAudioFileFilter extends PamFileFilter { // addFileType(".AIFF"); // addFileType(".FLAC"); addFileType(".flac"); + addFileType(".sud"); } } diff --git a/src/clickTrainDetector/classification/CTClassifierParams.java b/src/clickTrainDetector/classification/CTClassifierParams.java index 2e8841b0..a7a861d4 100644 --- a/src/clickTrainDetector/classification/CTClassifierParams.java +++ b/src/clickTrainDetector/classification/CTClassifierParams.java @@ -22,7 +22,8 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam public CTClassifierParams() { -// this.uniqueID = UUID.randomUUID().toString(); // see comment below + //this.uniqueID = UUID.randomUUID().toString(); + //System.out.println("Create classifier params: " + uniqueID); } @@ -32,13 +33,10 @@ 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. -// * 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; + /** + * A unique ID for the classifier that never changes. This is important for accessing data selectors. + */ + public String uniqueID = UUID.randomUUID().toString(); /** diff --git a/src/clickTrainDetector/classification/bearingClassifier/BearingClassifierParams.java b/src/clickTrainDetector/classification/bearingClassifier/BearingClassifierParams.java index 08031d6b..33c5b260 100644 --- a/src/clickTrainDetector/classification/bearingClassifier/BearingClassifierParams.java +++ b/src/clickTrainDetector/classification/bearingClassifier/BearingClassifierParams.java @@ -17,6 +17,7 @@ public class BearingClassifierParams extends CTClassifierParams implements Manag public BearingClassifierParams(){ super(); type = CTClassifierType.BEARINGCLASSIFIER; + //System.out.println("Bearing classifier params"); } /** diff --git a/src/clickTrainDetector/classification/idiClassifier/IDIClassifierParams.java b/src/clickTrainDetector/classification/idiClassifier/IDIClassifierParams.java index 4862c3dc..3c1e535f 100644 --- a/src/clickTrainDetector/classification/idiClassifier/IDIClassifierParams.java +++ b/src/clickTrainDetector/classification/idiClassifier/IDIClassifierParams.java @@ -11,6 +11,8 @@ public class IDIClassifierParams extends CTClassifierParams implements Serializa public IDIClassifierParams(){ super(); type = CTClassifierType.IDICLASSIFIER; + //System.out.println("IDI classifier params: " + this); + } /** diff --git a/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java b/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java index 3bafa3b3..b46eadb1 100644 --- a/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java +++ b/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdClassifier.java @@ -44,7 +44,7 @@ public class Chi2ThresholdClassifier implements CTClassifier { public Chi2ThresholdClassifier(ClickTrainControl clickTrainControl, int defaultSpeciesID) { this.clickTrainControl=clickTrainControl; clssfrParams.speciesFlag=defaultSpeciesID; - createDataSelector(clickTrainControl.getParentDataBlock()); + //createDataSelector(clickTrainControl.getParentDataBlock()); } @@ -110,12 +110,15 @@ public class Chi2ThresholdClassifier implements CTClassifier { } + /** * Get the data selector. * @param source - the source data block * @return the data selector. */ public void createDataSelector(PamDataBlock source) { + //System.out.println("Create data selector " +" " + clssfrParams.classifierName + " " + clssfrParams.speciesFlag + " " + clssfrParams.uniqueID ); + if (dataSelector==null || dataSelector.getPamDataBlock()!=source) { //create the data selector //System.out.println("Data selector: " + dataSelector); @@ -123,7 +126,6 @@ public class Chi2ThresholdClassifier implements CTClassifier { dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.classifierName + "_X2_threshold_classifier", false, null); - //System.out.println("Data selector: " + dataSelector); } else { dataSelector=null; @@ -198,7 +200,6 @@ public class Chi2ThresholdClassifier implements CTClassifier { @Override public void setParams(CTClassifierParams ctClassifierParams) { - // TODO Auto-generated method stub this.clssfrParams=(Chi2ThresholdParams) ctClassifierParams; } diff --git a/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdParams.java b/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdParams.java index a174a915..71cc2763 100644 --- a/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdParams.java +++ b/src/clickTrainDetector/classification/simplechi2classifier/Chi2ThresholdParams.java @@ -20,6 +20,7 @@ public class Chi2ThresholdParams extends CTClassifierParams implements ManagedPa public Chi2ThresholdParams(){ super(); super.type=CTClassifierType.CHI2THRESHOLD; + //System.out.println("Chi2thrwesh classifier params: " + this); } /** diff --git a/src/clickTrainDetector/classification/standardClassifier/StandardClassifier.java b/src/clickTrainDetector/classification/standardClassifier/StandardClassifier.java index 285e0acd..e3a9cf40 100644 --- a/src/clickTrainDetector/classification/standardClassifier/StandardClassifier.java +++ b/src/clickTrainDetector/classification/standardClassifier/StandardClassifier.java @@ -74,7 +74,7 @@ public class StandardClassifier implements CTClassifier { private void createClassifiers() { classifiers = new ArrayList(); - + //System.out.println("------CREATE CLASSIFIERS: -------"); //do this so that is CLASSIFIER_TYPES changes order things still work. for (int i=0; i { */ private ControlField minPercClicks; + private Chi2ThresholdParams currParams; + public SimpleCTClassifierPane(Chi2ThresholdClassifier simpleChi2Classifier) { super(null); this.simpleChi2Classifier=simpleChi2Classifier; @@ -214,6 +216,9 @@ public class SimpleCTClassifierPane extends SettingsPane { public Chi2ThresholdParams getParams(Chi2ThresholdParams currParams) { //System.out.println("Get PERC spinner value; " + minPercClicks.getSpinner().getValue()); + //System.out.println("Chi2 pane get params: " + this.currParams.speciesFlag + " " + this.currParams.uniqueID + " " + this.currParams); + + currParams.chi2Threshold=chi2Threshold.getSpinner().getValue(); //HACK - for some reason Integer spinner is returning a double currParams.minClicks=minClicks.getSpinner().getValue().intValue(); @@ -224,17 +229,25 @@ public class SimpleCTClassifierPane extends SettingsPane { simpleChi2Classifier.getDataSelector().getDialogPaneFX().getParams(true); } - return currParams; + currParams.uniqueID = this.currParams.uniqueID; + + return currParams=this.currParams; } @Override public void setParams(Chi2ThresholdParams input) { + this.currParams = input; + + //System.out.println("Chi2 pane set params: " + this.currParams.speciesFlag + " " + currParams.uniqueID + " " + currParams); + chi2Threshold.getSpinner().getValueFactory().setValue(input.chi2Threshold); //HACK - for some reason Integer spinner is returning a double minClicks.getSpinner().getValueFactory().setValue((double) input.minClicks); minTime.getSpinner().getValueFactory().setValue(input.minTime); minPercClicks.getSpinner().getValueFactory().setValue(input.minPercentage*100.); + + } @Override diff --git a/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierGraphics.java b/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierGraphics.java index f28617dc..f0db4902 100644 --- a/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierGraphics.java +++ b/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierGraphics.java @@ -64,7 +64,6 @@ public class StandardClassifierGraphics implements CTClassifierGraphics { @Override public void setParams(CTClassifierParams params) { standardClassifierPane.setParams((StandardClassifierParams) params); - } } diff --git a/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierPane.java b/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierPane.java index b6bc1dc0..a27424ad 100644 --- a/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierPane.java +++ b/src/clickTrainDetector/layout/classification/standardClassifier/StandardClassifierPane.java @@ -84,7 +84,15 @@ public class StandardClassifierPane extends SettingsPane