UVCal

UVCal is the main user class for calibration solutions for interferometric data sets. It provides import and export functionality to and from the supported file formats (calfits, FHD) as well as methods for transforming the data (converting types, selecting, sorting) and can be interacted with directly.

Attributes

The attributes on UVCal hold all of the metadata and data required to work with calibration solutions for interferometric data sets. Under the hood, the attributes are implemented as properties based on pyuvdata.parameter.UVParameter objects but this is fairly transparent to users.

UVCal objects can be initialized as an empty object (as cal = UVCal()). When an empty UVCal object is initialized, it has all of these attributes defined but set to None. The attributes can be set by reading in a data file using the pyuvdata.UVCal.read_calfits() or pyuvdata.UVCal.read_fhd_cal() methods or by setting them directly on the object. Some of these attributes are required to be set to have a fully defined calibration data set while others are optional. The pyuvdata.UVCal.check() method can be called on the object to verify that all of the required attributes have been set in a consistent way.

Note that objects can be in a “metadata only” state where all of the metadata is defined but the data-like attributes (gain_array, delay_array, flag_array, quality_array) are not. The pyuvdata.UVCal.check() method will still pass for metadata only objects.

Note location type attributes (which are given in topocentric xyz coordinates) have convenience properties named the same thing with _lat_lon_alt and _lat_lon_alt_degrees appended through which you can get or set the values using latitude, longitude and altitude values in radians or degrees and meters.

Required

These parameters are required to have a sensible UVCal object and are required for most kinds of uv cal files.

Nants_data

Number of antennas that have data associated with them (i.e. length of ant_array), which may be smaller than the numberof antennas in the telescope (i.e. length of antenna_numbers).

Nants_telescope

Number of antennas in the antenna_numbers array. May be larger than the number of antennas with gains associated with them.

Nfreqs

Number of frequency channels

Njones

Number of Jones calibration parameters (Number of Jones matrix elements calculated in calibration).

Nspws

Number of spectral windows (ie non-contiguous spectral chunks).

Ntimes

Number of times with different calibrations calculated (if a calibration is calculated over a range of integrations, this gives the number of separate calibrations along the time axis).

ant_array

Array of integer antenna numbers that appear in self.gain_array, with shape (Nants_data,). This array is ordered to match the inherent ordering of the zeroth axis of self.gain_array.

antenna_names

Array of antenna names with shape (Nants_telescope,). Ordering of elements matches ordering of antenna_numbers.

antenna_numbers

Array of all integer-valued antenna numbers in the telescope with shape (Nants_telescope,). Ordering of elements matches that of antenna_names. This array is not necessarily identical to ant_array, in that this array holds all antenna numbers associated with the telescope, not just antennas with data, and has an in principle non-specific ordering.

cal_style

Style of calibration. Values are sky or redundant.

cal_type

cal type parameter. Values are delay, gain or unknown.

channel_width

Width of frequency channels (Hz). If flex_spw = False and future_array_shapes=False, then it is a single value of type = float, otherwise it is an array of shape (Nfreqs,), type = float.Not required if future_array_shapes=True and wide_band=True.

flex_spw

Option to construct a ‘flexible spectral window’, which storesall spectral channels across the frequency axis of data_array. Allows for spectral windows of variable sizes, and channels of varying widths.

freq_array

Array of frequencies, center of the channel, shape (1, Nfreqs) or (Nfreqs,) if future_array_shapes=True, units Hz.Not required if future_array_shapes=True and wide_band=True.

future_array_shapes

Flag indicating that this object is using the future array shapes.

gain_convention

The convention for applying the calibration solutions to data.Values are “divide” or “multiply”, indicating that to calibrate one should divide or multiply uncalibrated data by gains. Mathematically this indicates the alpha exponent in the equation: calibrated data = gain^alpha * uncalibrated data. A value of “divide” represents alpha=-1 and “multiply” represents alpha=1.

