autolens.Visibilities#

class Visibilities[source]#

Bases: AbstractVisibilities

A collection of (real, imag) visibilities which are used to represent the data in an Interferometer dataset.

The (real, imag) visibilities are stored as a 1D complex NumPy array of shape [total_visibilities]. These can be mapped to a 2D real NumPy array of shape [total_visibilities, 2] and a Grid2DIrregular data structure which is used for plotting the visibilities in 2D in the complex plane.

Calculations should use the NumPy array structure wherever possible for efficient calculations.

The vectors input to this function can have any of the following forms (they will be converted to the 1D complex NumPy array structure and can be converted back using the object’s properties):

[1.0+1.0j, 2.0+2.0j] [[1.0, 1.0], [2.0, 2.0]]

Parameters:

visibilities (Union[ndarray, List[complex]]) – The (real, imag) visibilities values.

__init__(visibilities)#

A collection of (real, imag) visibilities which are used to represent the data in an Interferometer dataset.

The (real, imag) visibilities are stored as a 1D complex NumPy array of shape [total_visibilities]. These can be mapped to a 2D real NumPy array of shape [total_visibilities, 2] and a Grid2DIrregular data structure which is used for plotting the visibilities in 2D in the complex plane.

Calculations should use the NumPy array structure wherever possible for efficient calculations.

The vectors input to this function can have any of the following forms (they will be converted to the 1D complex NumPy array structure and can be converted back using the object’s properties):

[1.0+1.0j, 2.0+2.0j] [[1.0, 1.0], [2.0, 2.0]]

Parameters:

visibilities (Union[ndarray, List[complex]]) – The (real, imag) visibilities values.

Methods

__init__(visibilities)

A collection of (real, imag) visibilities which are used to represent the data in an Interferometer dataset.

all()

astype(*args, **kwargs)

copy()

from_fits(file_path, hdu)

Create Visibilities (see AbstractVisibilities.__new__) by loading the(real, imag) values from a .fits file.

full(fill_value, shape_slim)

Create Visibilities (see AbstractVisibilities.__new__) where all (real, imag) values are filled with an input fill value, analogous to the method numpy ndarray.full.

instance_flatten(instance)

Flatten an instance of an autoarray class into a tuple of its attributes (i.e.. a pytree).

instance_unflatten(aux_data, children)

Unflatten a tuple of attributes (i.e. a pytree) into an instance of an autoarray class.

invert()

max(*args, **kwargs)

min(*args, **kwargs)

ones(shape_slim)

Create Visibilities (see AbstractVisibilities.__new__) where all (real, imag) values are filled with ones, analogous to the method np.ones().

reshape(*args, **kwargs)

sqrt(*args, **kwargs)

sum(*args, **kwargs)

trimmed_after_convolution_from(kernel_shape)

Trim the data structure back to its original shape after PSF convolution has been performed on a padded version of it.

with_new_array(array)

Copy this object but give it a new array.

zeros(shape_slim)

Create Visibilities (see AbstractVisibilities.__new__) where all (real, imag) values are filled with zeros, analogous to the method np.zeros().

Attributes

amplitudes

array

derive_grid

The DeriveGrid2D object of the mask, used to compute derived grids of (y,x) coordinates such as the edge grid, border grid, and full unmasked grid.

derive_indexes

The DeriveIndexes2D object of the mask, used to compute index arrays that map data between the slim (1D unmasked) and native (2D full-shape) representations.

derive_mask

The DeriveMask2D object of the mask, used to compute derived masks such as the edge mask, border mask, and blurring mask.

dtype

geometry

The geometry object of the mask associated with this structure, which defines coordinate conversions between pixel units and scaled units.

header_dict

The FITS header dictionary of the mask associated with this structure, containing pixel scale and origin entries.

imag

in_array

Returns the 1D complex NumPy array of values with shape [total_visibilities] as a NumPy float array of shape [total_visibilities, 2].

in_grid

Returns the 1D complex NumPy array of values as an irregular grid.

is_transformed

mask

native

Returns the data structure in its native format which contains all unmaksed values to the native dimensions.

ndim

origin

The (y,x) scaled units origin of the mask's coordinate system.

phases

pixel_area

The area of a single pixel in scaled units squared (pixel_scales[0] * pixel_scales[1]).

pixel_scale

The pixel scale as a single float value.

pixel_scales

The (y,x) scaled units to pixel units conversion factors of every pixel, as a tuple of floats.

real

scaled_maxima

The maximum values of the visibilities if they are treated as a 2D grid in the complex plane.

scaled_minima

The minimum values of the visibilities if they are treated as a 2D grid in the complex plane.

shape

shape_native

The shape of the data structure in its native representation (e.g. (total_y_pixels, total_x_pixels) for a 2D structure).

shape_slim

The 1D shape of the data structure in its slim representation, equal to the number of unmasked pixels.

size

slim

Returns the data structure in its slim format which flattens all unmasked values to a 1D array.

total_area

The total area of all unmasked pixels in scaled units squared (total_pixels * pixel_area).

total_pixels

The total number of unmasked pixels in the data structure (its slim length).

unmasked_grid

A grid of (y,x) coordinates of every pixel in the full mask shape (including masked pixels), using the mask's geometry to compute each pixel's scaled coordinate.

classmethod full(fill_value, shape_slim)[source]#

Create Visibilities (see AbstractVisibilities.__new__) where all (real, imag) values are filled with an input fill value, analogous to the method numpy ndarray.full.

From 1D input the method cannot determine the 2D shape of the array and its mask, thus the shape_native must be input into this method. The mask is setup as a unmasked Mask2D of shape_native.

Parameters:
  • fill_value (float) – The value all real and imaginary array elements are filled with.

  • shape_slim (Tuple[int]) – The 1D shape of output visibilities.

classmethod ones(shape_slim)[source]#

Create Visibilities (see AbstractVisibilities.__new__) where all (real, imag) values are filled with ones, analogous to the method np.ones().

From 1D input the method cannot determine the 2D shape of the array and its mask, thus the shape_native must be input into this method. The mask is setup as a unmasked Mask2D of shape_native.

Parameters:

shape_slim (Tuple[int]) – The 1D shape of output visibilities.

classmethod zeros(shape_slim)[source]#

Create Visibilities (see AbstractVisibilities.__new__) where all (real, imag) values are filled with zeros, analogous to the method np.zeros().

From 1D input the method cannot determine the 2D shape of the array and its mask, thus the shape_native must be input into this method. The mask is setup as a unmasked Mask2D of shape_native.

Parameters:

shape_slim (Tuple[int]) – The 1D shape of output visibilities.

classmethod from_fits(file_path, hdu)[source]#

Create Visibilities (see AbstractVisibilities.__new__) by loading the(real, imag) values from a .fits file.

The .fits file stores these values as a real set of values of shape [total_visibilities, 2] which are converted to a 1d complex NumPy array.

Parameters:
  • file_path (Union[Path, str]) – The path the file is loaded from, including the filename and the .fits extension, e.g. ‘/path/to/filename.fits’

  • hdu (int) – The Header-Data Unit of the .fits file the visibility data is loaded from.