Class FFTPlotManager

java.lang.Object
dataPlotsFX.data.FFTPlotManager
Direct Known Subclasses:
ClickFFTPlotManager2, RawClipFFTPlotManager

public abstract class FFTPlotManager extends Object
Handles efficiently plotting click FFT's on the frequency axis. This can be used to visualise longer clicks, for example, bat calls.

Warning: this display does not work if there are not unique UID values for clicks.

Author:
Jamie Macaulay
  • Field Details

    • ffColor

      public javafx.scene.paint.Color ffColor
      The current FFT colour.
  • Constructor Details

    • FFTPlotManager

      public FFTPlotManager(TDDataInfoFX rawClipPlotInfo)
      Constructor for the FFT plot manager.
      Parameters:
      rawClipPlotInfo - - the RawClipDataInfo
  • Method Details

    • lastUnitDrawn

      public void lastUnitDrawn(javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector, int plotnumber)
    • getFFTPlotParams

      public abstract FFTPlotSettings getFFTPlotParams()
      Get the FFT parameters for the display.
      Returns:
      the FFT parameters.
    • getFrequencyScaleInfo

      public abstract TDScaleInfo getFrequencyScaleInfo()
      Get the frequency scale info for the TDScaleInfoFX.
      Returns:
      the frequency scale info.
    • getSpectrogram

      public abstract double[][] getSpectrogram(PamDataUnit pamDataUnit, int chanClick)
      Get the spectrogram from a data unit based on the FFT settings
      Parameters:
      pamDataUnit - - the data unit.
      chanClick - - the spectrogram channel - this is the realtive channel within the data unit. Not the absolute channel.
      Returns:
      the absolute spectrogram data.
    • drawClipFFT

      public Path2D drawClipFFT(int plotNumber, PamDataUnit pamDataUnit, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector, int type)
      Draw a click FFT on a frequency time axis. FFT is a long line of the FFT above a certain cutoff.
      Parameters:
      plotNumber - - the plot on which the FFT is drawing.
      pamDataUnit - - the click data unit to draw.
      g - - the graphics handle.
      scrollStart - - the scroll start in millis datenum.
      tdProjector - - the projector which dictates the the position of the unit on the screen.
      type - - type flag for the data unit. e.g. whether selected or not.
      windowRect - - the window in which to draw in.
      orientation - - the orientation of the display.
      lastunit - - indicates that this is the last unit to be drawn in this draw.
      Returns:
      a 2D path of the data if it has been drawn. Null if no draw occurred.
    • clear

      public void clear()
      Reset the image buffer.
    • drawDataUnit

      public void drawDataUnit(javafx.scene.canvas.GraphicsContext g, PamDataUnit pamDataUnit, ScrollingImageSegmenter.WritableImageSegment writableImage, TDProjectorFX tdProjector, double scrolLStart, int chanClick)
      Draw the data unit on a writeable image segment. This function can be overriden for more options on drawing.
      Parameters:
      g - - the graphics context
      pamDataUnit - - the data unit to draw.
      writableImage - - the writiable image.
      tdProjector - - the projector.
      scrolLStart - - the start of the scroller.
      chanClick - - the channel of the data unit to plot. This is the relative, not the absolute channel
    • fftAmplitude2dB

      public static double fftAmplitude2dB(double fftAmplitude, float sampleRate, double clipLevel, int fftLength, boolean isSquared)
      Convert the amplitude of fft data into a spectrum level measurement in dB re 1 micropacal / sqrt(Hz).
      Parameters:
      fftAmplitude - magnitude of the fft data (not the magnitude squared !)
      sampleRate - sample rate - this needs to be sent, since this function is often called from decimated data, in which case the sample rate will be different.
      fftLength - length of the FFT (needed for Parsevals correction)
      the - clip level in dB re 1uPa.
      Returns:
      spectrum level amplitude.
    • update

      public void update()
      Called whenever settings are updated.