Package difar

Class DifarDataUnit

All Implemented Interfaces:
Comparable<PamDataUnit>, PamDetection, AcousticDataUnit, RawDataHolder

public class DifarDataUnit extends ClipDataUnit
  • Constructor Details Link icon

    • DifarDataUnit Link icon

      public DifarDataUnit(long clipStartMillis, long triggerMilliseconds, long startSample, int durationSamples, int channelMap, String fileName, String triggerName, double[][] rawData, long signalStartMillis, PamDataUnit parentDetection, double[] frequencyRange, float sourceSampleRate, float displaySampleRate, double[] calFreqs, double[] calGains)
      Constructor to use if storing data into the binary system.
      Parameters:
      triggerMilliseconds -
      startSample -
      durationSamples -
      channelMap -
      fileName -
      triggerName -
      rawData -
      timeMilliseconds -
      upperFreq -
  • Method Details Link icon

    • decimateData Link icon

      public static double[] decimateData(double[] ds, float origSmp, float displaySampRate)
    • setFrequencyResponse Link icon

      public void setFrequencyResponse(double[] f, double[] gain)
    • getParentDetection Link icon

      public PamDataUnit getParentDetection()
    • setParentDetection Link icon

      public void setParentDetection(PamDataUnit parentDetection)
    • getMultiplexedData Link icon

      public double[] getMultiplexedData()
    • getSignalStart Link icon

      public long getSignalStart()
      Signal start time in milliseconds relative to start of sound.
      Returns:
      signal start time in milliseconds
    • getSurfaceData Link icon

      public double[][] getSurfaceData()
    • setSurfaceData Link icon

      public void setSurfaceData(double[][] surfaceData)
    • isVessel Link icon

      public boolean isVessel()
      Returns:
      the isVessel
    • setVessel Link icon

      public void setVessel(boolean isVessel)
      Parameters:
      isVessel - the isVessel to set
    • getLutSpeciesItem Link icon

      public LookupItem getLutSpeciesItem()
      Returns:
      the lutSpeciesItem
    • setLutSpeciesItem Link icon

      public void setLutSpeciesItem(LookupItem lutSpeciesItem)
      Parameters:
      lutSpeciesItem - the lutSpeciesItem to set
    • getDisplaySampleRate Link icon

      public float getDisplaySampleRate()
      Overrides:
      getDisplaySampleRate in class ClipDataUnit
      Returns:
      the displaySampleRate
    • setDisplaySampleRate Link icon

      public void setDisplaySampleRate(float displaySampleRate)
      Parameters:
      displaySampleRate - the displaySampleRate to set
    • getSelectedAngle Link icon

      public Double getSelectedAngle()
      Get the angle selectedfrom the DIFARGram. Note that this is the angle relative to the DIFAR buoy and is therefore a MAGNETIC angle. If you want an angle corrected for magnetic deviation, use getTrueAngle();
      Returns:
      the selectedAngle
    • getRange Link icon

      public Double getRange()
    • getTrueAngle Link icon

      public Double getTrueAngle()
      Get the true bearing relative to the DIFAR buoy. This is the selected angle (see getSelectedAngle() + the local magnetic deviation calulcated from the World Magnetic Model. For map display, this bearing may be further corrected for any offset in the buoy heading in the array manager. If there is no offset in the arraymanager, then return the magnetic bearing since returning null for the trueBearing may cause problems down the line.
      Returns:
      true angle (if the buoy is orientated right !)
    • getTrackedGroup Link icon

      public String getTrackedGroup()
    • setTrackedGroup Link icon

      public void setTrackedGroup(String newGroup)
    • setSelectedAngle Link icon

      public void setSelectedAngle(Double selectedAngle)
      Set the selected angle from the DIFARGram. Note that this is the angle relative to the DIFAR buoy and is therefore a MAGNETIC angle.
      Parameters:
      selectedAngle - the selectedAngle to set
    • calculateDifarGain Link icon

      public Double calculateDifarGain()
      Now also work out the DIFAR gain for that angle. This means taking the closest point in the summary line and seeing what it's value is for that angle
      Returns:
      gain.
    • calculateDifarGain Link icon

      public Double calculateDifarGain(Double selectedAngle, Double selectedFrequency)
      Calculate teh DIFAR gain for a given angle and frequency
      Parameters:
      selectedAngle - angle 0 - 360
      selectedFrequency - Frequency Hz
      Returns:
      gain
    • getSelectedFrequency Link icon

      public Double getSelectedFrequency()
      Returns:
      the selectedFrequency
    • setSelectedFrequency Link icon

      public void setSelectedFrequency(Double selectedFrequency)
      Parameters:
      selectedFrequency - the selectedFrequency to set
    • getSurfaceSummary Link icon

      public double[] getSurfaceSummary()
      Returns:
      the surfaceSummary
    • setSurfaceSummary Link icon

      public void setSurfaceSummary(double[] surfaceSummary)
      Parameters:
      surfaceSummary - the surfaceSummary to set
    • getMaximumAngleSummary Link icon

      public double[] getMaximumAngleSummary()
      Returns:
      the maximumAngleSummary
    • setMaximumAngleSummary Link icon

      public void setMaximumAngleSummary(double[] surfaceSummary)
      Parameters:
      surfaceSummary - the surfaceSummary to set
    • getMaximumAngle Link icon

      public Double getMaximumAngle()
      Returns:
      the maximumAngle
    • setMaximumAngle Link icon

      public void setMaximumAngle(Double maximumAngle)
      Parameters:
      maximumAngle - the maximumAngle to set
    • getMaximumFrequency Link icon

      public Double getMaximumFrequency()
      Returns:
      the maximumFrequency
    • setMaximumFrequency Link icon

      public void setMaximumFrequency(Double maximumFrequency)
      Parameters:
      maximumFrequency - the maximumFrequency to set
    • setSpectrogramSensor Link icon

      public void setSpectrogramSensor(int spectrogramSensor)
      Choice of data for spectrogram displays.
      0 = decimated original data.
      1 = Omni demuxed
      2 = EW demuxed
      3 = NS demuxed
      Parameters:
      spectrogramSensor - the spectrogramSensor to set
    • getDemuxedDecimatedData Link icon

      public double[][] getDemuxedDecimatedData()
      Returns:
      the demuxedDecimatedData
    • setDemuxedDecimatedData Link icon

      public void setDemuxedDecimatedData(double[][] demuxedDecimatedData)
      Parameters:
      demuxedDecimatedData - the demuxedDecimatedData to set
    • getClipImage Link icon

      public BufferedImage getClipImage(int spectrogramImageChoice, int iChannel, int fftLen, int fftHop, double scaleMin, double scaleMax, Color[] colours)
      Get a clip image for a particular wave type - decimated original, Om, EW, NS
      Parameters:
      spectrogramImageChoice -
      iChannel -
      fftLen -
      fftHop -
      scaleMin -
      scaleMax -
      colours -
      Returns:
    • getSpeciesName Link icon

      public String getSpeciesName()
      Returns:
      null, Vessel or the long name from the lookup
    • getSpeciesCode Link icon

      public String getSpeciesCode()
      Get a species code - mostly used by the database.
      Returns:
      a species code (the shorter bit from the lookup table) TODO: Store species parameters with each data unit
    • setSpeciesCode Link icon

      public void setSpeciesCode(LookupList speciesList, String speciesCode)
      Called in viewer when data are read back from binary store to sort out the species luukup item.
      Parameters:
      speciesList - list of programmed species codes
      speciesCode - data units code or "Vessel"
    • decimateLockArray Link icon

      public static boolean[] decimateLockArray(boolean[] lockInput, float origSmp, float displaySampRate)
      Parameters:
      lock_15 -
      sampleRate -
      displaySampleRate2 -
    • getDifarGain Link icon

      public Double getDifarGain()
      Returns:
      the difarGain
    • setDifarGain Link icon

      public void setDifarGain(double difarGain)
      Parameters:
      difarGain - the difarGain to set
    • setLockDecimatedData Link icon

      public void setLockDecimatedData(boolean[][] lockArrays)
      Set the lock array iformation in the data unit. This is a 2xn boolean array of the 7.5 and 15kHz locks, decimated to the same freqeuncy as the demuxed audio data.
      Parameters:
      lockArrays - TODO: Move all lock related code into the Greeneridge demux
    • getLockDecimatedData Link icon

      public boolean[][] getLockDecimatedData()
    • cleanUpData Link icon

      public void cleanUpData()
      Gets called just before unit is added to processed data. Some things are no longer needed at this point, so can clean them up.
    • getDurationInSeconds Link icon

      public double getDurationInSeconds()
      Used by some displays
      Returns:
    • getSummaryString Link icon

      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 ClipDataUnit
      Returns:
      summary string
    • getPreMarkSeconds Link icon

      public double getPreMarkSeconds()
      Returns:
      the Number of seconds added to the sound prior to the specrogram mark or detection.
    • setPreMarkSeconds Link icon

      public void setPreMarkSeconds(double preMarkSeconds)
      Parameters:
      the - Number of seconds added to the sound prior to the specrogram mark or detection
    • getClipStartMillis Link icon

      public long getClipStartMillis()
      Returns:
      the clipStartMillis. This is the start of the clip - which will generally have been put afew secs before the actual sound.
    • canAutoProcess Link icon

      public boolean canAutoProcess()
      Autoprocess everything except "Default" clips
      Returns:
    • cancelAutoSave Link icon

      public void cancelAutoSave()
      //this is a bit pointless now as action performed doesn't attempt save if timer is stopped
      Parameters:
      sets - canAutoSave false
    • canAutoSave Link icon

      public boolean canAutoSave()
      //this is a bit pointless now as action performed doesn't attempt save if timer is stopped whether the difar unit has been interacted with causing autosave to be inapropriate
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • saveCrossing Link icon

      public void saveCrossing(boolean save)
      Move the crossing info from it's temp position to a saved position. Called just at the point when the difar unit is saved and moved from the queue to the output data block.
      Parameters:
      save - - save it, or discard it (also from other units associated with this crossing
    • getDifarCrossing Link icon

      public DIFARCrossingInfo getDifarCrossing()
      Returns:
      the crossing point when multiple matching DIFAR bearings are crossed.
    • setDifarCrossing Link icon

      public void setDifarCrossing(DIFARCrossingInfo difarCrossing)
      Parameters:
      difarCrossing - the difarCrossing to set
    • getTempCrossing Link icon

      public DIFARCrossingInfo getTempCrossing()
      Returns:
      the tempCrossing
    • setTempCrossing Link icon

      public void setTempCrossing(DIFARCrossingInfo tempCrossing)
      Parameters:
      tempCrossing - the tempCrossing to set
    • getTempGroup Link icon

      public String getTempGroup()
      Returns:
      the tempCrossing
    • setTempGroup Link icon

      public void setTempGroup(String tempGroup)
      Parameters:
      tempCrossing - the tempCrossing to set
    • getOriginLatLong Link icon

      public GpsData getOriginLatLong(boolean recalculate)
      Description copied from class: PamDataUnit
      Get the latlong of the mean hydrophone position at the time of this detection. If the data unit has a channel bitmap of zero, then get the GPS position of the vessel at that time.
      Overrides:
      getOriginLatLong in class PamDataUnit<PamDataUnit,SuperDetection>
      Returns:
      Lat long of detection origin (usually the position of the reference hydrophone at time of detection)
    • saveGroup Link icon

      public void saveGroup()
    • getCalibratedSpectrogramData Link icon

      public double[][] getCalibratedSpectrogramData(int channel, int fftLength, int fftHop)
      Return a spectrogram clip that has calibrated intensity Intensity is "calibrated" using an arbitrary filter to correct for the DIFAR frequency response.
      Parameters:
      fftLength -
      fftHop -
      i -
      Returns:
    • updateDataUnit Link icon

      public void updateDataUnit(long updateTime)
      Overrides:
      updateDataUnit in class PamDataUnit<PamDataUnit,SuperDetection>