Package rocca

Class RoccaSpecPopUp

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class RoccaSpecPopUp extends JPanel
Author:
Michael Oswald
See Also:
  • Field Details

    • AXIS_SIZE

      public static final int AXIS_SIZE
      See Also:
    • CONTOUROFF

      public static final boolean CONTOUROFF
      constant indicating the contour should be turned off
      See Also:
    • CONTOURON

      public static final boolean CONTOURON
      constant indicating the contour should be turned on
      See Also:
    • RETURNINT

      public static final boolean RETURNINT
      constant indicating the getXPosition or getYPosition method should return an int
      See Also:
    • RETURNFLOAT

      public static final boolean RETURNFLOAT
      constant indicating the getXPosition or getYPosition method should return a float
      See Also:
  • Constructor Details

    • RoccaSpecPopUp

      public RoccaSpecPopUp(double[][] d, String title)
      Dummy constructor - only used to test display
      Parameters:
      d -
      title -
    • RoccaSpecPopUp

      public RoccaSpecPopUp(RoccaProcess roccaProcess, FFTDataBlock fftDataBlock, double boxBotFreq, double boxTopFreq, PamRawDataBlock rawData, SpectrogramDisplay display, int channel)
      Parameters:
      roccaProcess -
      fftDataBlock -
      boxBotFreq -
      boxTopFreq -
      rawData -
      display - the SpectrogramDisplay object that the user drew a box in, or null if it's from a TD Display
      channel -
  • Method Details

    • saveContourPoints

      public boolean saveContourPoints()
      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

      Note that this method has now (as of 2012/08/12) been duplicated in RoccaProcess in order to accommodate data from the Whistle and Moan detector. It should be deleted from RoccaSpecPopUp at some point in the future

      Returns:
      saveContourPoints boolean indicating success or failure
    • getDataBlockFilename

      public File getDataBlockFilename(RoccaContourDataBlock rcdb, String ext)
      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
    • saveContourStats

      public boolean saveContourStats()
      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

      Note that this method has now (as of 2012/08/12) been duplicated in RoccaProcess in order to accommodate data from the Whistle and Moan detector. It should be deleted from RoccaSpecPopUp at some point in the future

      Returns:
      boolean indicating whether or not the save was successful
    • run

      public void run()
      Launch this RoccaSpecPopUp in its own JFrame.
    • setInitialPosition

      public void setInitialPosition()
      Sets the initial position of the vertical scrollbar to center the user- selected area in the display window
    • showPeaks

      public boolean showPeaks()
    • getContour

      public Point[] getContour()
    • getData

      public double[][] getData()
    • getDragPoint

      public Point getDragPoint()
    • tracingNow

      public boolean tracingNow()
    • getUserPoints

      public ArrayList<Point> getUserPoints()
      Returns:
      the userPoints
    • getContourState

      public boolean getContourState()
    • getNumDetections

      public static int getNumDetections()
    • setNumDetections

      public static void setNumDetections(int numDetections)
    • incNumDetections

      public static void incNumDetections()
    • getFreqBins

      public double[] getFreqBins()
    • getTimeBins

      public long[] getTimeBins()
    • getDataPanel

      public SpectrogramPanel getDataPanel()
    • getFreqAxis

      public RoccaAxis getFreqAxis()
    • getHighPassFreq

      public double getHighPassFreq()
    • getLowPassFreq

      public double getLowPassFreq()
    • main

      public static void main(String[] args)
      Method for testing RoccaSpecPopUp

      Requires a csv file containing the FFT data to be displayed, with no header. Size of file is hard-coded in the specData variable. Note that this is commented out, along with the Csvreader import, because it was throwing an error when compiled. To use this test, uncomment the reader section and the csvreader import at the top.