Struct birli::io::uvfits::UvfitsWriter[][src]

pub struct UvfitsWriter { /* fields omitted */ }
Expand description

A helper struct to write out a uvfits file.

Note: only a single contiguous spectral window is supported.

TODO: make writer and reader a single class?

Implementations

Create a new uvfits file at the specified path.

This will destroy any existing uvfits file at that path

num_timesteps, num_baselines and num_chans are the number of timesteps, baselines and channels in this uvfits file respectively.

start_epoch can be calculated from GPS Time using the hifitime library, e.g.

use marlu::time;
let first_gps_time = 1196175296.0;
let start_epoch = time::gps_to_epoch(first_gps_time);

centre_freq_hz is center frequency of the center fine channel of the spectral window being written to this file. [Hz]

centre_freq_chan is the index (from zero) of the center frequency of the center fine channel of the spectral] window being written to this file.

phase_centre is a RADec of the observation’s phase center, used to populate the OBSRA and OBSDEC keys.

obs_name an optional name for the object under observation. Used to populate the OBJECT keys.

Errors

Will return an UvfitsWriteError if:

  • there is an existing file at path which cannot be removed.
  • a fits operation fails.

TODO: replace all these args with birli_context

Create a new uvfits file at the specified path using an [mwalib::CorrelatorContext]

Details

start epoch is determined by mwalib_timestep_range.start which may not necessarily match the obsid.

Errors

See: UvfitsWriter::new

Opens the associated uvfits file in edit mode, returning the FitsFile struct.

Closing the file can be achieved by droping all references to the FitsFile

Errors

Will return an fitsio::errors::Error if the file can’t be edited.

Write the antenna table to a uvfits file. Assumes that the array location is MWA.

positions are the XyzGeodetic coordinates of the MWA tiles. These positions need to have the MWA’s “centre” XYZ coordinates subtracted to make them local XYZ.

Self must have only have a single HDU when this function is called (true when using methods only provided by Self).

Derived from cotter.

Errors

Will return an UvfitsWriteError if a fits operation fails.

Write the antenna table to a uvfits file using the provided [mwalib::CorrelatorContext]

self must have only have a single HDU when this function is called (true when using methods only provided by Self).

latitude_rad Optionally override the latitude of the array [Radians]

Errors

See: UvfitsWriter::write_uvfits_antenna_table

Write a visibility row into the uvfits file.

uvfits must have been opened in write mode and currently have HDU 0 open. The FitsFile must be supplied to this function to force the caller to think about calling this function efficiently; opening the file for every call would be a problem, and keeping the file open in UvfitsWriter would mean the struct is not thread safe.

tile_index1 and tile_index2 are expected to be zero indexed; they are made one indexed by this function.

Errors

Will return an UvfitsWriteError if a fits operation fails.

TODO: Assumes that all fine channels are written in vis. This needs to be updated to add visibilities to an existing uvfits row.

Write visibilty and weight rows into the uvfits file from the provided [mwalib::CorrelatorContext].

Details

uvfits must have been opened in write mode and currently have HDU 0 open. The FitsFile must be supplied to this function to force the caller to think about calling this function efficiently; opening the file for every call would be a problem, and keeping the file open in UvfitsWriter would mean the struct is not thread safe.

baseline_idxs the baseline indices (according to mwalib) which should be written to the file

jones_array a ndarray::Array3 of Jones visibilities with dimensions [timestep][channel][baselines]

flag_array a ndarray::Array3 of boolean flags with dimensions identical dimensions to jones_array

mwalib_timestep_range the range of timestep indices (according to mwalib) which are used in the visibility and flag arrays

mwalib_coarse_chan_range the range of coarse channel indices (according to mwalib) which are used in the visibility and flag arrays

mwalib_baseline_idxs the baseline indices (according to mwalib) used in the visibility and flag arrays

TODO: handle averaging

Errors

Will return an UvfitsWriteError if a fits operation fails.

TODO: replace all these args with birli_context

Trait Implementations

Write visibilities and weights from the arrays. Timestep, coarse channel and baseline indices are needed for labelling the visibility 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

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.