mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
updates to Rocca module (#85)
* allow Rocca to run without classifiers Fixed bug that threw an error if no classifier files were specified in Rocca Params dialog * add rocca switch to enable dev mode currently only shows/hides extra buttons in the Params dialog, but will extend to more options in the future * Fix memory issue with RoccaContourDataBlocks not being released for garbage collection Set RoccaContourDataBlock objects to null and stop PamObserver Timer to force release
This commit is contained in:
parent
655a546764
commit
ac280e1b6f
@ -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;
|
||||||
@ -412,6 +412,16 @@ public class PamObservable {//extends PanelOverlayDraw {
|
|||||||
lastCPUCheckTime = now;
|
lastCPUCheckTime = now;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user