Coordinates#

class mpol.coordinates.GridCoords(cell_size: float, npix: int)[source]#

The GridCoords object uses desired image dimensions (via the cell_size and npix arguments) to define a corresponding Fourier plane grid.

Parameters:
  • cell_size (float) – width of a single square pixel in [arcsec]

  • npix (int) – number of pixels in the width of the image

:param The Fourier grid is defined over the domain \([-u: :param +u]\): :param \([-v: :param +v]\): :param even: :param though for real images: :param technically we could use an RFFT grid from \([0: :param +u]\) to: :param \([-v: :param +v]\). The reason we opt for a full FFT grid in this instance is: :param implementation simplicity.: :param Images (and their corresponding Fourier transform quantities) are represented as: :param two-dimensional arrays packed as [y: :param x] and [v: :param u]. This means that an: :param image with dimensions (npix: :param npix) will also have a corresponding FFT Fourier: :param grid with shape (npix: :param npix). The native GridCoords: :param representation assumes the Fourier grid (and thus image) are laid out as one might: :param normally expect an image (i.e.: :param no np.fft.fftshift has been applied).: :param After the object is initialized: :param instance variables can be accessed: :param for example: :param >>> myCoords = GridCoords(cell_size=0.005: :param npix=512): :param >>> myCoords.img_ext: :param : [radians] :type : ivar dl: image-plane cell spacing in RA direction (assumed to be positive) :param : :type : ivar dm: image-plane cell spacing in DEC direction [radians] :param : like matplotlib.pyplot.imshow in the extent parameter assuming

origin='lower'. Units of [arcsec]

:type : ivar img_ext: The length-4 list of (left, right, bottom, top) expected by routines :param : [arcseconds]. Useful for directly evaluating some function to create a

packed cube.

:type : ivar packed_x_centers_2D: 2D array of l increasing, with fftshifted applied :param : [arcseconds]. Useful for directly evaluating some function to create a

packed cube.

:type : ivar packed_y_centers_2D: 2D array of m increasing, with fftshifted applied :param : [arcseconds]. l coordinate increases to the left (as on sky). :type : ivar sky_x_centers_2D: 2D array of l arranged for evaluating a sky image :param : [arcseconds]. :type : ivar sky_y_centers_2D: 2D array of m arranged for evaluating a sky image :param : [\(\lambda\)] :type : ivar du: Fourier-plane cell spacing in East-West direction :param : [\(\lambda\)] :type : ivar dv: Fourier-plane cell spacing in North-South direction :param : [\(\lambda\)]. :type : ivar u_centers: 1D array of cell centers in East-West direction :param : [\(\lambda\)]. :type : ivar v_centers: 1D array of cell centers in North-West direction :param : [\(\lambda\)]. :type : ivar u_edges: 1D array of cell edges in East-West direction :param : [\(\lambda\)]. :type : ivar v_edges: 1D array of cell edges in North-South direction :param : :type : ivar u_bin_min: minimum u edge [\(\lambda\)] :param : :type : ivar u_bin_max: maximum u edge [\(\lambda\)] :param : :type : ivar v_bin_min: minimum v edge [\(\lambda\)] :param : :type : ivar v_bin_max: maximum v edge [\(\lambda\)] :param : [\(\lambda\)] :type : ivar max_grid: maximum spatial frequency enclosed by Fourier grid :param : like matplotlib.pyplot.imshow in the extent parameter assuming

origin='lower'. Units of [\(\lambda\)]

:type : ivar vis_ext: length-4 list of (left, right, bottom, top) expected by routines :param : :type : ivar vis_ext_Mlam: like vis_ext, but in units of [\(\mathrm{M}\lambda\)].

check_data_fit(uu: torch.Tensor | npt.NDArray[np.floating[Any]], vv: torch.Tensor | npt.NDArray[np.floating[Any]]) bool[source]#

Test whether loose data visibilities fit within the Fourier grid defined by cell_size and npix.

Parameters:
  • uu (torch.Tensor) – u spatial frequency coordinates. Units of [\(\lambda\)]

  • vv (torch.Tensor) – v spatial frequency coordinates. Units of [\(\lambda\)]

Returns:

True if all visibilities fit within the Fourier grid defined by [u_bin_min, u_bin_max, v_bin_min, v_bin_max]. Otherwise a mpol.exceptions.CellSizeError is raised on the first violated boundary.

Return type:

bool