Package cpod

Class FPODReader

java.lang.Object
cpod.FPODReader

public class FPODReader extends Object
Functions for importing FPOD files.

Note this class should be independent of any PAMGuard functionality.

Although some anming has changed a lot of the variable names are consistent with Pascal code used in FPOD.exe software from whihc this is absed.

Author:
Jamie Macaulay
  • Field Details

    • FPOD_HEADER

      public static final int FPOD_HEADER
      Length of the FPOD header in bytes.
      See Also:
    • FP1_FPOD_DATA_LEN

      public static final int FP1_FPOD_DATA_LEN
      The length of a standard FPOD entry
      See Also:
    • FP3_FPOD_DATA_LEN

      public static final int FP3_FPOD_DATA_LEN
      The click length for FP3 files.
      See Also:
    • WAV_SCALE_FACTOR

      public static final double WAV_SCALE_FACTOR
      Scale factor to convert waveform measurements to PAMGuard -1 to 1 measurements.
      See Also:
    • FPOD_WAV_SAMPLERATE

      public static final float FPOD_WAV_SAMPLERATE
      See Also:
  • Constructor Details

    • FPODReader

      public FPODReader()
  • Method Details

    • readHeader

      public static FPODReader.FPODHeader readHeader(File cpFile)
    • importFPODFile

      public static ArrayList<CPODClick> importFPODFile(File cpFile, int from, int maxNum) throws IOException
      Import FPOD data and return a structure of CPOD clicks.
      Parameters:
      cpFile - - the FP1 file.
      from - - the click index to save from. e.g. 100 means that only click 100 + in the file is saved
      maxNum - - the maximum number of data units to import.
      Returns:
      an array of CPOD clicks.
      Throws:
      IOException
    • importFile

      public static int importFile(File cpFile, ArrayList<FPODReader.FPODdata> fpodData, int from, int maxNum) throws IOException
      Import an FPOD file.
      Parameters:
      cpFile - - the FP1 file.
      from - - the click index to save from. e.g. 100 means that only click 100 + in the file is saved
      maxNum - - the maximum number of data units to import.
      Returns:
      the total number of clicks in the file.
      Throws:
      IOException
    • RawToRealPk

      public static int RawToRealPk(int Pk, int IPI, boolean UseExtendedAmps)
      Convert a raw binary peak to true linear peak.
      Parameters:
      Pk - - the raw maximum peak
      IPI - - the inter pulse interval
      UseExtendedAmps - - true to use extended amps
      Returns:
      the real linear peak of he wave
    • IPItoKhz

      public static int IPItoKhz(int IPI)
      Convert IPI to KHz.
      Parameters:
      IPI - - the IPI
      Returns:
      the kHz value
    • populateIPIArray

      public static void populateIPIArray()
      Ppulate the IPI array
    • toUnsigned

      public static short toUnsigned(byte signedByte)
      Java will only have read signed bytes. Nick clearly uses a lot of unsigned data, so convert and inflate to int16.
      Parameters:
      signedByte -
      Returns:
      unsigned version as int16.
    • BuildSineArray

      public static void BuildSineArray()
    • scaleWavData

      public static double[] scaleWavData(int[] wavData)
      Scale wave data so it is returned as a double
      Parameters:
      wavData - - the wavdata
      Returns:
      the scaled wav data between -1 and 1;
    • makeResampledWaveform

      public static int[] makeResampledWaveform(FPODReader.FPODdata click)
      Reconstructs sinusoidal waveform from the peaks which have been sampled at 4MHz
      Parameters:
      click - - FPOD click with waveform information.
    • main

      public static void main(String[] args)
      Test the program
      Parameters:
      args -