pub struct VoltageContext {
Show 44 fields pub metafits_context: MetafitsContext, pub mwa_version: MWAVersion, pub timesteps: Vec<TimeStep>, pub num_timesteps: usize, pub timestep_duration_ms: u64, pub coarse_chans: Vec<CoarseChannel>, pub num_coarse_chans: usize, pub common_timestep_indices: Vec<usize>, pub num_common_timesteps: usize, pub common_coarse_chan_indices: Vec<usize>, pub num_common_coarse_chans: usize, pub common_start_unix_time_ms: u64, pub common_end_unix_time_ms: u64, pub common_start_gps_time_ms: u64, pub common_end_gps_time_ms: u64, pub common_duration_ms: u64, pub common_bandwidth_hz: u32, pub common_good_timestep_indices: Vec<usize>, pub num_common_good_timesteps: usize, pub common_good_coarse_chan_indices: Vec<usize>, pub num_common_good_coarse_chans: usize, pub common_good_start_unix_time_ms: u64, pub common_good_end_unix_time_ms: u64, pub common_good_start_gps_time_ms: u64, pub common_good_end_gps_time_ms: u64, pub common_good_duration_ms: u64, pub common_good_bandwidth_hz: u32, pub provided_timestep_indices: Vec<usize>, pub num_provided_timesteps: usize, pub provided_coarse_chan_indices: Vec<usize>, pub num_provided_coarse_chans: usize, pub coarse_chan_width_hz: u32, pub fine_chan_width_hz: u32, pub num_fine_chans_per_coarse: usize, pub sample_size_bytes: u64, pub num_voltage_blocks_per_timestep: u64, pub num_voltage_blocks_per_second: u64, pub num_samples_per_voltage_block: u64, pub voltage_block_size_bytes: u64, pub delay_block_size_bytes: u64, pub data_file_header_size_bytes: u64, pub expected_voltage_data_file_size_bytes: u64, pub voltage_batches: Vec<VoltageFileBatch>, pub voltage_time_map: BTreeMap<u64, BTreeMap<usize, String>>,
}
Expand description

mwalib voltage captue system (VCS) observation context. This represents the basic metadata for a voltage capture observation.

Fields

metafits_context: MetafitsContext

Observation Metadata obtained from the metafits file

mwa_version: MWAVersion

MWA version, derived from the files passed in

timesteps: Vec<TimeStep>

This is an array of all known timesteps (union of metafits and provided timesteps from data files). The only exception is when the metafits timesteps are offset from the provided timesteps, in which case see description in timestep::populate_metafits_provided_superset_of_timesteps.

num_timesteps: usize

Number of timesteps in the timesteps vector

timestep_duration_ms: u64

length in millseconds of each timestep

coarse_chans: Vec<CoarseChannel>

Vector of coarse channel structs which is the same as the metafits provided coarse channels

num_coarse_chans: usize

Number of coarse channels in coarse chans struct

common_timestep_indices: Vec<usize>

Vector of (in)common timestep indices

num_common_timesteps: usize

Number of common timesteps

common_coarse_chan_indices: Vec<usize>

Vector of (in)common coarse channel indices

num_common_coarse_chans: usize

Number of common coarse channels

common_start_unix_time_ms: u64

The start of the observation (the time that is common to all provided data files).

common_end_unix_time_ms: u64

end_unix_time_ms is the common end time of the observation i.e. start time of last common timestep plus integration time.

common_start_gps_time_ms: u64

start_unix_time_ms but in GPS milliseconds

common_end_gps_time_ms: u64

end_unix_time_ms but in GPS milliseconds

common_duration_ms: u64

Total duration of common timesteps

common_bandwidth_hz: u32

Total bandwidth of the common coarse channels

common_good_timestep_indices: Vec<usize>

Vector of (in)common timestep indices only including timesteps after the quack time

num_common_good_timesteps: usize

Number of common timesteps only including timesteps after the quack time

common_good_coarse_chan_indices: Vec<usize>

