Struct birli::VisSelection

source ·
pub struct VisSelection {
    pub timestep_range: Range<usize>,
    pub coarse_chan_range: Range<usize>,
    pub baseline_idxs: Vec<usize, Global>,
}
Expand description

Keep track of which mwalib indices the values in a jones array, its’ weights and its’ flags came from. Similar to a VisContext, but requires an mwalib::CorrelatorContext to be fully interpreted

TODO: this definitely needs fine_chans_per_coarse TODO: what about https://doc.rust-lang.org/std/ops/trait.RangeBounds.html insetad of Range?

Fields§

§timestep_range: Range<usize>

selected range of mwalib timestep indices

§coarse_chan_range: Range<usize>

selected range of mwalib coarse channel indices

§baseline_idxs: Vec<usize, Global>

selected mwalib baseline indices

Implementations§

source§

impl VisSelection

source

pub fn from_mwalib( corr_ctx: &CorrelatorContext ) -> Result<VisSelection, SelectionError>

Produce a VisSelection from a given [marlu::mwalib::CorrelatorContext].

  • timesteps are selected from the first common to the last provided.
  • only common coarse channels are selected
  • all baselines are selected

For more details, see mwalib core concepts

Examples
use marlu::{mwalib::CorrelatorContext, VisSelection};

// define our input files
let metafits_path = "tests/data/1297526432_mwax/1297526432.metafits";
let gpufits_paths = vec![
    "tests/data/1297526432_mwax/1297526432_20210216160014_ch117_000.fits",
    "tests/data/1297526432_mwax/1297526432_20210216160014_ch117_001.fits",
    "tests/data/1297526432_mwax/1297526432_20210216160014_ch118_000.fits",
    "tests/data/1297526432_mwax/1297526432_20210216160014_ch118_001.fits",
];

let corr_ctx = CorrelatorContext::new(metafits_path, &gpufits_paths).unwrap();
let vis_sel = VisSelection::from_mwalib(&corr_ctx).unwrap();

assert_eq!(vis_sel.timestep_range.len(), 4);
Errors

This will return SelectionError::NoProvidedTimesteps if mwalib has determined that no timesteps have been provided, SelectionError::NoCommonTimesteps if none of the provided gpuboxes have timesteps in common

source

pub fn get_ant_pairs( &self, meta_ctx: &MetafitsContext ) -> Vec<(usize, usize), Global>

The selected antenna index pairs corresponding to sel_baselines_idxs

source

pub fn get_shape(&self, fine_chans_per_coarse: usize) -> (usize, usize, usize)

Get the shape of the jones, flag or weight array for this selection

source

pub fn estimate_bytes_best(&self, fine_chans_per_coarse: usize) -> usize

Estimate the memory size in bytes required to store the given selection without redundant pols.

source

pub fn allocate_jones( &self, fine_chans_per_coarse: usize ) -> Result<ArrayBase<OwnedRepr<Jones<f32>>, Dim<[usize; 3]>>, SelectionError>

Allocate a jones array to store visibilities for the selection

Errors

can raise SelectionError::InsufficientMemory if not enough memory.

source

pub fn allocate_flags( &self, fine_chans_per_coarse: usize ) -> Result<ArrayBase<OwnedRepr<bool>, Dim<[usize; 3]>>, SelectionError>

Allocate a flag array to store flags for the selection

Errors

can raise SelectionError::InsufficientMemory if not enough memory.

source

pub fn allocate_weights( &self, fine_chans_per_coarse: usize ) -> Result<ArrayBase<OwnedRepr<f32>, Dim<[usize; 3]>>, SelectionError>

Allocate a weight array to store weights for the selection

Errors

can raise SelectionError::InsufficientMemory if not enough memory.

Trait Implementations§

source§

impl Clone for VisSelection

source§

fn clone(&self) -> VisSelection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VisSelection

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for VisSelection

source§

fn default() -> VisSelection

Returns the “default value” for a type. 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.