IOInterface() | Base class for data IO. |
MultiTBBData(filenames[, blocksize, block]) | This class provides an interface to single file Transient Buffer Board data. |
TBBData(filename[, blocksize, block]) | This class provides an interface to single file Transient Buffer Board data. |
datetime | datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) |
open(filename, *args, **kwargs) | Open file with LOFAR TBB data. |
This module implements the primary interface for reading LOFAR TBB data.
It contains one function open that is used to open an HDF5 file containing LOFAR TBB data and returns a TBBData file object.
Module author: Pim Schellart <P.Schellart@astro.ru.nl>
This module assumes that correct ICD specified values are set for the folowing attributes:
If this is not true for your files use the fix_metadata.py script to fix this.
This class provides an interface to single file Transient Buffer Board data.
Get clock offsets from opened files; subtract off the smallest one; shift alignment offsets accordingly. No parameters.
Return empty array for keyword data. Known keywords are: “TIMESERIES_DATA”, “TIME_DATA”, “FREQUENCY_DATA”, “FFT_DATA”.
Required Arguments:
Parameter | Description |
---|---|
data | data array to write FFT data to. |
block | index of block to return data from. |
hanning | apply Hannnig filter to timeseries data before the FFT. |
Output: a two dimensional array containing the FFT data of the specified block for each of the selected antennae and for the selected frequencies. So that if a is the returned array a[i] is an array of length (number of frequencies) of antenna i.
Returns timeseries data for selected antennas.
Required Arguments:
Parameter | Description |
---|---|
data | data array to write timeseries data to. |
block | index of block to return data from. Use last set block if not provided or None |
Output: a two dimensional array containing the timeseries data of the specified block for each of the selected antennae. So that if a is the returned array a[i] is an array of length blocksize of antenna i.
Sets the antenna selection used in subsequent calls to getFFTData, getTimeseriesData, getItrfAntennaPosition, etc.
Required Arguments:
Parameter | Description |
---|---|
selection | Either Python list (or hArray, Vector) with index of the antenna as known to self (integers (e.g. [1, 5, 6])) Or list of IDs to specify a LOFAR dipole (e.g. ['142000005', '3001008']) or say odd or even to select odd or even antennas. |
Output: This method does not return anything.
Raises: It raises a ValueError if antenna selection cannot be set to requested value (e.g. specified antenna not in file).
Apply integer-sample shifts to all opened files to compensate clock offsets. A positive number k shifts forward through the data, i.e. the first k samples are skipped. Required Arguments:
Parameter | Description |
---|---|
sample_offset | List containing integer sample offset for each opened file. |
This class provides an interface to single file Transient Buffer Board data.
Closes file and sets the data attribute .closed to True. A closed object can no longer be used for I/O operations. close() may be called multiple times without error.
Return empty array for keyword data. Known keywords are: “TIMESERIES_DATA”, “TIME_DATA”, “FREQUENCY_DATA”, “FFT_DATA”.
Return clock offset.
Writes FFT data for selected antennas to data array.
Required Arguments:
Parameter | Description |
---|---|
data | data array to write FFT data to. |
block | index of block to return data from. |
hanning | apply Hannnig filter to timeseries data before the FFT. |
hanning_fraction | fraction of the window to hanning filter at start and end |
datacheck | check for blocks of consecutive zeros indicating data loss |
Output: a two dimensional array containing the FFT data of the specified block for each of the selected antennae and for the selected frequencies. So that if a is the returned array a[i] is an array of length (number of frequencies) of antenna i.
Returns the frequencies that are applicable to the FFT data
Arguments: block = -1 - Is without function, just for compatibility.
Return value: This method returns a FloatVector with the selected frequencies in Hz.
Return a dict with keyword/content pairs for all header variables.
Returns antenna positions for selected antennas, or all antennas if no selection was applied.
Output: a two dimensional array containing the Cartesian position of each antenna in meters in ITRF coordinates. So that if a is the returned array a[i] is an array of length 3 with positions (x,y,z) of antenna i.
Returns antenna positions relative to the LOFAR center (e.g. antenna 0 of station CS002) for selected antennas, or all antennas if no selection was applied.
Output: a two dimensional array containing the Cartesian position of each antenna in meters in local coordinates from the station center center. So that if a is the returned array a[i] is an array of length 3 with positions (x,y,z) of antenna i.
Returns antenna positions relative to the station center for selected antennas, or all antennas if no selection was applied.
Output: a two dimensional array containing the Cartesian position of each antenna in meters in local coordinates from the station center center. So that if a is the returned array a[i] is an array of length 3 with positions (x,y,z) of antenna i.
Calculate time axis depending on sample frequency and blocksize (and later also time offset). Create a new array, if none is provided, otherwise put data into array.
Returns timeseries data for selected antennas.
Required Arguments:
Parameter | Description |
---|---|
data | data array to write timeseries data to. |
block | index of block to return data from. Use last set block if not provided or None |
Output: a two dimensional array containing the timeseries data of the specified block for each of the selected antennae. So that if a is the returned array a[i] is an array of length blocksize of antenna i.
Display some information about the file. Short and long versions (verbose=False/True)
Return list of keyword/content tuples of all header variables
Returns list of valid keywords.
Advance to next block. step = 1 - advance by ‘step’ blocks (optional)
Generic read function supporting keyword arguments.
Required Arguments:
Parameter | Description |
---|---|
key | Data type to read, one of: TIMESERIES_DATA FFT_DATA FREQUENCY_DATA TIME_DATA |
data | array to write data to. |
Sets the antenna selection used in subsequent calls to getAntennaPosition, getFFTData, getTimeseriesData.
Required Arguments:
Parameter | Description |
---|---|
selection | Either Python list (or hArray, Vector) with index of the antenna as known to self (integers (e.g. [1, 5, 6])) Or list of IDs to specify a LOFAR dipole (e.g. ['142000005', '3001008']) or say odd or even to select odd or even antennas. |
Output: This method does not return anything.
Raises: It raises a ValueError if antenna selection cannot be set to requested value (e.g. specified antenna not in file).
Shifts timeseries data for selected antennas.
Required Arguments:
Parameter | Description |
---|---|
sample_offset | Number of samples to offset timeseries data. |
Open file with LOFAR TBB data.