history

String of history, units English

integration_time

Integration time of a time bin, units seconds. If future_array_shapes=False, then it is a single value of type = float, otherwise it is an array of shape (Ntimes), type = float.

jones_array

Array of antenna polarization integers, shape (Njones). linear pols -5:-8 (jxx, jyy, jxy, jyx).circular pols -1:-4 (jrr, jll. jrl, jlr).

spw_array

Array of spectral window numbers, shape (Nspws).

telescope_name

Name of telescope. e.g. HERA. String.

time_array

Array of calibration solution times, center of integration, shape (Ntimes), units Julian Date

wide_band

Option to support ‘wide-band’ calibration solutions with gains or delays that apply over a range of frequencies rather than having distinct values at each frequency. Delay type cal solutions are always ‘wide-band’ if future_array_shapes is True. If it is True several other parameters are affected: future_array_shapes is also True; the data-like arrays have a spw axis that is Nspws long rather than a frequency axis that is Nfreqs long; the freq_range parameter is required and the freq_array and channel_width parameters are not required.

x_orientation

Orientation of the physical dipole corresponding to what is labelled as the x polarization. Options are “east” (indicating east/west orientation) and “north” (indicating north/south orientation)

Optional

These parameters are defined by one or more file standard but are not always required. Some of them are required depending on the cal_type or cal_style (as noted below).

Nsources

Number of sources used.

antenna_positions

Array giving coordinates of antennas relative to telescope_location (ITRF frame), shape (Nants_telescope, 3), units meters. See the tutorial page in the documentation for an example of how to convert this to topocentric frame.

baseline_range

Range of baselines used for calibration.

delay_array

Required if cal_type = “delay”. Array of delays with units of seconds. Shape: (Nants_data, 1, 1, Ntimes, Njones) or (Nants_data, Nspws, Ntimes, Njones) if future_array_shapes=True, type=float.

diffuse_model

Name of diffuse model.

extra_keywords

Any user supplied extra keywords, type=dict. Keys should be 8 character or less strings if writing to calfits files. Use the special key ‘comment’ for long multi-line string comments.

filename

List of strings containing the unique basenames (not the full path) of input files.

flag_array

Array of flags to be applied to calibrated data (logical OR of input and flag generated by calibration). True is flagged. Shape: (Nants_data, 1, Nfreqs, Ntimes, Njones) or (Nants_data, Nfreqs, Ntimes, Njones) if future_array_shapes=True and wide_band=False or (Nants_data, Nspws, Ntimes, Njones) if wide_band=True, type = bool.

flex_spw_id_array

Required if flex_spw = True. Maps individual channels along the frequency axis to individual spectral windows, as listed in the spw_array. Shape (Nfreqs), type = int.

freq_range

Required if cal_type=’delay’ or wide_band=True. Frequency range that solutions are valid for. If future_array_shapes is False it is a list: [start_frequency, end_frequency], otherwise it is an array of shape (Nspws, 2). Units are Hz.

gain_array

Required if cal_type = “gain”. Array of gains, shape: (Nants_data, 1, Nfreqs, Ntimes, Njones) or (Nants_data, Nfreqs, Ntimes, Njones) if future_array_shapes=True, or (Nants_data, Nspws, Ntimes, Njones) if wide_band=True, type = complex float.

gain_scale

The gain scale of the calibration, which indicates the units of the calibrated visibilities. For example, Jy or K str.

git_hash_cal

Commit hash of calibration software (from git_origin_cal) used to generate solutions.

git_origin_cal

Origin (on github for e.g) of calibration software. Url and branch.

input_flag_array

Array of input flags, True is flagged. shape: (Nants_data, 1, Nfreqs, Ntimes, Njones) or (Nants_data, Nfreqs, Ntimes, Njones) if future_array_shapes=True, type = bool.

lst_array

Array of lsts, center of integration, shape (Ntimes), units radians

observer

