Coordinates#
- class mpol.coordinates.GridCoords(cell_size: float, npix: int)[source]#
The GridCoords object uses desired image dimensions (via the
cell_sizeandnpixarguments) 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
Notes
The Fourier grid is defined over the domain \([-u,+u]\), \([-v,+v]\), even though for real images, technically we could use an RFFT grid from \([0,+u]\) to \([-v,+v]\). The reason we opt for a full FFT grid in this instance is implementation simplicity.
Images (and their corresponding Fourier transform quantities) are represented as two-dimensional arrays packed as
[y, x]and[v, u]. This means that an image with dimensions(npix, npix)will also have a corresponding FFT Fourier grid with shape(npix, npix). The nativeGridCoordsrepresentation assumes the Fourier grid (and thus image) are laid out as one might normally expect an image (i.e., nonp.fft.fftshifthas been applied).After the object is initialized, any of the instance variables listed below can be accessed. For example,
>>> myCoords = GridCoords(cell_size=0.005, npix=512) >>> myCoords.img_ext
- dl#
image-plane cell spacing in RA direction (assumed to be positive) [radians]
- Type:
float
- dm#
image-plane cell spacing in DEC direction [radians]
- Type:
float
- img_ext#
The length-4 list of (left, right, bottom, top) expected by routines like
matplotlib.pyplot.imshowin theextentparameter assumingorigin='lower'. Units of [arcsec]- Type:
list
- packed_x_centers_2D[source]#
2D array of l increasing, with fftshifted applied [arcseconds]. Useful for directly evaluating some function to create a packed cube.
- Type:
numpy.ndarray
- packed_y_centers_2D[source]#
2D array of m increasing, with fftshifted applied [arcseconds]. Useful for directly evaluating some function to create a packed cube.
- Type:
numpy.ndarray
- sky_x_centers_2D#
2D array of l arranged for evaluating a sky image [arcseconds]. l coordinate increases to the left (as on sky).
- Type:
numpy.ndarray
- sky_y_centers_2D#
2D array of m arranged for evaluating a sky image [arcseconds].
- Type:
numpy.ndarray
- du#
Fourier-plane cell spacing in East-West direction [\(\lambda\)]
- Type:
float
- dv#
Fourier-plane cell spacing in North-South direction [\(\lambda\)]
- Type:
float
- u_centers#
1D array of cell centers in East-West direction [\(\lambda\)].
- Type:
numpy.ndarray
- v_centers#
1D array of cell centers in North-West direction [\(\lambda\)].
- Type:
numpy.ndarray
- u_edges#
1D array of cell edges in East-West direction [\(\lambda\)].
- Type:
numpy.ndarray
- v_edges#
1D array of cell edges in North-South direction [\(\lambda\)].
- Type:
numpy.ndarray
- u_bin_min#
minimum u edge [\(\lambda\)]
- Type:
float
- u_bin_max#
maximum u edge [\(\lambda\)]
- Type:
float
- v_bin_min#
minimum v edge [\(\lambda\)]
- Type:
float
- v_bin_max#
maximum v edge [\(\lambda\)]
- Type:
float
- max_grid#
maximum spatial frequency enclosed by Fourier grid [\(\lambda\)]
- Type:
float
- vis_ext#
length-4 list of (left, right, bottom, top) expected by routines like
matplotlib.pyplot.imshowin theextentparameter assumingorigin='lower'. Units of [\(\lambda\)]- Type:
list
- vis_ext_Mlam#
like vis_ext, but in units of [\(\mathrm{M}\lambda\)].
- Type:
list
- 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:
Trueif all visibilities fit within the Fourier grid defined by[u_bin_min, u_bin_max, v_bin_min, v_bin_max]. Otherwise ampol.exceptions.CellSizeErroris raised on the first violated boundary.- Return type:
bool