UVData Class

UVData is the main user class. It provides import and export functionality to all supported file formats (UVFITS, Miriad, FHD) and can be interacted with directly.

class pyuvdata.UVData[source]

A class for defining a radio interferometer dataset.

Currently supported file types: uvfits, miriad, fhd. Provides phasing functions.

UVParameter objects

For full list see UVData Parameters (http://pyuvdata.readthedocs.io/en/latest/uvdata_parameters.html). Some are always required, some are required for certain phase_types and others are always optional.

check(check_extra=True, run_check_acceptability=True)[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.

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)

set_drift()[source]

Set phase_type to ‘drift’ and adjust required parameters.

set_phased()[source]

Set phase_type to ‘phased’ and adjust required parameters.

set_unknown_phase_type()[source]

Set phase_type to ‘unknown’ and adjust required parameters.

known_telescopes()[source]

Get a list of telescopes known to pyuvdata.

This is just a shortcut to uvdata.telescopes.known_telescopes()

Returns

list of str – List of names of known telescopes

set_telescope_params(overwrite=False)[source]

Set telescope related parameters.

If the telescope_name is in the known_telescopes, set any missing telescope-associated parameters (e.g. telescope location) to the value for the known 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

baseline_to_antnums(baseline)[source]

Get the antenna numbers corresponding to a given baseline number.

Parameters

baseline (int) – baseline number

Returns

  • int – first antenna number

  • int – second antenna number

antnums_to_baseline(ant1, ant2, attempt256=False)[source]

Get the baseline number corresponding to two given antenna numbers.

Parameters
  • ant1 (int) – first antenna number

  • ant2 (int) – second antenna number

  • attempt256 (bool) – Option to try to use the older 256 standard used in many uvfits files (will use 2048 standard if there are more than 256 antennas).

Returns

int – baseline number corresponding to the two antenna numbers.

set_lsts_from_time_array()[source]

Set the lst_array based from the time_array.

unphase_to_drift(phase_frame=None, use_ant_pos=False)[source]

Convert from a phased dataset to a drift dataset.

See the phasing memo under docs/references for more documentation.

Parameters
  • phase_frame (str) – The astropy frame to phase from. Either ‘icrs’ or ‘gcrs’. ‘gcrs’ accounts for precession & nutation, ‘icrs’ also includes abberation. Defaults to using the ‘phase_center_frame’ attribute or ‘icrs’ if that attribute is None.

  • use_ant_pos (bool) – If True, calculate the uvws directly from the antenna positions rather than from the existing uvws.

Raises

ValueError – If the phase_type is not ‘phased’

phase(ra, dec, epoch='J2000', phase_frame='icrs', use_ant_pos=False)[source]

Phase a drift scan dataset to a single ra/dec at a particular epoch.

See the phasing memo under docs/references for more documentation.

Tested against MWA_Tools/CONV2UVFITS/convutils. Will not phase already phased data.

Parameters
  • ra (float) – The ra to phase to in radians.

  • dec (float) – The dec to phase to in radians.

  • epoch (astropy.time.Time object or str) – The epoch to use for phasing. Either an astropy Time object or the string “J2000” (which is the default). Note that the epoch is only used to evaluate the ra & dec values, if the epoch is not J2000, the ra & dec values are interpreted as FK5 ra/dec values and translated to J2000, the data are then phased to the J2000 ra/dec values.

  • phase_frame (str) – The astropy frame to phase to. Either ‘icrs’ or ‘gcrs’. ‘gcrs’ accounts for precession & nutation, ‘icrs’ accounts for precession, nutation & abberation.

  • use_ant_pos (bool) – If True, calculate the uvws directly from the antenna positions rather than from the existing uvws.

Raises

ValueError – If the phase_type is not ‘drift’

phase_to_time(time, phase_frame='icrs', use_ant_pos=False)[source]

Phase a drift scan dataset to the ra/dec of zenith at a particular time.

See the phasing memo under docs/references for more documentation.

Parameters
  • time (astropy.time.Time object) – The time to phase to, an astropy Time object.

  • phase_frame (str) – The astropy frame to phase to. Either ‘icrs’ or ‘gcrs’. ‘gcrs’ accounts for precession & nutation, ‘icrs’ accounts for precession, nutation & abberation.

  • use_ant_pos (bool) – If True, calculate the uvws directly from the antenna positions rather than from the existing uvws.

Raises
  • ValueError – If the phase_type is not ‘drift’

  • TypeError – If time is not an astropy.time.Time object

set_uvws_from_antenna_positions(allow_phasing=False, orig_phase_frame=None, output_phase_frame='icrs')[source]

Calculate UVWs based on antenna_positions

Parameters
  • allow_phasing (bool) – Option for phased data. If data is phased and allow_phasing is set, data will be unphased, UVWs will be calculated, and then data will be rephased.

  • orig_phase_frame (str) – The astropy frame to phase from. Either ‘icrs’ or ‘gcrs’. Defaults to using the ‘phase_center_frame’ attribute or ‘icrs’ if that attribute is None. Only used if allow_phasing is True.

  • output_phase_frame (str) – The astropy frame to phase to. Either ‘icrs’ or ‘gcrs’. Only used if allow_phasing is True.

Raises

ValueError – If data is phased and allow_phasing is False.

Warns

UserWarning – If the phase_type is ‘phased’

conjugate_bls(convention='ant1<ant2', use_enu=True)[source]

Conjugate baselines according to one of the supported conventions.

This will fail if only one of the cross pols is present (because conjugation requires changing the polarization number for cross pols).

Parameters
  • convention (str or array_like of int) – A convention for the directions of the baselines, options are: ‘ant1<ant2’, ‘ant2<ant1’, ‘u<0’, ‘u>0’, ‘v<0’, ‘v>0’ or an index array of blt indices to conjugate.

  • use_enu (bool) – Use true antenna positions to determine uv location (as opposed to uvw array). Only applies if convention is ‘u<0’, ‘u>0’, ‘v<0’, ‘v>0’. Set to False to use uvw array values.

Raises

ValueError – If convention is not an allowed value or if not all conjugate pols exist.

reorder_pols(order='AIPS', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Rearrange polarizations in the event they are not uvfits compatible.

Parameters
  • order (str) – Either a string specifying a cannonical ordering (‘AIPS’ or ‘CASA’) or an index array of length Npols that specifies how to shuffle the data (this is not the desired final pol order). CASA ordering has cross-pols in between (e.g. XX,XY,YX,YY) AIPS ordering has auto-pols followed by cross-pols (e.g. XX,YY,XY,YX) Default (‘AIPS’) will sort by absolute value of pol values.

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

  • 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 reordering.

Raises

ValueError – If the order is not one of the allowed values.

order_pols(order='AIPS')[source]

Will be deprecated in version 1.5, now just calls reorder_pols.

Parameters

order (str) – either ‘CASA’ or ‘AIPS’.

Raises

ValueError – If the order is not one of the allowed values.

Warns

DeprecationWarning – Always, because this method will be deprecated in version 1.5

reorder_blts(order='time', minor_order=None, conj_convention=None, conj_convention_use_enu=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Arrange blt axis according to desired order. Optionally conjugate some baselines.

Parameters
  • order (str or array_like of int) – A string describing the desired order along the blt axis. Options are: time, baseline, ant1, ant2, bda or an index array of length Nblts that specifies the new order.

  • minor_order (str) – Optionally specify a secondary ordering. Default depends on how order is set: if order is ‘time’, this defaults to baseline, if order is ant1, or ant2 this defaults to the other antenna, if order is baseline the only allowed value is time. Ignored if order is bda If this is the same as order, it is reset to the default.

  • conj_convention (str or array_like of int) – Optionally conjugate baselines to make the baselines have the desired orientation. See conjugate_bls for allowed values and details.

  • conj_convention_use_enu (bool) – If conj_convention is set, this is passed to conjugate_bls, see that method for details.

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

  • 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 reordering.

Raises

ValueError – If parameter values are inappropriate

fast_concat(other, axis, run_check=True, check_extra=True, run_check_acceptability=True, inplace=False)[source]

Concatenate two UVData objects along specified axis with almost no checking of metadata.

Warning! This method assumes all the metadata along other axes is sorted the same way. The __add__ method is much safer, it checks all the metadata, but it is slower. Some quick checks are run, but this method doesn’t make any guarantees that the resulting object is correct.

Parameters
  • other (UVData object) – Another UVData object which will be added to self.

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. Allowed values are: ‘blt’, ‘freq’, ‘polarization’.

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

  • 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 combining objects.

  • inplace (bool) – If True, overwrite self as we go, otherwise create a third object as the sum of the two.

Raises

ValueError – If other is not a UVData object, axis is not an allowed value or if self and other are not compatible.

select(antenna_nums=None, antenna_names=None, ant_str=None, bls=None, frequencies=None, freq_chans=None, times=None, polarizations=None, blt_inds=None, run_check=True, check_extra=True, run_check_acceptability=True, inplace=True, metadata_only=False, keep_all_metadata=True)[source]

Downselect data to keep on the object along various axes.

Axes that can be selected along include antenna names or numbers, antenna pairs, frequencies, times and polarizations. Specific baseline-time indices can also be selected, but this is not commonly used. 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 unless keep_all_metadata is False). 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 unless keep_all_metadata is False). This cannot be provided if antenna_nums is also provided.

  • bls (list of tuple, optional) – A list of antenna number tuples (e.g. [(0,1), (3,2)]) or a list of baseline 3-tuples (e.g. [(0,1,’xx’), (2,3,’yy’)]) specifying baselines to keep in the object. For length-2 tuples, the ordering of the numbers within the tuple does not matter. For length-3 tuples, the polarization string is in the order of the two antennas. If length-3 tuples are provided, polarizations must be None.

  • ant_str (str, optional) – A string containing information about what antenna numbers and polarizations to keep in the object. Can be ‘auto’, ‘cross’, ‘all’, or combinations of antenna numbers and polarizations (e.g. ‘1’, ‘1_2’, ‘1x_2y’). See tutorial for more examples of valid strings and the behavior of different forms for ant_str. If ‘1x_2y,2y_3y’ is passed, both polarizations ‘xy’ and ‘yy’ will be kept for both baselines (1,2) and (2,3) to return a valid pyuvdata object. An ant_str cannot be passed in addition to any of antenna_nums, antenna_names, bls args or the polarizations parameters, if it is a ValueError will be raised.

  • 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.

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

  • polarizations (array_like of int, optional) – The polarizations numbers to keep in the object, each value passed here should exist in the polarization_array.

  • blt_inds (array_like of int, optional) – The baseline-time indices to keep in the object. This is not commonly used.

  • 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 UVData object with just the selected data (the default is True, meaning the select will be done on self).

  • metadata_only (bool) – Option to only do the select on the metadata. Not allowed if the data_array, flag_array or nsample_array is not None.

  • keep_all_metadata (bool) – Option to keep all the metadata associated with antennas, even those that do do not have data associated with them after the select option.

Returns

UVData object or None – None is returned if inplace is True, otherwise a new UVData object with just the selected data is returned

Raises

ValueError – If any of the parameters are set to inappropriate values.

read_uvfits(filename, axis=None, antenna_nums=None, antenna_names=None, ant_str=None, bls=None, frequencies=None, freq_chans=None, times=None, polarizations=None, blt_inds=None, keep_all_metadata=True, read_data=True, read_metadata=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in header, metadata and data from uvfits file(s).

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

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. This method does not guarantee correct resulting objects. Please see the docstring for fast_concat for details. Allowed values are: ‘blt’, ‘freq’, ‘polarization’. Only used if multiple files are passed.

  • antenna_nums (array_like of int, optional) – The antennas numbers to include when reading data into the object (antenna positions and names for the removed antennas will be retained unless keep_all_metadata is False). This cannot be provided if antenna_names is also provided. Ignored if read_data is False.

  • antenna_names (array_like of str, optional) – The antennas names to include when reading data into the object (antenna positions and names for the removed antennas will be retained unless keep_all_metadata is False). This cannot be provided if antenna_nums is also provided. Ignored if read_data is False.

  • bls (list of tuple, optional) – A list of antenna number tuples (e.g. [(0,1), (3,2)]) or a list of baseline 3-tuples (e.g. [(0,1,’xx’), (2,3,’yy’)]) specifying baselines to include when reading data into the object. For length-2 tuples, the ordering of the numbers within the tuple does not matter. For length-3 tuples, the polarization string is in the order of the two antennas. If length-3 tuples are provided, polarizations must be None. Ignored if read_data is False.

  • ant_str (str, optional) – A string containing information about what antenna numbers and polarizations to include when reading data into the object. Can be ‘auto’, ‘cross’, ‘all’, or combinations of antenna numbers and polarizations (e.g. ‘1’, ‘1_2’, ‘1x_2y’). See tutorial for more examples of valid strings and the behavior of different forms for ant_str. If ‘1x_2y,2y_3y’ is passed, both polarizations ‘xy’ and ‘yy’ will be kept for both baselines (1,2) and (2,3) to return a valid pyuvdata object. An ant_str cannot be passed in addition to any of antenna_nums, antenna_names, bls args or the polarizations parameters, if it is a ValueError will be raised. Ignored if read_data is False.

  • frequencies (array_like of float, optional) – The frequencies to include when reading data into the object, each value passed here should exist in the freq_array. Ignored if read_data is False.

  • freq_chans (array_like of int, optional) – The frequency channel numbers to include when reading data into the object. Ignored if read_data is False.

  • times (array_like of float, optional) – The times to include when reading data into the object, each value passed here should exist in the time_array. Ignored if read_data is False.

  • polarizations (array_like of int, optional) – The polarizations numbers to include when reading data into the object, each value passed here should exist in the polarization_array. Ignored if read_data is False.

  • blt_inds (array_like of int, optional) – The baseline-time indices to include when reading data into the object. This is not commonly used. Ignored if read_data is False.

  • keep_all_metadata (bool) – Option to keep all the metadata associated with antennas, even those that do not have data associated with them after the select option.

  • read_data (bool) – Read in the visibility and flag data. If set to false, only the basic header info and metadata (if read_metadata is True) will be read in. Setting read_data to False results in an incompletely defined object (check will not pass).

  • read_metadata (: bool) – Read in metadata (times, baselines, uvws) as well as basic header info. Only used if read_data is False (metadata will be read if data is read). If both read_data and read_metadata are false, only basic header info is read in.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after after reading in the file (the default is True, meaning the check will be run). Ignored if read_data is False.

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

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after reading in the file (the default is True, meaning the acceptable range check will be done). Ignored if read_data is False.

write_uvfits(filename, spoof_nonessential=False, write_lst=True, force_phase=False, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Write the data to a uvfits file.

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

  • spoof_nonessential (bool) – Option to spoof the values of optional UVParameters that are not set but are required for uvfits files.

  • write_lst (bool) – Option to write the LSTs to the metadata (random group parameters).

  • force_phase (: bool) – Option to automatically phase drift scan data to zenith of the first timestamp.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after before writing the file (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 before writing the file (the default is True, meaning the acceptable range check will be done).

read_ms(filepath, axis=None, data_column='DATA', pol_order='AIPS', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in data from a measurement set

Parameters
  • filepath (str or list of str) – The measurement set file directory or list of directories to read from.

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. This method does not guarantee correct resulting objects. Please see the docstring for fast_concat for details. Allowed values are: ‘blt’, ‘freq’, ‘polarization’. Only used if multiple files are passed.

  • data_column (str) – name of CASA data column to read into data_array. Options are: ‘DATA’, ‘MODEL’, or ‘CORRECTED_DATA’

  • pol_order (str) – Option to specify polarizations order convention, options are ‘CASA’ or ‘AIPS’.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after after reading in the file (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 reading in the file (the default is True, meaning the acceptable range check will be done).

read_fhd(filelist, use_model=False, axis=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in data from a list of FHD files.

Parameters
  • filelist (list of str) – The list of FHD save files to read from. Must include at least one polarization file, a params file and a flag file. Can also be a list of lists to read multiple data sets.

  • use_model (bool) – Option to read in the model visibilities rather than the dirty visibilities (the default is False, meaning the dirty visibilities will be read).

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. This method does not guarantee correct resulting objects. Please see the docstring for fast_concat for details. Allowed values are: ‘blt’, ‘freq’, ‘polarization’. Only used if multiple data sets are passed.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after after reading in the file (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 reading in the file (the default is True, meaning the acceptable range check will be done).

read_miriad(filepath, axis=None, antenna_nums=None, ant_str=None, bls=None, polarizations=None, time_range=None, read_data=True, phase_type=None, correct_lat_lon=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in data from a miriad file.

Parameters
  • filepath (str or list of str) – The miriad file directory or list of directories to read from.

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. This method does not guarantee correct resulting objects. Please see the docstring for fast_concat for details. Allowed values are: ‘blt’, ‘freq’, ‘polarization’. Only used if multiple files are passed.

  • antenna_nums (array_like of int, optional) – The antennas numbers to read into the object.

  • bls (list of tuple, optional) – A list of antenna number tuples (e.g. [(0,1), (3,2)]) or a list of baseline 3-tuples (e.g. [(0,1,’xx’), (2,3,’yy’)]) specifying baselines to include when reading data into the object. For length-2 tuples, the ordering of the numbers within the tuple does not matter. For length-3 tuples, the polarization string is in the order of the two antennas. If length-3 tuples are provided, polarizations must be None.

  • ant_str (str, optional) – A string containing information about what antenna numbers and polarizations to include when reading data into the object. Can be ‘auto’, ‘cross’, ‘all’, or combinations of antenna numbers and polarizations (e.g. ‘1’, ‘1_2’, ‘1x_2y’). See tutorial for more examples of valid strings and the behavior of different forms for ant_str. If ‘1x_2y,2y_3y’ is passed, both polarizations ‘xy’ and ‘yy’ will be kept for both baselines (1,2) and (2,3) to return a valid pyuvdata object. An ant_str cannot be passed in addition to any of antenna_nums, bls or polarizations parameters, if it is a ValueError will be raised.

  • polarizations (array_like of int or str, optional) – List of polarization integers or strings to read-in. e.g. [‘xx’, ‘yy’, …]

  • time_range (list of float, optional) – len-2 list containing min and max range of times in Julian Date to include when reading data into the object. e.g. [2458115.20, 2458115.40]

  • read_data (bool) – Read in the visibility and flag data. If set to false, only the metadata will be read in. Setting read_data to False results in an incompletely defined object (check will not pass).

  • phase_type (str, optional) – Option to specify the phasing status of the data. Options are ‘drift’, ‘phased’ or None. ‘drift’ means the data are zenith drift data, ‘phased’ means the data are phased to a single RA/Dec. Default is None meaning it will be guessed at based on the file contents.

  • correct_lat_lon (bool) – Option to update the latitude and longitude from the known_telescopes list if the altitude is missing.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after after reading in the file (the default is True, meaning the check will be run). Ignored if read_data is False.

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

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after reading in the file (the default is True, meaning the acceptable range check will be done). Ignored if read_data is False.

write_miriad(filepath, run_check=True, check_extra=True, run_check_acceptability=True, clobber=False, no_antnums=False)[source]

Write the data to a miriad file.

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

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after before writing the file (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 before writing the file (the default is True, meaning the acceptable range check will be done).

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

  • no_antnums (bool) – Option to not write the antnums variable to the file. Should only be used for testing purposes.

read_uvh5(filename, axis=None, antenna_nums=None, antenna_names=None, ant_str=None, bls=None, frequencies=None, freq_chans=None, times=None, polarizations=None, blt_inds=None, keep_all_metadata=True, read_data=True, data_array_dtype=<class 'numpy.complex128'>, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read a UVH5 file.

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

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. This method does not guarantee correct resulting objects. Please see the docstring for fast_concat for details. Allowed values are: ‘blt’, ‘freq’, ‘polarization’. Only used if multiple files are passed.

  • antenna_nums (array_like of int, optional) – The antennas numbers to include when reading data into the object (antenna positions and names for the removed antennas will be retained unless keep_all_metadata is False). This cannot be provided if antenna_names is also provided. Ignored if read_data is False.

  • antenna_names (array_like of str, optional) – The antennas names to include when reading data into the object (antenna positions and names for the removed antennas will be retained unless keep_all_metadata is False). This cannot be provided if antenna_nums is also provided. Ignored if read_data is False.

  • bls (list of tuple, optional) – A list of antenna number tuples (e.g. [(0,1), (3,2)]) or a list of baseline 3-tuples (e.g. [(0,1,’xx’), (2,3,’yy’)]) specifying baselines to include when reading data into the object. For length-2 tuples, the ordering of the numbers within the tuple does not matter. For length-3 tuples, the polarization string is in the order of the two antennas. If length-3 tuples are provided, polarizations must be None. Ignored if read_data is False.

  • ant_str (str, optional) – A string containing information about what antenna numbers and polarizations to include when reading data into the object. Can be ‘auto’, ‘cross’, ‘all’, or combinations of antenna numbers and polarizations (e.g. ‘1’, ‘1_2’, ‘1x_2y’). See tutorial for more examples of valid strings and the behavior of different forms for ant_str. If ‘1x_2y,2y_3y’ is passed, both polarizations ‘xy’ and ‘yy’ will be kept for both baselines (1,2) and (2,3) to return a valid pyuvdata object. An ant_str cannot be passed in addition to any of antenna_nums, antenna_names, bls args or the polarizations parameters, if it is a ValueError will be raised. Ignored if read_data is False.

  • frequencies (array_like of float, optional) – The frequencies to include when reading data into the object, each value passed here should exist in the freq_array. Ignored if read_data is False.

  • freq_chans (array_like of int, optional) – The frequency channel numbers to include when reading data into the object. Ignored if read_data is False.

  • times (array_like of float, optional) – The times to include when reading data into the object, each value passed here should exist in the time_array. Ignored if read_data is False.

  • polarizations (array_like of int, optional) – The polarizations numbers to include when reading data into the object, each value passed here should exist in the polarization_array. Ignored if read_data is False.

  • blt_inds (array_like of int, optional) – The baseline-time indices to include when reading data into the object. This is not commonly used. Ignored if read_data is False.

  • keep_all_metadata (bool) – Option to keep all the metadata associated with antennas, even those that do not have data associated with them after the select option.

  • read_data (bool) – Read in the visibility and flag data. If set to false, only the basic header info and metadata (if read_metadata is True) will be read in. Setting read_data to False results in an incompletely defined object (check will not pass).

  • data_array_dtype (numpy dtype) – Datatype to store the output data_array as. Must be either np.complex64 (single-precision real and imaginary) or np.complex128 (double- precision real and imaginary). Only used if the datatype of the visibility data on-disk is not ‘c8’ or ‘c16’.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after after reading in the file (the default is True, meaning the check will be run). Ignored if read_data is False.

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

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after reading in the file (the default is True, meaning the acceptable range check will be done). Ignored if read_data is False.

write_uvh5(filename, run_check=True, check_extra=True, run_check_acceptability=True, clobber=False, data_compression=None, flags_compression='lzf', nsample_compression='lzf', data_write_dtype=None)[source]

Write a completely in-memory UVData object to a UVH5 file.

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

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

  • data_compression (str) – HDF5 filter to apply when writing the data_array. Default is None meaning no filter or compression.

  • flags_compression (str) – HDF5 filter to apply when writing the flags_array. Default is “lzf” for the LZF filter.

  • nsample_compression (str) – HDF5 filter to apply when writing the nsample_array. Default is “lzf” for the LZF filter.

  • data_write_dtype (numpy dtype) – datatype of output visibility data. If ‘None’, then the same datatype as data_array will be used. Otherwise, a numpy dtype object must be specified with an ‘r’ field and an ‘i’ field for real and imaginary parts, respectively. See uvh5.py for an example of defining such a datatype.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after before writing the file (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 before writing the file (the default is True, meaning the acceptable range check will be done).

initialize_uvh5_file(filename, clobber=False, data_compression=None, flags_compression='lzf', nsample_compression='lzf', data_write_dtype=None)[source]

Initialize a UVH5 file on disk with the header metadata and empty data arrays.

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

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

  • data_compression (str) – HDF5 filter to apply when writing the data_array. Default is None meaning no filter or compression.

  • flags_compression (str) – HDF5 filter to apply when writing the flags_array. Default is “lzf” for the LZF filter.

  • nsample_compression (str) – HDF5 filter to apply when writing the nsample_array. Default is “lzf” for the LZF filter.

  • data_write_dtype (numpy dtype) – datatype of output visibility data. If ‘None’, then the same datatype as data_array will be used. Otherwise, a numpy dtype object must be specified with an ‘r’ field and an ‘i’ field for real and imaginary parts, respectively. See uvh5.py for an example of defining such a datatype.

Notes

When partially writing out data, this function should be called first to initialize the file on disk. The data is then actually written by calling the write_uvh5_part method, with the same filename as the one specified in this function. See the tutorial for a worked example.

write_uvh5_part(filename, data_array, flags_array, nsample_array, check_header=True, antenna_nums=None, antenna_names=None, ant_str=None, bls=None, frequencies=None, freq_chans=None, times=None, polarizations=None, blt_inds=None, run_check_acceptability=True, add_to_history=None)[source]

Write data to a UVH5 file that has already been initialized.

Parameters
  • filename (str) – The UVH5 file to write to. It must already exist, and is assumed to have been initialized with initialize_uvh5_file.

  • data_array (ndarray) – The data to write to disk. A check is done to ensure that the dimensions of the data passed in conform to the ones specified by the “selection” arguments.

  • flags_array (ndarray) – The flags array to write to disk. A check is done to ensure that the dimensions of the data passed in conform to the ones specified by the “selection” arguments.

  • nsample_array (ndarray) – The nsample array to write to disk. A check is done to ensure that the dimensions of the data passed in conform to the ones specified by the “selection” arguments.

  • check_header (bool) – Option to check that the metadata present in the header on disk matches that in the object.

  • antenna_nums (array_like of int, optional) – The antennas numbers to include when writing data into the file (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 include when writing data into the file (antenna positions and names for the removed antennas will be retained). This cannot be provided if antenna_nums is also provided.

  • bls (list of tuple, optional) – A list of antenna number tuples (e.g. [(0,1), (3,2)]) or a list of baseline 3-tuples (e.g. [(0,1,’xx’), (2,3,’yy’)]) specifying baselines to include when writing data into the file. For length-2 tuples, the ordering of the numbers within the tuple does not matter. For length-3 tuples, the polarization string is in the order of the two antennas. If length-3 tuples are provided, polarizations must be None.

  • ant_str (str, optional) – A string containing information about what antenna numbers and polarizations to include writing data into the file. Can be ‘auto’, ‘cross’, ‘all’, or combinations of antenna numbers and polarizations (e.g. ‘1’, ‘1_2’, ‘1x_2y’). See tutorial for more examples of valid strings and the behavior of different forms for ant_str. If ‘1x_2y,2y_3y’ is passed, both polarizations ‘xy’ and ‘yy’ will be kept for both baselines (1,2) and (2,3) to return a valid pyuvdata object. An ant_str cannot be passed in addition to any of antenna_nums, antenna_names, bls args or the polarizations parameters, if it is a ValueError will be raised.

  • frequencies (array_like of float, optional) – The frequencies to include when writing data into the file, each value passed here should exist in the freq_array.

  • freq_chans (array_like of int, optional) – The frequency channel numbers to include writing data into the file.

  • times (array_like of float, optional) – The times to include when writing data into the file, each value passed here should exist in the time_array.

  • polarizations (array_like of int, optional) – The polarizations numbers to include when writing data into the file, each value passed here should exist in the polarization_array.

  • blt_inds (array_like of int, optional) – The baseline-time indices to include when writing data into the file. This is not commonly used.

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters before writing the file (the default is True, meaning the acceptable range check will be done).

  • add_to_history (str) – String to append to history before write out. Default is no appending.

read(filename, axis=None, file_type=None, antenna_nums=None, antenna_names=None, ant_str=None, bls=None, frequencies=None, freq_chans=None, times=None, polarizations=None, blt_inds=None, time_range=None, keep_all_metadata=True, read_metadata=True, read_data=True, phase_type=None, correct_lat_lon=True, use_model=False, data_column='DATA', pol_order='AIPS', data_array_dtype=<class 'numpy.complex128'>, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read a generic file into a UVData object.

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

  • file_type (str) – One of [‘uvfits’, ‘miriad’, ‘fhd’, ‘ms’, ‘uvh5’] or None. If None, the code attempts to guess what the file type is. For miriad and ms types, this is based on the standard directory structure. For FHD, uvfits and uvh5 files it’s based on file extensions (FHD: .sav, .txt; uvfits: .uvfits; uvh5: .uvh5). Note that if a list of datasets is passed, the file type is determined from the first dataset.

  • axis (str) – Axis to concatenate files along. This enables fast concatenation along the specified axis without the normal checking that all other metadata agrees. This method does not guarantee correct resulting objects. Please see the docstring for fast_concat for details. Allowed values are: ‘blt’, ‘freq’, ‘polarization’. Only used if multiple files are passed.

  • antenna_nums (array_like of int, optional) – The antennas numbers to include when reading data into the object (antenna positions and names for the removed antennas will be retained unless keep_all_metadata is False). This cannot be provided if antenna_names is also provided. Ignored if read_data is False.

  • antenna_names (array_like of str, optional) – The antennas names to include when reading data into the object (antenna positions and names for the removed antennas will be retained unless keep_all_metadata is False). This cannot be provided if antenna_nums is also provided. Ignored if read_data is False.

  • bls (list of tuple, optional) – A list of antenna number tuples (e.g. [(0,1), (3,2)]) or a list of baseline 3-tuples (e.g. [(0,1,’xx’), (2,3,’yy’)]) specifying baselines to include when reading data into the object. For length-2 tuples, the ordering of the numbers within the tuple does not matter. For length-3 tuples, the polarization string is in the order of the two antennas. If length-3 tuples are provided, polarizations must be None. Ignored if read_data is False.

  • ant_str (str, optional) – A string containing information about what antenna numbers and polarizations to include when reading data into the object. Can be ‘auto’, ‘cross’, ‘all’, or combinations of antenna numbers and polarizations (e.g. ‘1’, ‘1_2’, ‘1x_2y’). See tutorial for more examples of valid strings and the behavior of different forms for ant_str. If ‘1x_2y,2y_3y’ is passed, both polarizations ‘xy’ and ‘yy’ will be kept for both baselines (1,2) and (2,3) to return a valid pyuvdata object. An ant_str cannot be passed in addition to any of antenna_nums, antenna_names, bls args or the polarizations parameters, if it is a ValueError will be raised. Ignored if read_data is False.

  • frequencies (array_like of float, optional) – The frequencies to include when reading data into the object, each value passed here should exist in the freq_array. Ignored if read_data is False.

  • freq_chans (array_like of int, optional) – The frequency channel numbers to include when reading data into the object. Ignored if read_data is False.

  • times (array_like of float, optional) – The times to include when reading data into the object, each value passed here should exist in the time_array. Ignored if read_data is False.

  • time_range (list of float, optional) – len-2 list containing min and max range of times in Julian Date to include when reading data into the object. e.g. [2458115.20, 2458115.40] Cannot be set with times.

  • polarizations (array_like of int, optional) – The polarizations numbers to include when reading data into the object, each value passed here should exist in the polarization_array. Ignored if read_data is False.

  • blt_inds (array_like of int, optional) – The baseline-time indices to include when reading data into the object. This is not commonly used. Ignored if read_data is False.

  • keep_all_metadata (bool) – Option to keep all the metadata associated with antennas, even those that do not have data associated with them after the select option.

  • read_metadata (bool) – Option to read in metadata (times, baselines, uvws) as well as basic header info. Only used if file_type is ‘uvfits’ and read_data is False (metadata will be read if data is read). If file_type is ‘uvfits’ and both read_data and read_metadata are false, only basic header info is read in.

  • read_data (bool) – Read in the data. Only used if file_type is ‘uvfits’, ‘miriad’ or ‘uvh5’. If set to False, only the metadata will be read in (for uvfits, this can be further restricted to just the header if read_metadata is False). Setting read_data to False results in an incompletely defined object (check will not pass).

  • phase_type (str, optional) – Option to specify the phasing status of the data. Only used if file_type is ‘miriad’. Options are ‘drift’, ‘phased’ or None. ‘drift’ means the data are zenith drift data, ‘phased’ means the data are phased to a single RA/Dec. Default is None meaning it will be guessed at based on the file contents.

  • correct_lat_lon (bool) – Option to update the latitude and longitude from the known_telescopes list if the altitude is missing. Only used if file_type is ‘miriad’.

  • use_model (bool) – Option to read in the model visibilities rather than the dirty visibilities (the default is False, meaning the dirty visibilities will be read). Only used if file_type is ‘fhd’.

  • data_column (str) – name of CASA data column to read into data_array. Options are: ‘DATA’, ‘MODEL’, or ‘CORRECTED_DATA’. Only used if file_type is ‘ms’.

  • pol_order (str) – Option to specify polarizations order convention, options are ‘CASA’ or ‘AIPS’. Only used if file_type is ‘ms’.

  • data_array_dtype (numpy dtype) – Datatype to store the output data_array as. Must be either np.complex64 (single-precision real and imaginary) or np.complex128 (double- precision real and imaginary). Only used if the datatype of the visibility data on-disk is not ‘c8’ or ‘c16’. Only used if file_type is ‘uvh5’.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after after reading in the file (the default is True, meaning the check will be run). Ignored if read_data is False.

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

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after reading in the file (the default is True, meaning the acceptable range check will be done). Ignored if read_data is False.

get_ants()[source]

Get the unique antennas that have data associated with them.

Returns

ndarray of int – Array of unique antennas with data associated with them.

get_ENU_antpos(center=None, pick_data_ants=False)[source]

Returns antenna positions in ENU (topocentric) coordinates in units of meters.

Parameters
  • center (bool) – If True, subtract median of array position from antpos

  • pick_data_ants (bool) – If True, return only antennas found in data

Returns

  • antpos (ndarray) – Antenna positions in ENU (topocentric) coordinates in units of meters, shape=(Nants, 3)

  • ants (ndarray) – Antenna numbers matching ordering of antpos, shape=(Nants,)

get_baseline_nums()[source]

Get the unique baselines that have data associated with them.

Returns

ndarray of int – Array of unique baselines with data associated with them.

get_antpairs()[source]

Get the unique antpair tuples that have data associated with them.

Returns

list of tuples of int – list of unique antpair tuples (ant1, ant2) with data associated with them.

get_pols()[source]

Get the polarizations in the data.

Returns

list of str – list of polarizations (as strings) in the data.

get_antpairpols()[source]

Get the unique antpair + pol tuples that have data associated with them.

Returns

list of tuples of int – list of unique antpair + pol tuples (ant1, ant2, pol) with data associated with them.

get_feedpols()[source]

Get the unique antenna feed polarizations in the data.

Returns

list of str – list of antenna feed polarizations (e.g. [‘X’, ‘Y’]) in the data.

Raises

ValueError – If any pseudo-Stokes visibilities are present

antpair2ind(ant1, ant2=None, ordered=True)[source]

Get indices along the baseline-time axis for a given antenna pair.

This will search for either the key as specified, or the key and its conjugate.

Parameters
  • ant1, ant2 (int) – Either an antenna-pair key, or key expanded as arguments, e.g. antpair2ind( (10, 20) ) or antpair2ind(10, 20)

  • ordered (bool) – If True, search for antpair as provided, else search for it and it’s conjugate.

Returns

inds (ndarray of int-64) – indices of the antpair along the baseline-time axis.

get_data(key1, key2=None, key3=None, squeeze='default', force_copy=False)[source]

Get the data corresonding to a baseline and/or polarization.

Parameters
  • key1, key2, key3 (int or tuple of ints) – Identifier of which data to get, can be passed as 1, 2, or 3 arguments or as a single tuple of length 1, 2, or 3. These are collectively called the key.

    If key is length 1:
    if (key < 5) or (type(key) is str):

    interpreted as a polarization number/name, get all data for that pol.

    else:

    interpreted as a baseline number, get all data for that baseline.

    if key is length 2: interpreted as an antenna pair, get all data

    for that baseline.

    if key is length 3: interpreted as antenna pair and pol (ant1, ant2, pol),

    get all data for that baseline, pol. pol may be a string or int.

  • squeeze (str) – string specifying how to squeeze the returned array. Options are: ‘default’: squeeze pol and spw dimensions if possible; ‘none’: no squeezing of resulting numpy array; ‘full’: squeeze all length 1 dimensions.

  • force_copy (bool) – Option to explicitly make a copy of the data.

Returns

ndarray – copy (or if possible, a read-only view) of relevant section of data. If data exists conjugate to requested antenna pair, it will be conjugated before returning.

get_flags(key1, key2=None, key3=None, squeeze='default', force_copy=False)[source]

Get the flags corresonding to a baseline and/or polarization.

Parameters
  • key1, key2, key3 (int or tuple of ints) – Identifier of which data to get, can be passed as 1, 2, or 3 arguments or as a single tuple of length 1, 2, or 3. These are collectively called the key.

    If key is length 1:
    if (key < 5) or (type(key) is str):

    interpreted as a polarization number/name, get all flags for that pol.

    else:

    interpreted as a baseline number, get all flags for that baseline.

    if key is length 2: interpreted as an antenna pair, get all flags

    for that baseline.

    if key is length 3: interpreted as antenna pair and pol (ant1, ant2, pol),

    get all flags for that baseline, pol. pol may be a string or int.

  • squeeze (str) – string specifying how to squeeze the returned array. Options are: ‘default’: squeeze pol and spw dimensions if possible; ‘none’: no squeezing of resulting numpy array; ‘full’: squeeze all length 1 dimensions.

  • force_copy (bool) – Option to explicitly make a copy of the data.

Returns

ndarray – copy (or if possible, a read-only view) of relevant section of flags.

get_nsamples(key1, key2=None, key3=None, squeeze='default', force_copy=False)[source]

Get the nsamples corresonding to a baseline and/or polarization.

Parameters
  • key1, key2, key3 (int or tuple of ints) – Identifier of which data to get, can be passed as 1, 2, or 3 arguments or as a single tuple of length 1, 2, or 3. These are collectively called the key.

    If key is length 1:
    if (key < 5) or (type(key) is str):

    interpreted as a polarization number/name, get all nsamples for that pol.

    else:

    interpreted as a baseline number, get all nsamples for that baseline.

    if key is length 2: interpreted as an antenna pair, get all nsamples

    for that baseline.

    if key is length 3: interpreted as antenna pair and pol (ant1, ant2, pol),

    get all nsamples for that baseline, pol. pol may be a string or int.

  • squeeze (str) – string specifying how to squeeze the returned array. Options are: ‘default’: squeeze pol and spw dimensions if possible; ‘none’: no squeezing of resulting numpy array; ‘full’: squeeze all length 1 dimensions.

  • force_copy (bool) – Option to explicitly make a copy of the data.

Returns

ndarray – copy (or if possible, a read-only view) of relevant section of nsample_array.

get_times(key1, key2=None, key3=None)[source]

Get the times for a given antpair or baseline number.

Meant to be used in conjunction with get_data function.

Parameters

key1, key2, key3 (int or tuple of ints) – Identifier of which data to get, can be passed as 1, 2, or 3 arguments or as a single tuple of length 1, 2, or 3. These are collectively called the key.

If key is length 1:
if (key < 5) or (type(key) is str):

interpreted as a polarization number/name, get all times.

else:

interpreted as a baseline number, get all times for that baseline.

if key is length 2: interpreted as an antenna pair, get all times

for that baseline.

if key is length 3: interpreted as antenna pair and pol (ant1, ant2, pol),

get all times for that baseline.

Returns

ndarray – times from the time_array for the given antpair or baseline.

antpairpol_iter(squeeze='default')[source]

Iterator to get the data for each antpair, polarization combination.

Parameters

squeeze (str) – string specifying how to squeeze the returned array. Options are: ‘default’: squeeze pol and spw dimensions if possible; ‘none’: no squeezing of resulting numpy array; ‘full’: squeeze all length 1 dimensions.

Yields
  • key (tuple) – antenna1, antenna2, and polarization string

  • data (ndarray of complex) – data for the ant pair and polarization specified in key

parse_ants(ant_str, print_toggle=False)[source]

Get antpair and polarization from parsing an aipy-style ant string.

Used to support the the select function. Generates two lists of antenna pair tuples and polarization indices based on parsing of the string ant_str. If no valid polarizations (pseudo-Stokes params, or combinations of [lr] or [xy]) or antenna numbers are found in ant_str, ant_pairs_nums and polarizations are returned as None.

Parameters
  • ant_str (str) – String containing antenna information to parse. Can be ‘all’, ‘auto’, ‘cross’, or combinations of antenna numbers and polarization indicators ‘l’ and ‘r’ or ‘x’ and ‘y’. Minus signs can also be used in front of an antenna number or baseline to exclude it from being output in ant_pairs_nums. If ant_str has a minus sign as the first character, ‘all,’ will be appended to the beginning of the string. See the tutorial for examples of valid strings and their behavior.

  • print_toggle (bool) – Boolean for printing parsed baselines for a visual user check.

Returns

  • ant_pairs_nums (list of tuples of int or None) – List of tuples containing the parsed pairs of antenna numbers, or None if ant_str is ‘all’ or a pseudo-Stokes polarizations.

  • polarizations (list of int or None) – List of desired polarizations or None if ant_str does not contain a polarization specification.

get_antenna_redundancies(tol=1.0, include_autos=True, conjugate_bls=False)[source]

Get redundant baselines to a given tolerance from antenna positions.

Finds all possible redundant baselines (antenna pairs) not just those with data.

Parameters
  • tol (float) – Redundancy tolerance in meters (default 1m).

  • include_autos (bool) – Option to include autocorrelations in the full redundancy list.

  • conjugate_bls (bool) – Option to conjugate baselines on this object to the ‘u>0’ convention. Set this to True to ensure that the returned baseline numbers will match the baseline numbers in the data (if they exist in the data).

Returns

  • baseline_groups (list of lists of int) – List of lists of redundant baseline numbers

  • vec_bin_centers (list of ndarray of float) – List of vectors describing redundant group uvw centers

  • lengths (list of float) – List of redundant group baseline lengths in meters

Notes

Note that this method finds all possible redundant baselines in the ‘u>0’ part of the uv plane. In order for the returned baseline numbers to match baselines in this object, this method will conjugate baselines on this object to the ‘u>0’ convention unless no_conjugate is set to True.

get_baseline_redundancies(tol=1.0)[source]

Get baseline redundancies to a given tolerance from uvw_array.

Parameters

tol (float) – Redundancy tolerance in meters, default is 1.0 corresponding to 1 meter.

Returns

  • baseline_groups (list of lists of int) – List of lists of redundant baseline numbers

  • vec_bin_centers (list of ndarray of float) – List of vectors describing redundant group uvw centers

  • lengths (list of float) – List of redundant group baseline lengths in meters

  • baseline_ind_conj (list of int) – List of baselines that are redundant when reversed.

compress_by_redundancy(tol=1.0, inplace=True, metadata_only=False, keep_all_metadata=True)[source]

Downselect to only have one baseline per redundant group on the object.

Uses utility functions to find redundant baselines to the given tolerance, then select on those.

Parameters
  • tol (float) – Redundancy tolerance in meters, default is 1.0 corresponding to 1 meter.

  • inplace (bool) – Option to do selection on current object.

  • metadata_only (bool) – Option to only do the select on the metadata. Not allowed if the data_array, flag_array or nsample_array is not None.

  • keep_all_metadata (bool) – Option to keep all the metadata associated with antennas, even those that do not remain after the select option.

Returns

UVData object or None – if inplace is False, return the compressed UVData object

inflate_by_redundancy(tol=1.0, blt_order='time', blt_minor_order=None)[source]

Expand data to full size, copying data among redundant baselines.

Note that this method conjugates baselines to the ‘u>0’ convention in order to inflate the redundancies.

Parameters
  • tol (float) – Redundancy tolerance in meters, default is 1.0 corresponding to 1 meter.

  • blt_order (str) – string specifying primary order along the blt axis (see reorder_blts)

  • blt_minor_order (str) – string specifying minor order along the blt axis (see reorder_blts)