Package clipgenerator

Class ClipDataUnit

All Implemented Interfaces:
Comparable<PamDataUnit>, PamDetection, AcousticDataUnit, RawDataHolder
Direct Known Subclasses:
DifarDataUnit

public class ClipDataUnit extends PamDataUnit<PamDataUnit,SuperDetection> implements PamDetection, RawDataHolder
  • Field Details

    • fileName

      public String fileName
    • triggerName

      public String triggerName
    • triggerMilliseconds

      public long triggerMilliseconds
  • Constructor Details

    • ClipDataUnit

      public ClipDataUnit(long timeMilliseconds, long triggerMilliseconds, long startSample, int durationSamples, int channelMap, String fileName, String triggerName, double[][] rawData, float sourceSampleRate)
      Constructor to use if storing data into the binary system.
      Parameters:
      timeMilliseconds -
      triggerMilliseconds -
      startSample -
      durationSamples -
      channelMap -
      fileName -
      triggerName -
      rawData -
  • Method Details

    • getClipImage

      public BufferedImage getClipImage(int channel, int fftLength, int fftHop, double scaleMin, double scaleMax, Color[] colorTable)
      Get an image of the clip
      Parameters:
      channel -
      fftLength -
      fftHop -
      scaleMin -
      scaleMax -
      colorTable -
      Returns:
      clip image (Swing buffered image)
    • clearClipSpecData

      public void clearClipSpecData()
      Clear existing clip spectrogram data.
      This will force it to regenerate the data when next requested rather than recycling it
    • getSpectrogramData

      public double[][] getSpectrogramData(int channel, int fftLength, int fftHop)
      get spectrogram data for the clip.
      Parameters:
      fftLength - FFT length
      fftHop - FFT hop
      Returns:
      double array of mag squared data or null if the clip waveform cannot be found
    • generateComplexSpectrogram

      public Complex[][] generateComplexSpectrogram(int channel, int fftLength, int fftHop)
      Generate complex spectrogram data for the clip.
      Parameters:
      channel -
      fftLength - FFT length
      fftHop - FFT hop
      Returns:
      double array of mag squared data or null if the clip waveform cannot be found
    • generateSpectrogramArrays

      public ComplexArray[] generateSpectrogramArrays(int channel, int fftLength, int fftHop)
      Generate complex spectrogram data for the clip.
      Parameters:
      channel -
      fftLength - FFT length
      fftHop - FFT hop
      Returns:
      Array of ComplexArray FFT data (half fft length, due to real input)
    • getWaveData

      public double[][] getWaveData()
      Get all the wave data into an array.
      Specified by:
      getWaveData in interface RawDataHolder
      Returns:
      the wave data or null if it can't be found.
    • getTriggerMilliseconds

      public long getTriggerMilliseconds()
      Returns:
      the triggerMilliseconds
    • getRawData

      public double[][] getRawData()
      Returns:
      the rawData
    • setRawData

      public void setRawData(double[][] rawData)
      Parameters:
      rawData - the rawData to set
    • getSourceSampleRate

      public final float getSourceSampleRate()
      Returns:
      the sourceSampleRate
    • getDisplaySampleRate

      public float getDisplaySampleRate()
      Returns:
      Sample rate for the display
    • getWindowType

      public int getWindowType()
    • setWindowType

      public static void setWindowType(int windowType)
    • getLocalisation

      public AbstractLocalisation getLocalisation()
      Overrides:
      getLocalisation in class PamDataUnit<PamDataUnit,SuperDetection>
      Returns:
      Returns the localisation.
    • findTriggerDataUnit

      public PamDataUnit findTriggerDataUnit()
    • setTimeMilliseconds

      public void setTimeMilliseconds(long timeMilliseconds)
      Description copied from class: PamDataUnit
      Set the millisecond time of the data unit using the standard Java time system of milliseconds since midnight, January 1, 1970 UTC
      Overrides:
      setTimeMilliseconds in class PamDataUnit<PamDataUnit,SuperDetection>
      Parameters:
      timeMilliseconds - time in milliseconds.
    • getTriggerDataUnit

      public PamDataUnit getTriggerDataUnit()
      Reference to the data unit that triggered the clip
      This is going to be correct in normal mode, but the unit will have to be searched for in other modes, so is not 100% guaranteed.
      Returns:
      the triggerDataUnit
    • setTriggerDataUnit

      public void setTriggerDataUnit(PamDataUnit triggerDataUnit)
      Reference to the data unit that triggered the clip
      Parameters:
      triggerDataUnit - the triggerDataUnit to set
    • getTriggerUID

      public long getTriggerUID()
      UID of trigger data unit
      Returns:
      the triggerUID
    • setTriggerUID

      public void setTriggerUID(long triggerUID)
      UID of trigger data unit
      Parameters:
      triggerUID - the triggerUID to set
    • getDataTransforms

      public RawDataTransforms getDataTransforms()
      Description copied from interface: RawDataHolder
      Get the raw data transforms class. This handles standard data transforms that are often used in raw data units, e.g. calculating the spectrum, filtering waveforms, getting data as an int16 (short) array, etc.
      Specified by:
      getDataTransforms in interface RawDataHolder
      Returns:
      the data transforms object.
    • getSummaryString

      public String getSummaryString()
      Description copied from class: PamDataUnit
      Return an html formatted summary string describing the detection which can be used in tooltips anywhere in PAMGuard.
      Overrides:
      getSummaryString in class PamDataUnit<PamDataUnit,SuperDetection>
      Returns:
      summary string