Package PamguardMVC
Class DataUnitBaseData
java.lang.Object
PamguardMVC.DataUnitBaseData
- All Implemented Interfaces:
Cloneable
Class for data unit basic data. this has been separated into
a separate class so that it can be passed around more easily during
file and network read write ops when a whole data unit may not be
available.
- Author:
- dg50
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Amplitude value is in dB relative to 1 micropascalstatic final int
Amplitude scale is linear relative to full scaleint[]
Used to calculate the number of bytes in the base data.static final short
static final short
static final short
static final short
static final short
static final short
static final short
static final short
static final short
Special flag to say that there is another set of up to 16 more flags indicating other data types.static final short
static final short
static final short
static final short
static final short
static final short
static final short
-
Constructor Summary
ConstructorDescriptionDataUnitBaseData
(long timeMilliseconds, int channelBitmap) DataUnitBaseData
(long timeMilliseconds, int channelBitmap, long startSample, long duration) Constructor used to hand the basic data to AcousticDataUnit.DataUnitBaseData
(long timeMilliseconds, int channelBitmap, Long timeNanoseconds) -
Method Summary
Modifier and TypeMethodDescriptionclone()
int
Get the number of bytes which are going to be written to save all this data.double
int
long
double[]
Set the frequency limitsdouble
Get the measured amplitudeint
short
float
double[]
long
long
getUID()
boolean
void
mergeBaseData
(DataUnitBaseData baseData) Extract any data from baseData that's not already in this one, and add it !boolean
readBaseData
(DataInputStream inputStream, int fileVersion) Read basic data for data units from an input stream.void
setCalculatedAmlitudeDB
(double calculatedAmlitudeDB) void
setChannelBitmap
(int channelBitmap) void
setEndTime
(long endTime) Set the end time in milliseconds.void
setFrequency
(double[] frequency) Get the current frequency limits for the data unitvoid
setHasBinaryAnnotations
(boolean has) Quick method to set flag saying binary store has annotation data which will immediately follow the main data unit data.void
setMeasuredAmplitude
(double measuredAmplitude) set the measured amplitudevoid
setMeasuredAmplitudeType
(int measuredAmplitudeType) void
setMillisecondDuration
(Double millisecondDuration) void
setNoiseBackground
(Float noiseBackground) void
setSampleDuration
(Long sampleDuration) void
setSequenceBitmap
(Integer sequenceBitmap) void
setSignalExcess
(float signalExcess) void
setSignalSPL
(Float signalSPL) void
setStartSample
(Long startSample) void
setTimeDelaysSeconds
(double[] timeDelaysSeconds) void
setTimeMilliseconds
(long timeMilliseconds) void
setTimeNanoseconds
(Long timeNanoseconds) void
setUID
(long uid) boolean
writeBaseData
(DataOutputStream outputStream, int fileVersion) Write base Data Unit data to an output stream
-
Field Details
-
S1_TIMEMILLISECONDS
public static final short S1_TIMEMILLISECONDS- See Also:
-
S1_TIMENANOSECONDS
public static final short S1_TIMENANOSECONDS- See Also:
-
S1_CHANNELMAP
public static final short S1_CHANNELMAP- See Also:
-
S1_UID
public static final short S1_UID- See Also:
-
S1_STARTSAMPLE
public static final short S1_STARTSAMPLE- See Also:
-
S1_SAMPLEDURATION
public static final short S1_SAMPLEDURATION- See Also:
-
S1_FREQUENCYLIMITS
public static final short S1_FREQUENCYLIMITS- See Also:
-
S1_MILLISDURATION
public static final short S1_MILLISDURATION- See Also:
-
S1_TIMEDELAYSSECONDS
public static final short S1_TIMEDELAYSSECONDS- See Also:
-
S1_HASBINARYANNOTATIONS
public static final short S1_HASBINARYANNOTATIONS- See Also:
-
S1_HASSEQUENCEMAP
public static final short S1_HASSEQUENCEMAP- See Also:
-
S1_HASNOISE
public static final short S1_HASNOISE- See Also:
-
S1_HASSIGNAL
public static final short S1_HASSIGNAL- See Also:
-
S1_HASSIGNALEXCESS
public static final short S1_HASSIGNALEXCESS- See Also:
-
S1_SEARCHS2
public static final short S1_SEARCHS2- See Also:
-
AMPLITUDE_SCALE_DBREMPA
public static final int AMPLITUDE_SCALE_DBREMPAAmplitude value is in dB relative to 1 micropascal- See Also:
-
AMPLITUDE_SCALE_LINREFSD
public static final int AMPLITUDE_SCALE_LINREFSDAmplitude scale is linear relative to full scale- See Also:
-
binarySpace
public int[] binarySpaceUsed to calculate the number of bytes in the base data. The order of the numbers in the array must match the order of the data identifiers given above. The value in array is related to how the data is actually written to the binary file, and not what type the data itself is. Data types and corresponding byte sizes are:- short = 2
- int = 4
- float = 4
- long = 8
Similarly, the 7th value in the array corresponds to S1_FREQUENCYLIMITS, which is a 2-cell double array. That would mean it should take 16 bytes to store (2*8=16) BUT it's actually being stored as a float, so the value in binarySpace is actually 8 (2*4=8).
Note also that 9th value corresponds to S1_TIMEDELAYSSECONDS. This is a double array of variable length. Therefore, the value in the array below is 0 and it is handled as a special case in the getBaseDataBinaryLength method.
-
S1_S2
public static final short S1_S2Special flag to say that there is another set of up to 16 more flags indicating other data types.- See Also:
-
-
Constructor Details
-
DataUnitBaseData
public DataUnitBaseData() -
DataUnitBaseData
- Parameters:
timeMilliseconds
-channelBitmap
-timeNanoseconds
-
-
DataUnitBaseData
public DataUnitBaseData(long timeMilliseconds, int channelBitmap, long startSample, long duration) Constructor used to hand the basic data to AcousticDataUnit.- Parameters:
timeMilliseconds
-channelBitmap
-startSample
-duration
-
-
DataUnitBaseData
public DataUnitBaseData(long timeMilliseconds, int channelBitmap) - Parameters:
timeMilliseconds
-channelBitmap
-timeNanoseconds
-
-
-
Method Details
-
getTimeMilliseconds
public long getTimeMilliseconds()- Returns:
- the timeMilliseconds
-
setTimeMilliseconds
public void setTimeMilliseconds(long timeMilliseconds) - Parameters:
timeMilliseconds
- the timeMilliseconds to set
-
getTimeNanoseconds
- Returns:
- the timeNanoseconds
-
setTimeNanoseconds
- Parameters:
timeNanoseconds
- the timeNanoseconds to set
-
getChannelBitmap
public int getChannelBitmap()- Returns:
- the channelBitmap
-
setChannelBitmap
public void setChannelBitmap(int channelBitmap) - Parameters:
channelBitmap
- the channelBitmap to set
-
getUID
public long getUID()- Returns:
- the uid
-
setUID
public void setUID(long uid) - Parameters:
uid
- the uid to set
-
getStartSample
- Returns:
- the startSample
-
setStartSample
- Parameters:
startSample
- the startSample to set
-
getSampleDuration
- Returns:
- the sampleDuration
-
setSampleDuration
- Parameters:
sampleDuration
- the sampleDuration to set
-
getMillisecondDuration
- Returns:
- the millisecondDuration
-
setMillisecondDuration
- Parameters:
millisecondDuration
- the millisecondDuration to set
-
getS1Contents
public short getS1Contents()- Returns:
- the s1Contents
-
getBaseDataBinaryLength
public int getBaseDataBinaryLength()Get the number of bytes which are going to be written to save all this data. Note that currently the S1_TIMEDELAYSSECONDS flag corresponds to the timeDelaysSeconds array, which is variable length. Therefore it is handled as a special case in the code below.- Returns:
- number of bytes to be written.
-
readBaseData
Read basic data for data units from an input stream.- Parameters:
inputStream
- Input stream (generally a file, network socket or byte array)fileVersion
- Format version number.- Returns:
- true
- Throws:
IOException
-
writeBaseData
Write base Data Unit data to an output stream- Parameters:
outputStream
- output stream (generally a file, network socket or byte array)fileVersion
- file version- Returns:
- true
- Throws:
IOException
-
getFrequency
public double[] getFrequency()Set the frequency limits- Returns:
-
setFrequency
public void setFrequency(double[] frequency) Get the current frequency limits for the data unit- Parameters:
frequency
-
-
getMeasuredAmplitude
public double getMeasuredAmplitude()Get the measured amplitude- Returns:
-
setMeasuredAmplitude
public void setMeasuredAmplitude(double measuredAmplitude) set the measured amplitude- Parameters:
measuredAmplitude
-
-
getMeasuredAmplitudeType
public int getMeasuredAmplitudeType() -
setMeasuredAmplitudeType
public void setMeasuredAmplitudeType(int measuredAmplitudeType) -
getCalculatedAmlitudeDB
public double getCalculatedAmlitudeDB() -
setCalculatedAmlitudeDB
public void setCalculatedAmlitudeDB(double calculatedAmlitudeDB) -
getTimeDelaysSeconds
public double[] getTimeDelaysSeconds() -
setTimeDelaysSeconds
public void setTimeDelaysSeconds(double[] timeDelaysSeconds) -
mergeBaseData
Extract any data from baseData that's not already in this one, and add it !- Parameters:
dataUnitBaseData
-
-
getSequenceBitmap
- Returns:
- the sequenceBitmap
-
setSequenceBitmap
- Parameters:
sequenceBitmap
- the sequenceBitmap to set
-
getSignalExcess
public float getSignalExcess()- Returns:
- the signalExcess
-
setSignalExcess
public void setSignalExcess(float signalExcess) - Parameters:
signalExcess
- the signalExcess to set
-
setHasBinaryAnnotations
public void setHasBinaryAnnotations(boolean has) Quick method to set flag saying binary store has annotation data which will immediately follow the main data unit data.- Parameters:
has
- flag to say has annotation data.
-
isHasBinaryAnnotation
public boolean isHasBinaryAnnotation()- Returns:
- true if the header indicates that binary annotations are present.
-
clone
-
setEndTime
public void setEndTime(long endTime) Set the end time in milliseconds.- Parameters:
endTime
-
-
getEndTime
public long getEndTime()- Returns:
- The data units end time in milliseconds. If a duration has not been set this will be the same as the start time
-
getNoiseBackground
- Returns:
- the noiseBackground
-
setNoiseBackground
- Parameters:
noiseBackground
- the noiseBackground to set
-
getSignalSPL
- Returns:
- the signalSPL
-
setSignalSPL
- Parameters:
signalSPL
- the signalSPL to set
-