Name of observer who calculated solutions in this file.

quality_array

Array of qualities of calibration solutions. The shape depends on cal_type, if the cal_type is ‘gain’ or ‘unknown’, the shape is: (Nants_data, 1, Nfreqs, Ntimes, Njones) or (Nants_data, Nfreqs, Ntimes, Njones) if future_array_shapes=True and wide_band=False or (Nants_data, Nspws, Ntimes, Njones) if wide_band=True, if the cal_type is ‘delay’, the shape is (Nants_data, 1, 1, Ntimes, Njones) or (Nants_data, Nspws, Ntimes, Njones) if future_array_shapes=True. The type is float.

ref_antenna_name

Required if cal_style = “sky”. Phase reference antenna.

sky_catalog

Required if cal_style = “sky”. Name of calibration catalog.

sky_field

Required if cal_style = ‘sky’. Short string describing field center or dominant source.

telescope_location

Telescope location: xyz in ITRF (earth-centered frame). Can also be accessed using telescope_location_lat_lon_alt or telescope_location_lat_lon_alt_degrees properties

time_range

Time range (in JD) that cal solutions are valid for.list: [start_time, end_time] in JD. Should only be set in Ntimes is 1.

total_quality_array

Array of qualities of the calibration for entire arrays. The shape depends on cal_type, if the cal_type is ‘gain’ or ‘unknown’, the shape is: (1, Nfreqs, Ntimes, Njones) or (Nfreqs, Ntimes, Njones) if future_array_shapes=True, if the cal_type is ‘delay’, the shape is (1, 1, Ntimes, Njones) or (1, Ntimes, Njones) if future_array_shapes=True, type = float.

Methods

class pyuvdata.UVCal[source]

A class defining calibration solutions for interferometric data.

UVParameter objects

For full list see the documentation on ReadTheDocs: http://pyuvdata.readthedocs.io/en/latest/. Some are always required, some are required for certain cal_types and cal_styles and others are always optional.

property data_like_parameters

Iterate defined parameters which are data-like (not metadata-like).

property metadata_only

Property that determines whether this is a metadata only object.

An object is metadata only if data_array, nsample_array and flag_array are all None.

use_future_array_shapes()[source]

Change the array shapes of this object to match the planned future shapes.

This method sets allows users to convert to the planned array shapes changes before the changes go into effect. This method sets the future_array_shapes parameter on this object to True.

use_current_array_shapes()[source]

Change the array shapes of this object to match the current shapes.

This method sets allows users to convert back to the current array shapes. This method sets the future_array_shapes parameter on this object to False.

set_telescope_params(overwrite=False)[source]

Set telescope related parameters.

If the telescope_name is in the known_telescopes, set the telescope location to the value for the known telescope. Also set the antenna positions if they are not set on the object and are available for the telescope.

Parameters

overwrite (bool) – Option to overwrite existing telescope-associated parameters with the values from the known telescope.

Raises

ValueError – if the telescope_name is not in known telescopes

set_lsts_from_time_array(background=False)[source]

Set the lst_array based from the time_array.

Parameters

background (bool, False) – When set to True, start the calculation on a threading.Thread in the background and return the thread to the user.

Returns

proc (None or threading.Thread instance) – When background is set to True, a thread is returned which must be joined before the lst_array exists on the UVCal object.

check(check_extra=True, run_check_acceptability=True, check_freq_spacing=False)[source]

Add some extra checks on top of checks on UVBase class.

Check that required parameters exist. Check that parameters have appropriate shapes and optionally that the values are acceptable.

Parameters
  • check_extra (bool) – If true, check all parameters, otherwise only check required parameters.

  • run_check_acceptability (bool) – Option to check if values in parameters are acceptable.

  • check_freq_spacing (bool) – Option to check if frequencies are evenly spaced and the spacing is equal to their channel_width. This is not required for UVCal objects in general but is required to write to calfits files.

