pub struct CorrelatorContext {
Show 35 fields pub metafits_context: MetafitsContext, pub mwa_version: MWAVersion, pub timesteps: Vec<TimeStep, Global>, pub num_timesteps: usize, pub coarse_chans: Vec<CoarseChannel, Global>, pub num_coarse_chans: usize, pub common_timestep_indices: Vec<usize, Global>, pub num_common_timesteps: usize, pub common_coarse_chan_indices: Vec<usize, Global>, 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, Global>, pub num_common_good_timesteps: usize, pub common_good_coarse_chan_indices: Vec<usize, Global>, 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, Global>, pub num_provided_timesteps: usize, pub provided_coarse_chan_indices: Vec<usize, Global>, pub num_provided_coarse_chans: usize, pub num_timestep_coarse_chan_bytes: usize, pub num_timestep_coarse_chan_floats: usize, pub num_gpubox_files: usize, pub gpubox_batches: Vec<GpuBoxBatch, Global>, pub gpubox_time_map: BTreeMap<u64, BTreeMap<usize, (usize, usize), Global>, Global>, /* private fields */
}
Expand description

mwalib correlator observation context. This represents the basic metadata for a correlator 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, Global>

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

§coarse_chans: Vec<CoarseChannel, Global>

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

§num_coarse_chans: usize

Number of coarse channels in the coarse channel vector

§common_timestep_indices: Vec<usize, Global>

Vector of (in)common timestep indices

§num_common_timesteps: usize

Number of common timesteps

§common_coarse_chan_indices: Vec<usize, Global>

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 gpubox 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, Global>

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, Global>

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 gpubox 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, Global>

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, Global>

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

§num_timestep_coarse_chan_bytes: usize

The number of bytes taken up by a scan/timestep in each gpubox file.

§num_timestep_coarse_chan_floats: usize

The number of floats in each gpubox HDU.

§num_gpubox_files: usize

This is the number of gpubox files per batch.

§gpubox_batches: Vec<GpuBoxBatch, Global>

gpubox_batches must be sorted appropriately. See gpubox::determine_gpubox_batches. The order of the filenames corresponds directly to other gpubox-related objects (e.g. gpubox_hdu_limits). Structured: gpubox_batches[batch][filename].

§gpubox_time_map: BTreeMap<u64, BTreeMap<usize, (usize, usize), Global>, Global>

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

Implementations§

§

impl CorrelatorContext

pub fn new<P, P2>( metafits_filename: P, gpubox_filenames: &[P2] ) -> Result<CorrelatorContext, MwalibError>where P: AsRef<Path>, P2: AsRef<Path>,

From a path to a metafits file and paths to gpubox files, create an CorrelatorContext.

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

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

  • gpubox_filenames - slice of filenames of gpubox files as paths or strings.

Returns
  • Result containing a populated CorrelatorContext object if Ok.

pub fn get_fine_chan_freqs_hz_array( &self, corr_coarse_chan_indices: &[usize] ) -> Vec<f64, Global>

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

Arguments
  • corr_coarse_chan_indices - a slice containing correlator 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.

pub fn read_by_baseline( &self, corr_timestep_index: usize, corr_coarse_chan_index: usize ) -> Result<Vec<f32, Global>, GpuboxError>

Read a single timestep for a single coarse channel The output visibilities are in order: baseline,frequency,pol,r,i

Arguments
  • corr_timestep_index - index within the CorrelatorContext timestep array for the desired timestep. This corresponds to the element within mwalibContext.timesteps.

  • corr_coarse_chan_index - index within the CorrelatorContext coarse_chan array for the desired coarse channel. This corresponds to the element within mwalibContext.coarse_chans.

Returns
  • A Result containing vector of 32 bit floats containing the data in [baseline][frequency][pol][r][i] order, if Ok.

pub fn read_by_frequency( &self, corr_timestep_index: usize, corr_coarse_chan_index: usize ) -> Result<Vec<f32, Global>, GpuboxError>

Read a single timestep for a single coarse channel The output visibilities are in order: frequency,baseline,pol,r,i

Arguments
  • corr_timestep_index - index within the CorrelatorContext timestep array for the desired timestep. This corresponds to the element within mwalibContext.timesteps.

  • corr_coarse_chan_index - index within the CorrelatorContext coarse_chan array for the desired coarse channel. This corresponds to the element within mwalibContext.coarse_chans.

Returns
  • A Result containing vector of 32 bit floats containing the data in frequency,baseline,pol,r,i order, if Ok.

pub fn read_by_baseline_into_buffer( &self, corr_timestep_index: usize, corr_coarse_chan_index: usize, buffer: &mut [f32] ) -> Result<(), GpuboxError>

Read a single timestep for a single coarse channel The output visibilities are in order: baseline,frequency,pol,r,i

Arguments
  • corr_timestep_index - index within the CorrelatorContext timestep array for the desired timestep.

  • corr_coarse_chan_index - index within the CorrelatorContext coarse_chan array for the desired coarse channel.

  • buffer - Float buffer as a slice which will be filled with data from the HDU read in [baseline][frequency][pol][r][i] order.

Returns
  • A Result of Ok if success or a GpuboxError on failure.

pub fn read_by_frequency_into_buffer( &self, corr_timestep_index: usize, corr_coarse_chan_index: usize, buffer: &mut [f32] ) -> Result<(), GpuboxError>

Read a single timestep for a single coarse channel into a supplied buffer The output visibilities are in order: frequency,baseline,pol,r,i

Arguments
  • corr_timestep_index - index within the CorrelatorContext timestep array for the desired timestep.

  • corr_coarse_chan_index - index within the CorrelatorContext coarse_chan array for the desired coarse channel.

  • buffer - Float buffer as a slice which will be filled with data from the HDU read in [baseline][frequency][pol][r][i] order.

Returns
  • A Result of Ok if success or a GpuboxError on failure.

Trait Implementations§

§

impl Debug for CorrelatorContext

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Display for CorrelatorContext

Implements fmt::Display for CorrelatorContext struct

Arguments

  • f - A fmt::Formatter

Returns

  • fmt::Result - Result of this method
§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.