UVCal Class¶
UVCal is the main user class for calibration solutions. It provides import and export functionality to all supported file formats (calfits) and can be interacted with directly.
-
class
pyuvdata.
UVCal
[source]¶ A class defining calibration solutions
Currently supported file types: calfits
-
UVParameter objects
For full list see UVCal Parameters (http://pyuvdata.readthedocs.io/en/latest/uvcal.html). Some are always required, some are required for certain cal_types and others are always optional.
-
check
(check_extra=True, run_check_acceptability=True)[source]¶ Check that all required parameters are set reasonably.
Check that required parameters exist and have appropriate shapes. Optionally check if the values are acceptable.
- Parameters
run_check_acceptability – Option to check if values in required parameters are acceptable. Default is True.
-
select
(antenna_nums=None, antenna_names=None, frequencies=None, freq_chans=None, times=None, jones=None, run_check=True, check_extra=True, run_check_acceptability=True, inplace=True)[source]¶ Select specific antennas, frequencies, times and jones polarization terms to keep in the object while discarding others.
The history attribute on the object will be updated to identify the operations performed.
- Parameters
antenna_nums – 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 – 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 – The frequencies to keep in the object.
freq_chans – The frequency channel numbers to keep in the object.
times – The times to keep in the object.
jones – The jones polarization terms to keep in the object.
run_check – Option to check for the existence and proper shapes of required parameters after downselecting data on this object. Default is True.
check_extra – Option to check shapes and types of optional parameters as well as required ones. Default is True.
run_check_acceptability – Option to check acceptable range of the values of required parameters after downselecting data on this object. Default is True.
inplace – Option to perform the select directly on self (True, default) or return a new UVCal object, which is a subselection of self (False)
-
convert_to_gain
(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 – exponent sign to use in the conversion. Defaults to minus.
run_check – Option to check for the existence and proper shapes of parameters after converting this object. Default is True.
check_extra – Option to check shapes and types of optional parameters as well as required ones. Default is True.
run_check_acceptability – Option to check acceptable range of the values of parameters after converting this object. Default is True.
-
get_gains
(ant, jpol=None)[source]¶ Get the gain associated with an antenna and/or polarization.
- Parameters
ant (int) – Antenna integer to request
jpol (int or str, optional) – Instrumental polarization to request. Ex. ‘Jxx’
- Returns
complex ndarray – Gain solution of shape (Nfreqs, Ntimes) or (Nfreqs, Ntimes, Npol) if Njones > 1 and jpol is not fed.
-
get_flags
(ant, jpol=None)[source]¶ Get the flags associated with an antenna and/or polarization.
- Parameters
ant (int) – Antenna integer to request
jpol (int or str, optional) – Instrumental polarization to request. Ex. ‘Jxx’
- Returns
boolean ndarray – Flags of shape (Nfreqs, Ntimes) or (Nfreqs, Ntimes, Npol) if Njones > 1 and jpol is not fed.
-
get_quality
(ant, jpol=None)[source]¶ Get the qualities associated with an antenna and/or polarization.
- Parameters
ant (int) – Antenna integer to request
jpol (int or str, optional) – Instrumental polarization to request. Ex. ‘Jxx’
- Returns
float ndarray – Qualities of shape (Nfreqs, Ntimes) or (Nfreqs, Ntimes, Npol) if Njones > 1 and jpol is not fed.
-
ant2ind
(antnum)[source]¶ Given antenna number return its index in data arrays
- Parameters
antnum (int) – Antenna number
- Returns
int – Index in data arrays
-
jpol2ind
(jpol)[source]¶ Given a jones polarization, return its index in data arrays
- Parameters
jpol (int or str) – Jones polarization
- Returns
int – Index in data arrays
-
read_calfits
(filename, run_check=True, check_extra=True, run_check_acceptability=True)[source]¶ Read in data from a calfits file.
- Parameters
filename – The calfits file or list of files to read from. string path, or list or tuple of string paths.
run_check – Option to check for the existence and proper shapes of parameters after reading in the file. Default is True.
check_extra – Option to check optional parameters as well as required ones. Default is True.
run_check_acceptability – Option to check acceptable range of the values of parameters after reading in the file. Default is True.
-
write_calfits
(filename, run_check=True, check_extra=True, run_check_acceptability=True, clobber=False)[source]¶ Write data to a calfits file.
- Parameters
filename – The calfits filename to write to.
run_check – Option to check for the existence and proper shapes of parameters before writing the file. Default is True.
check_extra – Option to check optional parameters as well as required ones. Default is True.
run_check_acceptability – Option to check acceptable range of the values of parameters before writing the file. Default is True.
clobber – Option to overwrite the filename if the file already exists. Default is False.
-
read_fhd_cal
(cal_file, obs_file, settings_file=None, raw=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 – The cal.sav file to read from.
obs_file – The obs.sav file to read from.
settings_file – The settings_file to read from. Optional, but very useful for provenance.
raw – 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).
extra_history – Optional string or list of strings to add to the object’s history parameter. Default is None.
run_check – Option to check for the existence and proper shapes of parameters after reading in the file. Default is True.
check_extra – Option to check optional parameters as well as required ones. Default is True.
run_check_acceptability – Option to check acceptable range of the values of parameters after reading in the file. Default is True.
-