Returns

bool – True if check passes

Raises

ValueError – if parameter shapes or types are wrong or do not have acceptable values (if run_check_acceptability is True)

copy(metadata_only=False)[source]

Make and return a copy of the UVCal object.

Parameters

metadata_only (bool) – If True, only copy the metadata of the object.

Returns

UVCal – Copy of self.

ant2ind(antnum)[source]

Get the index in data arrays for an antenna number.

Parameters

antnum (int) – Antenna number to get index for.

Returns

int – Antenna index in data arrays.

jpol2ind(jpol)[source]

Get the index in data arrays for an antenna polarization.

Parameters

jpol (int or str) – Antenna polarization to get index for.

Returns

int – Antenna polarization index in data arrays

get_gains(ant, jpol=None, squeeze_pol=True)[source]

Get the gain associated with an antenna and/or polarization.

Parameters
  • ant (int or length 2 tuple of ints or int and str) – Antenna or antenna and polarization to get gains for. If it’s a length 2 tuple, the second value must be an antenna polarization int or string parsable by jpol2ind.

  • jpol (int or str, optional) – Instrumental polarization to request. Ex. ‘Jxx’

  • squeeze_pol (bool) – Option to squeeze pol dimension if possible.

Returns

complex ndarray – Gain solution of shape (Nfreqs, Ntimes, Njones) or (Nfreqs, Ntimes) if jpol is set or if squeeze_pol is True and Njones = 1.

get_flags(ant, jpol=None, squeeze_pol=True)[source]

Get the flags associated with an antenna and/or polarization.

Parameters
  • ant (int or length 2 tuple of ints or int and str) – Antenna or antenna and polarization to get gains for. If it’s a length 2 tuple, the second value must be an antenna polarization int or string parsable by jpol2ind.

  • jpol (int or str, optional) – Instrumental polarization to request. Ex. ‘Jxx’

  • squeeze_pol (bool) – Option to squeeze pol dimension if possible.

Returns

boolean ndarray – Flags of shape (Nfreqs, Ntimes, Njones) or (Nfreqs, Ntimes) if jpol is set or if squeeze_pol is True and Njones = 1.

get_quality(ant, jpol=None, squeeze_pol=True)[source]

Get the qualities associated with an antenna and/or polarization.

Parameters
  • ant (int or length 2 tuple of ints or int and str) – Antenna or antenna and polarization to get gains for. If it’s a length 2 tuple, the second value must be an antenna polarization int or string parsable by jpol2ind.

  • jpol (int or str, optional) – Instrumental polarization to request. Ex. ‘Jxx’

  • squeeze_pol (bool) – Option to squeeze pol dimension if possible.

Returns

float ndarray – Qualities of shape (Nfreqs, Ntimes, Njones) or (Nfreqs, Ntimes) if jpol is not None or if squeeze_pol is True and Njones = 1.

