BDFReader¶
-
class
BDFReader[source]¶ Bases:
objectA class to read the contents of a BDF file in a sequential way, as a stream of bytes. Methods are provided to return the different parts (actual times, actual durations, cross data, auto data, zero lags, and flags) recorded at each inegration. Methods are also provided to return the meta information relevant to the entire file as well as to the individual integrations.
This code is based on the c++ class of the same name as well as the python code in pyBDFExplorer.py (which is also based on the c++ class).
Methods Summary
byteOrder()Return the byte order found in the primary BDF header.
close()Equivalent to reset, closes any opened file and sets the internal values to their initial state.
correlationMode()Return the correlation mode found in the primary BDF header.
correlatorType()Return the correlator type found in the primary BDF header.
currentIntegrationIndex()Return the index of the current block of data (subscan, integration, or subintegration).
currentIntegrationStartsAt()Return the position in bytes in the file of the current block of data (subscan, integration, or subintegration).
dataOID()Return the dataOID value found in the primary BDF header.
execBlockNum()Return the number of the ExecBlock found in the projectPath in the primary BDF header.
execBlockUID()Return the UID of the ExecBlock found in the primary BDF header.
getHeader()Return the BDFHeader instance.
getPath()Return the path of the currently opened file.
getSubset()Returns an SDM Data Subset (one integration) as a dictionary.
hasPackedData()True if the binary data are all packed in one subset covering multipled times.
hasSubset()Returns True if and only if there are still data to read in the BDF file.
isCorrelation()True if the processorType is CORRELATOR
isTP()True if this is total power data.
isWVR()True if this is WVR data.
numAntenna()Return the number of antenna found in the projectPath in the primary BDF header.
numTime()Return the numTime value found in the primary BDF header.
open(bdfPath)Open a file expected to contain BDF data, read and parse the global header.
position()Returns the current position in bytes of the BDF file.
printSubset(subset)processorType()Return the processor type found in the primary BDF header.
reset()Reinitializes this instance to it’s initial state.
scanNum()Return the number of the scan found in the projectPath in the primary BDF header.
spectralResolutionType()Return the spectral resolution type found in the primary BDF header.
startTime()Return the start time found in the primary BDF header.
subscanNum()Return the number of the subscan found in the projectPath in the primary BDF header.
title()Return the title found in the primary BDF header
Methods Documentation
-
byteOrder()[source]¶ Return the byte order found in the primary BDF header.
- Returns
- Return type
A ByteOrder instance set using the byteOrder found in the primary BDF header.
-
close()[source]¶ Equivalent to reset, closes any opened file and sets the internal values to their initial state.
-
correlationMode()[source]¶ Return the correlation mode found in the primary BDF header.
Returns a CorrelationMode enumeration instance.
-
correlatorType()[source]¶ Return the correlator type found in the primary BDF header.
Returns a CorrelatorType enumeration instance
-
currentIntegrationIndex()[source]¶ Return the index of the current block of data (subscan, integration, or subintegration).
This is the integration index of the block of data most recently returned by getSubset
The indexing is 0 based.
-
currentIntegrationStartsAt()[source]¶ Return the position in bytes in the file of the current block of data (subscan, integration, or subintegration).
This is the position of the block of data most recently returned by getSubset
-
execBlockNum()[source]¶ Return the number of the ExecBlock found in the projectPath in the primary BDF header.
-
getHeader()[source]¶ Return the BDFHeader instance.
If not yet open this raises a BDFReaderException
-
getSubset()[source]¶ Returns an SDM Data Subset (one integration) as a dictionary.
This reads the next subset found at the current location in the file.
-
hasPackedData()[source]¶ True if the binary data are all packed in one subset covering multipled times.
Returns a boolean.
-
numAntenna()[source]¶ Return the number of antenna found in the projectPath in the primary BDF header.
-
numTime()[source]¶ Return the numTime value found in the primary BDF header.
This is only ever non-zero for packed data.
- Returns
- Return type
An int holding the numTime value found in the primary BDF header.
-
open(bdfPath)[source]¶ Open a file expected to contain BDF data, read and parse the global header.
On exit the first block of data (subscan, integration, or subintegration) is ready to be read by the getData method.
- Parameters
bdfPath (str or MainRow) – The path to the BDF file.
- Raises
BDFReaderException : – When a file has previously been opened. Use ‘close’ or ‘reset’ to re-use this instance.
-
processorType()[source]¶ Return the processor type found in the primary BDF header.
Returns a ProcessorType enumeration instance
-
reset()[source]¶ Reinitializes this instance to it’s initial state.
An open file is closed an all internal values are set to their initial state.
-
scanNum()[source]¶ Return the number of the scan found in the projectPath in the primary BDF header.
-
spectralResolutionType()[source]¶ Return the spectral resolution type found in the primary BDF header.
spectralResolutionType is optional in a BDF header. The return value is None if that value is not found.
Returns a SpectralResolutionType enumeration instance or None if no spectralResolutionType value is found (non-correlator data).
-
startTime()[source]¶ Return the start time found in the primary BDF header.
- Returns
- Return type
An int holding the startTime value (nanoseconds) found in the primary BDF header.
-