Vector of (in)common coarse channel indices only including timesteps after the quack time

num_common_good_coarse_chans: usize

Number of common coarse channels only including timesteps after the quack time

common_good_start_unix_time_ms: u64

The start of the observation (the time that is common to all provided data files) only including timesteps after the quack time

common_good_end_unix_time_ms: u64

end_unix_time_ms is the common end time of the observation only including timesteps after the quack time i.e. start time of last common timestep plus integration time.

common_good_start_gps_time_ms: u64

common_good_start_unix_time_ms but in GPS milliseconds

common_good_end_gps_time_ms: u64

common_good_end_unix_time_ms but in GPS milliseconds

common_good_duration_ms: u64

Total duration of common_good timesteps

common_good_bandwidth_hz: u32

Total bandwidth of the common coarse channels only including timesteps after the quack time

provided_timestep_indices: Vec<usize>

The indices of any timesteps which we have some data for

num_provided_timesteps: usize

Number of provided timestep indices we have at least some data for

provided_coarse_chan_indices: Vec<usize>

The indices of any coarse channels which we have some data for

num_provided_coarse_chans: usize

Number of provided coarse channel indices we have at least some data for

coarse_chan_width_hz: u32

Bandwidth of each coarse channel

fine_chan_width_hz: u32

Volatge fine_chan_resolution (if applicable- MWA legacy is 10 kHz, MWAX is unchannelised i.e. the full coarse channel width)

num_fine_chans_per_coarse: usize

Number of fine channels in each coarse channel

sample_size_bytes: u64

Number of bytes in each sample (a sample is a complex, thus includes r and i)

num_voltage_blocks_per_timestep: u64

Number of voltage blocks per timestep

num_voltage_blocks_per_second: u64

Number of voltage blocks of samples in each second of data

num_samples_per_voltage_block: u64

Number of samples in each voltage_blocks for each second of data per rf_input * fine_chans * real|imag

voltage_block_size_bytes: u64

The size of each voltage block

delay_block_size_bytes: u64

Number of bytes used to store delays - for MWAX this is the same as a voltage block size, for legacy it is 0

data_file_header_size_bytes: u64

The amount of bytes to skip before getting into real data within the voltage files

expected_voltage_data_file_size_bytes: u64

Expected voltage file size

voltage_batches: Vec<VoltageFileBatch>

voltage_batches must be sorted appropriately. See voltage::determine_voltage_batches. The order of the filenames corresponds directly to other voltage-related objects (e.g. voltage_hdu_limits). Structured: voltage_batches[batch][filename].

voltage_time_map: BTreeMap<u64, BTreeMap<usize, String>>

We assume as little as possible about the data layout in the voltage files; here, a BTreeMap contains each unique GPS time from every voltage file, which is associated with another BTreeMap, associating each voltage number with a voltage batch number and HDU index. The voltage number, batch number and HDU index are everything needed to find the correct HDU out of all voltage files.

Implementations

From a path to a metafits file and paths to voltage files, create an VoltageContext.

The traits on the input parameters allow flexibility to input types.

Arguments
  • metafits - filename of metafits file as a path or string.

  • voltages - slice of filenames of voltage files as paths or strings.

Returns
  • Result containing a populated VoltageContext object if Ok.

For a given slice of voltage coarse channel indices, return a vector of the center frequencies for all the fine channels in the given coarse channels

Arguments
  • volt_coarse_chan_indices - a slice containing voltage coarse channel indices for which you want fine channels for. Does not need to be contiguous.
Returns
  • a vector of f64 containing the centre sky frequencies of all the fine channels for the given coarse channels.

Read a single timestep / coarse channel worth of data The output data are in the format: MWA Recombined VCS:

NOTE: antennas are in tile_id order for recombined VCS…