reorder_antennas(order='number', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Arrange the antenna axis according to desired order.

Parameters

order (str or array like of int) – If a string, allowed values are “name” and “number” to sort on the antenna name or number respectively. A ‘-‘ can be prepended to signify descending order instead of the default ascending order (e.g. “-number”). An array of integers of length Nants representing indexes along the existing ant_array can also be supplied to sort in any desired order (note these are indices into the ant_array not antenna numbers).

Returns

None

Raises

ValueError – Raised if order is not an allowed string or is an array that does not contain all the required numbers.

reorder_freqs(spw_order=None, channel_order=None, select_spw=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Arrange the frequency axis according to desired order.

Parameters
  • spw_order (str or array_like of int) – A string describing the desired order of spectral windows along the frequecy axis. Allowed strings include number (sort on spectral window number) and freq (sort on median frequency). A ‘-‘ can be prepended to signify descending order instead of the default ascending order, e.g., if you have SPW #1 and 2, and wanted them ordered as [2, 1], you would specify -number. Alternatively, one can supply an index array of length Nspws that specifies how to shuffle the spws (this is not the desired final spw order). Default is to apply nos orting of spectral windows.

  • channel_order (str or array_like of int) – A string describing the desired order of frequency channels within a spectral window. Allowed strings are “freq” and “-freq”, which will sort channels within a spectral window by ascending or descending frequency respectively. Alternatively, one can supply an index array of length Nfreqs that specifies the new order. Default is to apply no sorting of channels within a single spectral window. Note that proving an array_like of ints will cause the values given to spw_order and select_spw to be ignored.

  • select_spw (int or array_like of int) – An int or array_like of ints which specifies which spectral windows to apply sorting. Note that setting this argument will cause the value given to spw_order to be ignored.

Returns

None

Raises

ValueError – Raised if select_spw contains values not in spw_array, or if channel_order is not the same length as freq_array.

reorder_times(order='time', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Arrange the time axis according to desired order.

Parameters

order (str or array like of int) – If a string, allowed value is “time” or “-time” to sort on the time in ascending or descending order respectively. An array of integers of length Ntimes representing indexes along the existing time_array can also be supplied to sort in any desired order.

Returns

None

Raises

ValueError – Raised if order is not an allowed string or is an array that does not contain all the required indices.

reorder_jones(order='name', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Arrange the jones element axis according to desired order.

Parameters

order (str or array like of int) – If a string, allowed values are “name” and “number” to sort on the jones element name or number respectively. A ‘-‘ can be prepended to signify descending order instead of the default ascending order (e.g. “-number”). An array of integers of length Njones representing indexes along the existing jones_array can also be supplied to sort in any desired order.

Returns

None

Raises

ValueError – Raised if order is not an allowed string or is an array that does not contain all the required indices.

convert_to_gain(freq_array=None, channel_width=None, delay_convention='minus', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Convert non-gain cal_types to gains.

For the delay cal_type the gain is calculated as:

gain = 1 * exp((+/-) * 2 * pi * j * delay * frequency) where the (+/-) is dictated by the delay_convention

Parameters
  • delay_convention (str) – Exponent sign to use in the conversion, can be “plus” or “minus”.

  • freq_array (array of float) – Frequencies to convert to gain at, units Hz. Not providing a freq_array is deprecated, but until version 3.0, if it is not provided and freq_array exists on the object, freq_array will be used.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after converting.

  • check_extra (bool) – Option to check optional parameters as well as required ones.

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after converting.

select(antenna_nums=None, antenna_names=None, frequencies=None, freq_chans=None, spws=None, times=None, jones=None, run_check=True, check_extra=True, run_check_acceptability=True, inplace=True)[source]

Downselect data to keep on the object along various axes.

Axes that can be selected along include antennas, frequencies, times and antenna polarization (jones).

The history attribute on the object will be updated to identify the operations performed.

Parameters
  • antenna_nums (array_like of int, optional) – The antennas numbers to keep in the object (antenna positions and names for the removed antennas will be retained). This cannot be provided if antenna_names is also provided.

  • antenna_names (array_like of str, optional) – The antennas names to keep in the object (antenna positions and names for the removed antennas will be retained). This cannot be provided if antenna_nums is also provided.

  • frequencies (array_like of float, optional) – The frequencies to keep in the object, each value passed here should exist in the freq_array.

  • freq_chans (array_like of int, optional) – The frequency channel numbers to keep in the object.

  • spws (array_like of in, optional) – The spectral window numbers to keep in the object. If this is not a wide-band object and frequencies or freq_chans is not None, frequencies that match any of the specifications will be kept (i.e. the selections will be OR’ed together).

  • times (array_like of float, optional) – The times to keep in the object, each value passed here should exist in the time_array.

  • jones (array_like of int or str, optional) – The antenna polarizations numbers to keep in the object, each value passed here should exist in the jones_array. If passing strings, the canonical polarization strings (e.g. “Jxx”, “Jrr”) are supported and if the x_orientation attribute is set, the physical dipole strings (e.g. “Jnn”, “Jee”) are also supported.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

  • inplace (bool) – Option to perform the select directly on self or return a new UVCal object with just the selected data (the default is True, meaning the select will be done on self).

classmethod initialize_from_uvdata(uvdata, gain_convention, cal_style, future_array_shapes=True, metadata_only=True, include_uvdata_history=True, cal_type='gain', times=None, integration_time=None, time_range=None, frequencies=None, channel_width=None, flex_spw=None, flex_spw_id_array=None, wide_band=None, freq_range=None, spw_array=None, jones=None, ref_antenna_name=None, sky_catalog=None, sky_field=None, diffuse_model=None, baseline_range=None, Nsources=None, observer=None, gain_scale=None, git_hash_cal=None, git_origin_cal=None, extra_keywords=None)[source]

Initialize this object based on a UVData object.

Parameters
  • uvdata (UVData object) – The UVData object to initialize from.

  • gain_convention (str) – What gain convention the UVCal object should be initialized to (“multiply” or “divide”).

  • cal_style (str) – What calibration style the UVCal object should be initialized to (“sky” or “redundant”).

  • future_array_shapes (bool) – Option to use the future array shapes (see use_future_array_shapes for details).

  • metadata_only (bool) – Option to only initialize the metadata. If False, this method also initializes the data-like arrays to zeros (or False for the flag_array) with the appropriate sizes.

  • include_uvdata_history (bool) – Option to include the history from the uvdata object in the uvcal history.

  • cal_type (str) – What cal_type the UVCal object should be initialized to (“gain”, or “delay”).

  • times (array_like of float, optional) – Calibration times in decimal Julian date. If None, use all unique times from uvdata.

  • integration_time (float or array_like of float, optional) – Calibration integration time in seconds, an array of shape (Ntimes,) or a scalar if future_array_shapes is False. Required if time_array is not None, ignored otherwise.

  • time_range (array_like of float, optional) – Range of times that calibration is valid for in decimal Julian dates, shape (2,). Should only be set if time_array is size (1,)

  • frequencies (array_like of float, optional) – Calibration frequencies (units Hz), shape (Nfreqs,). Defaulted to the freq_array from uvdata if cal_type=”gain” and wide_band is not set to True. Ignored if cal_type=”delay” or wide_band=True.

  • channel_width (float or array_like of float, optional) – Calibration channel width in Hz, an array of shape (Nfreqs,) or a scalar if future_array_shapes is False. Required if freq_array is not None and cal_type=”gain” and wide_band is not set to True, ignored otherwise.

  • flex_spw (bool, optional) – Option to use flexible spectral windows. Ignored if freq_array is None or cal_type=”delay” or wide_band=True.

  • flex_spw_id_array (array_like of int, optional) – Array giving the spectral window value for each frequency channel, shape (Nfreqs,). Ignored if freq_array is None or cal_type=”delay” or wide_band=True. Required if freq_array is not None and flex_spw is True and cal_type=”gain” and wide_band is not set to True.

  • wide_band (bool, optional) – Option to use wide-band calibration. Requires future_array_shapes to be True. Defaulted to True if future_array_shapes is True and cal_type=”delay”, defaulted to False otherwise.

  • freq_range (array_like of float, optional) – Frequency range that solutions are valid for in Hz, shape (Nspws, 2) if future_array_shapes is True, shape (2,) otherwise. Defaulted to the min, max of freq_array if wide_band is True or cal_type=”delay”. Defaulting is done per spectral window if uvdata has multiple spectral windows and future_array_shapes is True.

  • spw_array (array_like of int, optional) – Array giving the spectral window numbers. Required if either wide_band is True or cal_type=”delay” and if freq_range is not None and has multiple spectral windows, ignored otherwise. Defaulted to uvdata.spw_array if either wide_band is True or cal_type=”delay” and if freq_range is None.

  • jones (array_like of int, optional) – Calibration Jones elements. If None, defaults to [-5, -6] (jxx, jyy) if uvdata is in linear pol. [-1, -2] (jrr, jll) if uvdata is in circular pol. A ValueError is raised if jones_array is None and uvdata is in psuedo-stokes.

  • ref_antenna_name (str, optional) – Phase reference antenna, required if cal_style = “sky”.

  • sky_catalog (str, optional) – Name of calibration catalog, required if cal_sky = “sky”.

  • sky_field (str, optional) – Short string describing field center or dominant source, required if cal_sky = “sky”.

  • diffuse_model (str, optional) – Name of diffuse model.

  • baseline_range (array_like of float, optional) – Range of baselines used for calibration.

  • Nsources (int, optional) – Number of sources used.

  • observer (str, optional) – Name of observer who calculated calibration solutions.

  • gain_scale (str, optional) – The gain scale of the calibration, which indicates the units of the calibrated visibilities. For example, Jy or K str.

  • git_hash_cal (str, optional) – Commit hash of calibration software (from git_origin_cal) used to generate solutions.

  • git_origin_cal (str, optional) – Origin (on github for e.g) of calibration software. Url and branch.

  • extra_keywords (dict, optional) – Any user supplied extra keywords, type=dict.

Raises

ValueError – If cal_style is ‘sky’ and ref_antenna_name, sky_catalog or sky_field are not provided; if freq_array is not None, flex_spw is True and flex_spw_id_array is None; if freq_array and channel_width are None and the uvdata object does not use flexible spectral windows and the uvdata channel width varies; if time_array and integration_time are None and the uvdata integration time varies; if time_array is not None and integration_time is not specified or is the wrong type; if jones_array is None and uvdata is in psuedo-stokes.

read_calfits(filename, read_data=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in data from calfits file(s).

Parameters
  • filename (str or list of str) – The calfits file(s) to read from.

  • read_data (bool) – Read in the gains or delays, quality arrays and flag arrays. If set to False, only the metadata will be read in. Setting read_data to False results in a metadata only object.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after reading in the file.

  • check_extra (bool) – Option to check optional parameters as well as required ones.

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after reading in the file.

read_fhd_cal(cal_file, obs_file, layout_file=None, settings_file=None, raw=True, read_data=True, extra_history=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read data from an FHD cal.sav file.

Parameters
  • cal_file (str or list of str) – The cal.sav file or list of files to read from.

  • obs_file (str or list of str) – The obs.sav file or list of files to read from.

  • layout_file (str) – The FHD layout file. Required for antenna_positions to be set.

  • settings_file (str or list of str, optional) – The settings_file or list of files to read from. Optional, but very useful for provenance.

  • raw (bool) – Option to use the raw (per antenna, per frequency) solution or to use the fitted (polynomial over phase/amplitude) solution. Default is True (meaning use the raw solutions).

  • read_data (bool) – Read in the gains, quality array and flag data. If set to False, only the metadata will be read in. Setting read_data to False results in a metadata only object. Note that if read_data is False, metadata is derived entirely from the obs_file, which may result in slightly different values than if it is derived from the cal file.

  • extra_history (str or list of str, optional) – String(s) to add to the object’s history parameter.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after reading in the file.

  • check_extra (bool) – Option to check optional parameters as well as required ones.

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after reading in the file.

write_calfits(filename, run_check=True, check_extra=True, run_check_acceptability=True, clobber=False)[source]

Write the data to a calfits file.

Parameters
  • filename (str) – The calfits file to write to.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters before writing the file.

  • check_extra (bool) – Option to check optional parameters as well as required ones.

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters before writing the file.

  • clobber (bool) – Option to overwrite the filename if the file already exists.

Raises

ValueError – If the UVCal object is a metadata only object.

last updated: 2022-10-20