Data Write¶
The data_write package contains the utilities to parse protobuf packets containing antennas_iq data, bfiq data, rawacf data, etc and write that data to HDF5 or JSON files.
data_write package¶
This package contains utilities to parse protobuf packets containing antennas_iq data, bfiq data, rawacf data, etc. and write that data to HDF5 or JSON files.
- copyright
2017 SuperDARN Canada
- class src.data_write.DataWrite(data_write_options)[source]¶
Bases:
object
This class contains the functions used to write out processed data to files.
- Parameters
data_write_options (Options) – The options parsed from config file
- output_data(write_bfiq, write_antenna_iq, write_raw_rf, write_tx, file_ext, aveperiod_meta, data_parsing, rt_dw, write_rawacf=True)[source]¶
Parse through samples and write to file.
A file will be created using the file extension for each requested data product.
- Parameters
write_bfiq (bool) – Should beamformed IQ be written to file?
write_antenna_iq (bool) – Should pre-beamformed IQ be written to file?
write_raw_rf (bool) – Should raw rf samples be written to file?
write_tx (bool) – Should the generated tx samples and metadata be written to file?
file_ext (str) – Type of file extension to use
aveperiod_meta (AveperiodMetadataMessage) – Metadata from radar control about averaging period
data_parsing (ParseData) – All parsed and concatenated data from averaging period
rt_dw (dict) – Pair of socket and iden for RT purposes.
write_rawacf (bool, optional) – Should rawacfs be written to file? Defaults to True.
- static write_dmap_file(filename, slice_data)[source]¶
Write out data to a dmap file. If the file already exists it will be overwritten.
- static write_hdf5_file(filename, slice_data, dt_str, file_type)[source]¶
Write out data to an HDF5 file. If the file already exists it will be overwritten.
- class src.data_write.ParseData(agc_status_word: int = 0, antenna_iq_accumulator: dict = <factory>, antenna_iq_available: bool = False, bfiq_accumulator: dict = <factory>, bfiq_available: bool = False, intfacfs_available: bool = False, gps_locked: bool = True, gps_to_system_time_diff: float = 0.0, intfacfs_accumulator: dict = <factory>, lp_status_word: int = 0, mainacfs_accumulator: dict = <factory>, mainacfs_available: bool = False, options: ~utils.options.Options = None, output_sample_rate: float = 0.0, rawrf_available: bool = False, rawrf_locations: list[str] = <factory>, rawrf_num_samps: int = 0, rx_rate: float = 0.0, slice_ids: set = <factory>, timestamps: list[float] = <factory>, xcfs_accumulator: dict = <factory>, xcfs_available: bool = False)[source]¶
Bases:
object
This class is for aggregating data during an averaging period.
- numpify_arrays()[source]¶
Consolidates data for each data type to one array.
In parse_[type](), new data arrays are appended to a list for speed considerations. This function converts these lists into numpy arrays.
- parse_antenna_iq()[source]¶
Parses out any pre-beamformed IQ if available. Runs on every ProcessedSequenceMessage (contains all sampling period data).
- parse_bfiq()[source]¶
Parses out any possible beamformed IQ data from the message. Runs on every ProcessedSequenceMessage (contains all sampling period data).
- parse_correlations()[source]¶
Parses out the possible correlation (acf/xcf) data from the message. Runs on every new ProcessedSequenceMessage (contains all sampling period data). The expectation value is calculated at the end of an averaging period by a different function.
- processed_data: ProcessedSequenceMessage¶
- class src.data_write.SliceData[source]¶
Bases:
object
This class defines all fields that need to be written by any type of data file. The ‘groups’ metadata lists the applicable file types for each field.
- blanked_samples: ndarray¶
- data: ndarray¶
- data_dimensions: ndarray¶
- intf_acfs: ndarray¶
- lags: ndarray¶
- main_acfs: ndarray¶
- noise_at_freq: ndarray¶
- pulse_phase_offset: ndarray¶
- pulses: ndarray¶
- classmethod type_fields(file_type: str)[source]¶
Returns a list of names for all fields which belong in ‘file_type’ files.
- xcfs: ndarray¶