Package rocca
Class RoccaProcess
java.lang.Object
PamguardMVC.PamProcess
rocca.RoccaProcess
- All Implemented Interfaces:
PamObserver
,ProcessAnnotator
Main Rocca process
- Author:
- Michael Oswald
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetDataBlockFilename
(RoccaContourDataBlock rcdb, String ext, int channel, int thisDetection, String sNum) Generates a filename for the wav clip and the csv file containing the contour points, based on the filename template stored in RoccaParametersboolean
Checks to see if classifier has been loadednewClickDetectorData
(ClickDetection clickDetection) Takes a ClickDetection created in the Click detector, and copies the data into a RoccaContourDataBlock for further analysis and classification.void
newData
(PamObservable o, PamDataUnit arg) this method called when new data arrivesnewWMDetectorData
(ConnectedRegionDataUnit wmDataUnit) Takes an AbstractWhistleDataUnit created in the Whistle and Moan detector, and copies the data into a RoccaContourDataBlock for further analysis and classification serialVersionUID = 9 if either firstIndx or lastIndx cannot be determined, return a null to the calling methodvoid
pamStart()
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway).void
pamStop()
Stops the process.void
Called for each process before any of them receive the PamStart commandboolean
saveContourPoints
(RoccaContourDataBlock rcdb, int channel, int thisDetection, String sNum) Saves the contour points in the datablock in a csv file.boolean
saveContourStats
(RoccaContourDataBlock rcdb, int channel, int thisDetection, String sNum) Saves all contour stats to the contour stats summary file, as defined in the Rocca Parameters.boolean
saveContourStats
(RoccaContourDataBlock rcdb, int channel, int thisDetection, String sNum, String source) Saves all contour stats to the contour stats summary file, as defined in the Rocca Parameters.void
setClassifierLoaded
(boolean classifierLoaded) Sets the classifier loaded flagvoid
setClickNoiseSourceData
(NoiseDataBlock clickNoiseSourceData) void
setClickSourceData
(TrackedClickDataBlock clickSourceData) void
setLatestClickNoise
(ClickDetection latestClickNoise) void
Method run on startupvoid
setWhistleSourceData
(AbstractWhistleDataBlock whistleSourceData) void
updateSidePanel
(RoccaContourDataBlock rcdb, boolean isClick) Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addData, addMultiPlexDataBlock, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, dumpBufferStatus, flushDataBlockBuffers, getAncestorDataBlock, getAnnotation, getChainPosition, getCompatibleDataUnits, getCpuPercent, getFrequencyRange, getLastSourceNotificationObject, getLastSourceNotificationType, getMuiltiplexDataBlock, getNumAnnotations, getNumMuiltiplexDataBlocks, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOfflineData, getOutputDataBlock, getOutputDataBlocks, getPamControlledUnit, getParentDataBlock, getParentDataBlocks, getParentProcess, getProcessCheck, getProcessName, getRawSourceDataBlock, getRawSourceDataBlock, getRequiredDataHistory, getSampleRate, getSourceDataBlock, getSourceProcess, hasOutputDatablock, isCanMultiThread, isExternalProcess, isMultiplex, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, prepareProcessOK, processNewBuoyData, receiveSourceNotification, relMillisecondsToSamples, relSamplesToMilliseconds, removeAllDataBlocks, removeAllMultiPlexDataBlocks, removeMultiPlexDataBlock, removeObservable, removeOutputDatablock, resetDataBlocks, saveViewerData, setCanMultiThread, setExternalProcess, setMultiplex, setParentDataBlock, setParentDataBlock, setProcessCheck, setProcessName, setSampleRate, toString, updateData
-
Constructor Details
-
RoccaProcess
Main constructor- Parameters:
roccaControl
-
-
-
Method Details
-
pamStart
public void pamStart()Description copied from class:PamProcess
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway).- Specified by:
pamStart
in classPamProcess
-
pamStop
public void pamStop()Description copied from class:PamProcess
Stops the process.- Specified by:
pamStop
in classPamProcess
-
prepareProcess
public void prepareProcess()Description copied from class:PamProcess
Called for each process before any of them receive the PamStart command- Overrides:
prepareProcess
in classPamProcess
-
newData
this method called when new data arrives- Overrides:
newData
in classPamProcess
-
updateSidePanel
-
isClassifierLoaded
public boolean isClassifierLoaded()Checks to see if classifier has been loaded- Returns:
- boolean indicating whether classifier has been loaded
-
setClassifierLoaded
public void setClassifierLoaded(boolean classifierLoaded) Sets the classifier loaded flag- Parameters:
classifierLoaded
- true=loaded, false=not loaded
-
setupProcess
public void setupProcess()Method run on startup- Overrides:
setupProcess
in classPamProcess
-
newWMDetectorData
Takes an AbstractWhistleDataUnit created in the Whistle and Moan detector, and copies the data into a RoccaContourDataBlock for further analysis and classification serialVersionUID = 9 if either firstIndx or lastIndx cannot be determined, return a null to the calling method- Parameters:
wmDataUnit
- the ConnectedRegionDataUnit containing the whistle- Returns:
- a RoccaContourDataBlock containing the whistle's time/freq pairs
-
newClickDetectorData
Takes a ClickDetection created in the Click detector, and copies the data into a RoccaContourDataBlock for further analysis and classification. Create a RoccaContourDataUnit and populate it with information from the clickDetection- Parameters:
clickDetection
- a ClickDetection object- Returns:
-
saveContourStats
public boolean saveContourStats(RoccaContourDataBlock rcdb, int channel, int thisDetection, String sNum) Saves all contour stats to the contour stats summary file, as defined in the Rocca Parameters. If the file does not exist, it is created and a header line is written. If it does exist, data is appended to the end. Each contour is 1 row. Note that the last few columns contain the random forest votes, and so the number of columns depends on how many species are in the classifier. This won't be a problem if the same classifier is always used, but if a different classifier with a different number of species is tried out the number of columns from one row to the next will not match. More importantly, the order of the species from one row to the next might not match and you would never know unless you remember. For this reason, instead of saving the species names as the column headers (which would only be accurate for the classifier selected when the file had been created), the species names are written in the row AFTER the tree votes. The classifier name is also saved, for reference. While this is awkward, at least results from different classifiers can be interpreted properly without having to guess which vote is for which species- Returns:
- boolean indicating whether or not the save was successful
-
saveContourStats
public boolean saveContourStats(RoccaContourDataBlock rcdb, int channel, int thisDetection, String sNum, String source) Saves all contour stats to the contour stats summary file, as defined in the Rocca Parameters. If the file does not exist, it is created and a header line is written. If it does exist, data is appended to the end. Each contour is 1 row. Note that the last few columns contain the random forest votes, and so the number of columns depends on how many species are in the classifier. This won't be a problem if the same classifier is always used, but if a different classifier with a different number of species is tried out the number of columns from one row to the next will not match. More importantly, the order of the species from one row to the next might not match and you would never know unless you remember. For this reason, instead of saving the species names as the column headers (which would only be accurate for the classifier selected when the file had been created), the species names are written in the row AFTER the tree votes. The classifier name is also saved, for reference. While this is awkward, at least results from different classifiers can be interpreted properly without having to guess which vote is for which species- Returns:
- boolean indicating whether or not the save was successful
-
saveContourPoints
public boolean saveContourPoints(RoccaContourDataBlock rcdb, int channel, int thisDetection, String sNum) Saves the contour points in the datablock in a csv file. Saves the time and peak frequency of each point, along with the duty cycle, energy, and windows RMS- Parameters:
rcdb
- the datablock containing the selected whistle contour- Returns:
- saveContourPoints boolean indicating success or failure
-
getDataBlockFilename
public File getDataBlockFilename(RoccaContourDataBlock rcdb, String ext, int channel, int thisDetection, String sNum) Generates a filename for the wav clip and the csv file containing the contour points, based on the filename template stored in RoccaParameters- Parameters:
rcdb
- The RoccaContourDataBlock containing the data to saveext
- The filename extension (wav or csv)- Returns:
- A File
-
getWhistleSourceData
- Returns:
- the whistleSourceData
-
setWhistleSourceData
- Parameters:
whistleSourceData
- the whistleSourceData to set
-
getClickSourceData
- Returns:
- the clickSourceData
-
setClickSourceData
- Parameters:
clickSourceData
- the clickSourceData to set
-
getClickNoiseSourceData
- Returns:
- the clickNoiseSourceData
-
setClickNoiseSourceData
- Parameters:
clickNoiseSourceData
- the clickNoiseSourceData to set
-
getLatestClickNoise
- Returns:
- the latestClickNoise
-
setLatestClickNoise
- Parameters:
latestClickNoise
- the latestClickNoise to set
-
getGpsSourceData
-