Package cpod
Class FPODReader
java.lang.Object
cpod.FPODReader
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holds an FPOD detection.static class
Holds an FPOD header informationstatic class
Holds FPOD wav data. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The length of a standard FPOD entrystatic final int
The click length for FP3 files.static final int
Length of the FPOD header in bytes.static final float
static final double
Scale factor to convert waveform measurements to PAMGuard -1 to 1 measurements. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
static int
importFile
(File cpFile, ArrayList<FPODReader.FPODdata> fpodData, int from, int maxNum) Import an FPOD file.importFPODFile
(File cpFile, int from, int maxNum) Import FPOD data and return a structure of CPOD clicks.static int
IPItoKhz
(int IPI) Convert IPI to KHz.static void
Test the programstatic int[]
Reconstructs sinusoidal waveform from the peaks which have been sampled at 4MHzstatic void
Ppulate the IPI arraystatic int
RawToRealPk
(int Pk, int IPI, boolean UseExtendedAmps) Convert a raw binary peak to true linear peak.static FPODReader.FPODHeader
readHeader
(File cpFile) static double[]
scaleWavData
(int[] wavData) Scale wave data so it is returned as a doublestatic short
toUnsigned
(byte signedByte) Java will only have read signed bytes.
-
Field Details
-
FPOD_HEADER
public static final int FPOD_HEADERLength of the FPOD header in bytes.- See Also:
-
FP1_FPOD_DATA_LEN
public static final int FP1_FPOD_DATA_LENThe length of a standard FPOD entry- See Also:
-
FP3_FPOD_DATA_LEN
public static final int FP3_FPOD_DATA_LENThe click length for FP3 files.- See Also:
-
WAV_SCALE_FACTOR
public static final double WAV_SCALE_FACTORScale 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
-
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 savedmaxNum
- - 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 savedmaxNum
- - 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 peakIPI
- - the inter pulse intervalUseExtendedAmps
- - 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
Reconstructs sinusoidal waveform from the peaks which have been sampled at 4MHz- Parameters:
click
- - FPOD click with waveform information.
-
main
Test the program- Parameters:
args
-
-