sample[0]|finechan[0]|antenna[0]|X|real sample[0]|finechan[0]|antenna[0]|Y|imag
… sample[0]|finechan[0]|antenna[127]|X|real sample[0]|finechan[0]|antenna[127]|Y|imag … sample[0]|finechan[1]|antenna[0]|X|real sample[0]|finechan[1]|antenna[0]|Y|imag … sample[0]|finechan[127]|antenna[127]|X|real sample[0]|finechan[127]|antenna[127]|Y|imag … sample[1]|finechan[0]|antenna[0]|X|real sample[1]|finechan[0]|antenna[0]|Y|imag

MWAX: antenna[0]|pol[0]|sample[0]…sample[63999] antenna[0]|pol[1]|sample[0]…sample[63999] antenna[1]|pol[0]|sample[0]…sample[63999] antenna[1]|pol[1]|sample[0]…sample[63999] …

File format information: type tiles pols fine ch bytes/samp samples/block block size blocks header delay size data size file size seconds/file size/sec

Lgeacy 128 2 128 1 10000 327680000 1 0 0 327680000 327680000 1 327680000 MWAX 128 2 1 2 64000 32768000 160 4096 32768000 5242880000 5275652096 8 659456512 NOTE: ‘sample’ refers to a complex value per tile/pol/chan/time. So legacy stores r/i as a byte (4bits r + 4bits i), mwax as 1 byte real, 1 byte imag.

Arguments
  • timestep_index - index within the timestep array for the desired timestep. This corresponds to the element within VoltageContext.timesteps. For mwa legacy each index represents 1 second increments, for mwax it is 8 second increments.

  • coarse_chan_index - index within the coarse_chan array for the desired coarse channel. This corresponds to the element within VoltageContext.coarse_chans.

  • buffer - a mutable reference to an already exitsing, initialised slice [u8] which will be filled with the data from one data file/block.

Returns
  • A Result containing vector of bytes containing the data, if Ok.

Read a single timestep / coarse channel worth of data The output data are in the format: MWA Recombined VCS:

NOTE: antennas are in tile_id order for recombined VCS…

sample[0]|finechan[0]|antenna[0]|X|real sample[0]|finechan[0]|antenna[0]|Y|imag
… sample[0]|finechan[0]|antenna[127]|X|real sample[0]|finechan[0]|antenna[127]|Y|imag … sample[0]|finechan[1]|antenna[0]|X|real sample[0]|finechan[1]|antenna[0]|Y|imag … sample[0]|finechan[127]|antenna[127]|X|real sample[0]|finechan[127]|antenna[127]|Y|imag … sample[1]|finechan[0]|antenna[0]|X|real sample[1]|finechan[0]|antenna[0]|Y|imag

MWAX: antenna[0]|pol[0]|sample[0]…sample[63999] antenna[0]|pol[1]|sample[0]…sample[63999] antenna[1]|pol[0]|sample[0]…sample[63999] antenna[1]|pol[1]|sample[0]…sample[63999] …

File format information: type tiles pols fine ch bytes/samp samples/block block size blocks header delay size data size file size seconds/file size/sec

Lgeacy 128 2 128 1 10000 327680000 1 0 0 327680000 327680000 1 327680000 MWAX 128 2 1 2 64000 32768000 160 4096 32768000 5242880000 5275652096 8 659456512 NOTE: ‘sample’ refers to a complex value per tile/pol/chan/time. So legacy stores r/i as a byte (4bits r + 4bits i), mwax as 1 byte real, 1 byte imag.

Arguments
  • timestep_index - index within the timestep array for the desired timestep. This corresponds to the element within VoltageContext.timesteps. For mwa legacy each index represents 1 second increments, for mwax it is 8 second increments.

  • coarse_chan_index - index within the coarse_chan array for the desired coarse channel. This corresponds to the element within VoltageContext.coarse_chans.

  • buffer - a mutable reference to an already exitsing, initialised slice [u8] which will be filled with the data from one VCS data file.

Returns
  • A Result containing vector of bytes containing the data, if Ok.

Trait Implementations

Formats the value using the given formatter. Read more

Implements fmt::Display for VoltageContext struct

Arguments

  • f - A fmt::Formatter

Returns

  • fmt::Result - Result of this method

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.