Package rocca

Class RoccaProcess

All Implemented Interfaces:
PamObserver, ProcessAnnotator

public class RoccaProcess extends PamProcess
Main Rocca process
Author:
Michael Oswald
  • Constructor Details

    • RoccaProcess

      public RoccaProcess(RoccaControl roccaControl)
      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 class PamProcess
    • pamStop

      public void pamStop()
      Description copied from class: PamProcess
      Stops the process.
      Specified by:
      pamStop in class PamProcess
    • prepareProcess

      public void prepareProcess()
      Description copied from class: PamProcess
      Called for each process before any of them receive the PamStart command
      Overrides:
      prepareProcess in class PamProcess
    • newData

      public void newData(PamObservable o, PamDataUnit arg)
      this method called when new data arrives
      Overrides:
      newData in class PamProcess
    • updateSidePanel

      public void updateSidePanel(RoccaContourDataBlock rcdb, boolean isClick)
    • 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 class PamProcess
    • newWMDetectorData

      public RoccaContourDataBlock newWMDetectorData(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 method
      Parameters:
      wmDataUnit - the ConnectedRegionDataUnit containing the whistle
      Returns:
      a RoccaContourDataBlock containing the whistle's time/freq pairs
    • newClickDetectorData

      public RoccaContourDataBlock newClickDetectorData(ClickDetection clickDetection)
      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 save
      ext - The filename extension (wav or csv)
      Returns:
      A File
    • getWhistleSourceData

      public AbstractWhistleDataBlock getWhistleSourceData()
      Returns:
      the whistleSourceData
    • setWhistleSourceData

      public void setWhistleSourceData(AbstractWhistleDataBlock whistleSourceData)
      Parameters:
      whistleSourceData - the whistleSourceData to set
    • getClickSourceData

      public TrackedClickDataBlock getClickSourceData()
      Returns:
      the clickSourceData
    • setClickSourceData

      public void setClickSourceData(TrackedClickDataBlock clickSourceData)
      Parameters:
      clickSourceData - the clickSourceData to set
    • getClickNoiseSourceData

      public NoiseDataBlock getClickNoiseSourceData()
      Returns:
      the clickNoiseSourceData
    • setClickNoiseSourceData

      public void setClickNoiseSourceData(NoiseDataBlock clickNoiseSourceData)
      Parameters:
      clickNoiseSourceData - the clickNoiseSourceData to set
    • getLatestClickNoise

      public ClickDetection getLatestClickNoise()
      Returns:
      the latestClickNoise
    • setLatestClickNoise

      public void setLatestClickNoise(ClickDetection latestClickNoise)
      Parameters:
      latestClickNoise - the latestClickNoise to set
    • getGpsSourceData

      public GPSDataBlock getGpsSourceData()