Merge pull request #31 from PAMGuard/main

X£ and ROCCA updates
This commit is contained in:
Douglas Gillespie 2022-11-15 15:45:41 +00:00 committed by GitHub
commit e6740e1534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 6 deletions

View File

@ -400,7 +400,7 @@ public class PamObservable {//extends PanelOverlayDraw {
} }
} }
private Timer t = new Timer(1000, new ActionListener() { private Timer t = new Timer(4321, new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if (cpuUsage == null) return; if (cpuUsage == null) return;
@ -413,6 +413,16 @@ public class PamObservable {//extends PanelOverlayDraw {
} }
}); });
/**
* Had some issues with the Timer holding a reference to the underlying PamDataBlock
* (RoccaContourDataBlock, in this case) and not releasing it for garbage collection.
* Added in this method to force the timer to stop and release it's hold.
*/
public void stopTimer() {
t.stop();
}
public double getCPUPercent(int objectIndex) { public double getCPUPercent(int objectIndex) {
if (objectIndex < 0 || objectIndex >= cpuPercent.length) return -1; if (objectIndex < 0 || objectIndex >= cpuPercent.length) return -1;
return cpuPercent[objectIndex]; return cpuPercent[objectIndex];

View File

@ -388,7 +388,9 @@ public class RoccaProcess extends PamProcess {
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 1.5 || rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 1.5 ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) < 2000. || rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) < 2000. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 28000. )) { rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 28000. )) {
rcdb.setNaturalLifetimeMillis(0); // rcdb.setNaturalLifetimeMillis(0);
rcdb.stopTimer();
rcdb = null;
return; return;
} }
if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("HIWhist.model") && if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("HIWhist.model") &&
@ -402,7 +404,9 @@ public class RoccaProcess extends PamProcess {
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 60000. || rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 60000. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQRANGE) < 800. || rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQRANGE) < 800. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQRANGE) > 14000. )) { rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQRANGE) > 14000. )) {
rcdb.setNaturalLifetimeMillis(0); // rcdb.setNaturalLifetimeMillis(0);
rcdb.stopTimer();
rcdb = null;
return; return;
} }
if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("NWAtlWhist.model") && if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("NWAtlWhist.model") &&
@ -412,7 +416,9 @@ public class RoccaProcess extends PamProcess {
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 2.5 || rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 2.5 ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) < 9100. || rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) < 9100. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 82000. )) { rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 82000. )) {
rcdb.setNaturalLifetimeMillis(0); // rcdb.setNaturalLifetimeMillis(0);
rcdb.stopTimer();
rcdb = null;
return; return;
} }
} }
@ -431,7 +437,9 @@ public class RoccaProcess extends PamProcess {
saveContourPoints(rcdb, rcdb.getChannelMap(), ++numDetections, sNum); saveContourPoints(rcdb, rcdb.getChannelMap(), ++numDetections, sNum);
saveContourStats(rcdb, rcdb.getChannelMap(), numDetections, sNum); saveContourStats(rcdb, rcdb.getChannelMap(), numDetections, sNum);
saveContour(rcdb, rcdb.getChannelMap(), numDetections, sNum); saveContour(rcdb, rcdb.getChannelMap(), numDetections, sNum);
rcdb.setNaturalLifetimeMillis(0); // rcdb.setNaturalLifetimeMillis(0);
rcdb.stopTimer();
rcdb = null;
/* if this is a click detection (signal, not noise) */ /* if this is a click detection (signal, not noise) */
} else if (o==manClickSourceData || o==autoClickSourceData) { } else if (o==manClickSourceData || o==autoClickSourceData) {
@ -499,18 +507,24 @@ public class RoccaProcess extends PamProcess {
(rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 35. || (rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 35. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.005 || rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.005 ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) { rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) {
rcdb.stopTimer();
rcdb = null;
return; return;
} }
if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("HIClick.model") && if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("HIClick.model") &&
(rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 40. || (rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 40. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.01 || rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.01 ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) { rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) {
rcdb.stopTimer();
rcdb = null;
return; return;
} }
if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("NWAtlClick.model") && if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("NWAtlClick.model") &&
(rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 35. || (rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 35. ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.005 || rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.005 ||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) { rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) {
rcdb.stopTimer();
rcdb = null;
return; return;
} }
} }
@ -529,7 +543,9 @@ public class RoccaProcess extends PamProcess {
// add call to update side panel. Set the isClick flag to True // add call to update side panel. Set the isClick flag to True
updateSidePanel(rcdb, true); updateSidePanel(rcdb, true);
saveContourStats(rcdb, rcdb.getChannelMap(), numDetections, sNum); saveContourStats(rcdb, rcdb.getChannelMap(), numDetections, sNum);
rcdb.setNaturalLifetimeMillis(0); // rcdb.setNaturalLifetimeMillis(0);
rcdb.stopTimer();
rcdb = null;
} }