distroi.auxiliary.beam module#

A module to calculate the resolution beam from the uv coverage.

Models the OI point spread function (PSF, i.e. ‘dirty beam’) with a Gaussian fit to the inner image regions called the (clean) beam.

class distroi.auxiliary.beam.Beam(dictionary)#

Bases: object

Represents a 2D elliptical Gaussian beam.

Class containing information for a 2D Gaussian beam, typically acquired from a fit to the inner regions of a dirty beam (the formal interferometric PSF).

Parameters:

dictionary (dict) – Dictionary containing keys and values representing several instance variables described below. Should include ‘sig_min’, ‘sig_maj’ and ‘pa’.

sig_min#

Standard deviation of the Gaussian along the minor axis.

Type:

float

sig_maj#

Standard deviation of the Gaussian along the major axis.

Type:

float

pa#

Position angle of the Gaussian’s major axis, anticlockwise from North to East.

Type:

float

fwhm_min#

Full-width-half-maximum (FWHM) of the Gaussian along the minor axis. This defines the resolution corresponding to the uv coverage along this axis.

Type:

float

fwhm_maj#

FWHM of the Gaussian along the major axis. This defines the resolution corresponding to the uv coverage along this axis.

Type:

float

plot() None#

Image plot of the beam.

Makes a colour image plot of the Beam, including contours representing the sigma/FWHM levels.

distroi.auxiliary.beam.oi_container_calc_gaussian_beam(container: OIContainer, vistype: Literal['vis2', 'vis'] = 'vis2', make_plots: bool = False, fig_dir: str | None = None, show_plots: bool = False, num_res: int = 3, pix_per_res: int = 32, save_dirty_img_dict: bool = False, dirty_img_dict_path: str = './dirty_img.pkl', save_uv_coverage_dict: bool = False, uv_coverage_dict_path: str = './uv_coverage.pkl') Beam#

Calculate the beam from an OIContainer object.

Given an OIContainer instance and the uv frequencies to be used, calculates the clean beam Gaussian parameters by making a Gaussian fit to the dirty beam. The dirty beam acts as the interferometric point spread funtion (PSF) corresponding to the chosen uv coverage, by setting visibilities constant at the observed uv points and inverting the Fourier transform directly to the image plane.

Parameters:
  • container (OIContainer) – Container with observables for which we want to calculate the resolution corresponding to its uv coverage.

  • vistype ({'vis2', 'vis', 'fcorr'}, optional) – Sets the uv coverage to be used for the Gaussian beam calculation. ‘vis2’ for the coverage corresponding to the squared visibility measurements or ‘vis’ for the uv coverage corresponding to the visibility/correlated flux measurements.

  • make_plots (bool, optional) – Set to True to make plots of the dirty beam.

  • fig_dir (str, optional) – Set to a directory in which you want the plots to be saved.

  • show_plots (bool, optional) – Set to True if you want the generated plots to be shown in a window.

  • num_res (int, optional) – The number of resolution elements to be included in the calculation. A resolution element is defined as 1 / (2 x ‘max_uv’), with max_uv the maximum norm of the probed uv frequency points. Set to 2 by default. Going above this can skew the Gaussian fit or cause it to fail, as the non-Gaussian behavior of the PSF becomes more apparent further away from the dirty beam center. It will also increase calculation time as O(n^2).

  • pix_per_res (int, optional) – Amount of dirty beam pixels used per resolution element. This should be even. Set to 32 by default. Increasing this can significantly increase computation time (scales as O(n^2)).

  • save_dirty_img_dict (bool, optional) – Save dirty beam to pickled dictionary file in order to be read in and plotted. Contains keys image, xcoords and ycoords, containing the image and sky coordinates as 2D numpy arrays. Additionally, contains number of pixels and pixelscale as num_pix and pixelscale.

  • dirty_img_dict_path (str, optional) – Path to file to save pickled dirty image dictionary in. Recommended to save with .pkl file extension.

Returns:

gauss_beamBeam object containing the information of the Gaussian fit.

Return type:

Beam

Raises:

ValueError – If an invalid vistype is provided or if pix_per_res is not even.