Bug fix for matched click classifier (#10)

* Bug fix for matched click classifier

Some of the alarm stuff in the click detector was throwing an exception because the matched click classifier adds a click ID that is not in the click ID module's list...now fixed and test with porpoises.

* Matched click classifier now has template names

The name field of the imported templates is now the file name of the template.
This commit is contained in:
Jamie Mac 2022-02-08 10:56:46 +00:00 committed by GitHub
parent 3c18822949
commit 6ef5adcad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View File

@ -108,6 +108,9 @@ public class ClickAlarmManager extends PamProcess {
// System.out.println("ClickAlarm hashcode, time = " + System.identityHashCode(arg) + "," + cd.getTimeMilliseconds() + "," + cd.getClickType() );
if (cd.getClickType()!=0) {
ClickTypeCommonParams commonParams = clickControl.getClickIdentifier().getCommonParams(cd.getClickType());
if (commonParams==null) return;
Boolean soundAlarm = commonParams.getAlarmEnabled();
if (soundAlarm != null && soundAlarm) {

View File

@ -401,6 +401,7 @@ public class BasicClickIdentifier implements ClickIdentifier, PamSettings {
*/
public ClickTypeCommonParams getCommonParams(int code) {
int codeIdx = codeToListIndex(code);
if (codeIdx>=idParameters.clickTypeParams.size()) return null;
return idParameters.clickTypeParams.get(codeIdx);
}

View File

@ -53,7 +53,7 @@ public class ImportTemplateCSV implements TemplateImport {
//now create waveform
// System.out.println("Create a waveform with " + waveform.length + " samples with a sample rate of "
// + sR + " Hz");
MatchTemplate matchedTemplate = new MatchTemplate("Imported Waveform", waveform, sR);
MatchTemplate matchedTemplate = new MatchTemplate(filePath.getName(), waveform, sR);
//TODO
return matchedTemplate;
}

View File

@ -60,7 +60,7 @@ public class ImportTemplateMAT implements TemplateImport {
//now create waveform
// System.out.println("Create a waveform with " + waveform.length + " samples with a sample rate of "
// + sR + " Hz");
MatchTemplate matchedTemplate = new MatchTemplate("Imported Waveform", waveform, sR);
MatchTemplate matchedTemplate = new MatchTemplate(filePath.getName(), waveform, sR);
return matchedTemplate;
} catch (FileNotFoundException e) {