WCS & FITS#
Headers, coordinates, cropping, and reprojection helpers.
Headers#
A stateful wrapper around an |
|
Return |
|
Write a header to a portable plain-text |
|
Load an |
|
A simple function to take in a header and remove items related to 3D or 4D structure -- such as NAXIS3... |
|
Return copy of header with all 4th-axis cards removed (NAXIS=3). |
|
Helper function to force various header values to floats. |
|
Function to make a new 'simple header' from the WCS information in the input header. |
|
Squeeze a FITS image to 2D, cleaning up the header to match. |
|
Add HISTORY / COMMENT cards noting that a FITS file was created with multicolorfits (version, timestamp, optional per-layer settings). |
Coordinates#
Converts sexagesimal coordinates to decimal. |
|
Converts decimal coordinates to sexagesimal. |
|
Convert decimal degrees to DMS components. |
|
Convert DMS string ('dd:mm:ss.s') or [d, m, s] list to decimal degrees. |
|
Convert decimal degrees to [hours, minutes, seconds] list. |
|
Convert HMS string ('hh:mm:ss.s') or [h, m, s] list to decimal degrees. |
|
Angular distance between two sky positions using the Vincenty formula. |
|
Helper function to convert sky coordinates to pixel coordinates. |
|
Helper function to convert pixel coordinates to sky coordinates. |
|
Per-pixel world (lon/lat) coordinates for an image grid. |
|
Function to calculate CDELT1 and CDELT2 from the input header PCx_x cards. |
|
Calculate the CDn_m matrix from CDELTS and CROTA/CROTA2 |
|
Calculates degrees per pixel side. |
|
Calculates arcseconds per pixel side. |
|
Calculates steradians per pixel. |
|
Returns beam parameters [BMAJ (arcsec), BMIN (arcsec), BPA (deg)] from input header |
|
Calculates the number of pixels per beam from the beam parameters (BMAJ,BMIN) in the header. |
Crop & reproject#
Function to crop a 2D fits image to the specified pixel bounds. |
|
Function to crop a 2D fits image based on sky coordinates and specified width. |
|
Function to crop a 3D fits cube to the specified pixel bounds. |
|
Function to crop a 3D fits cube based on sky coordinates and specified width. |
|
Function that reprojects a 2D map from the parameters in one header to the parameters in another header. |
|
Reproject a 3D cube from one WCS header onto another, plane by plane. |
|
Determine the celestial frame of a FITS header, as an astropy frame name. |
|
Build a new 2D header in a different celestial frame, covering the same sky area as the input header with the same pixel scale, with the new frame's north axis up (no rotation). |
|
Reproject a 2D image into a different celestial frame (e.g. Galactic), with the new frame's north up. |
|
Convenience alias for reproject_to_frame(..., frame='galactic'). |
|
Compute an optimal common header covering a set of images, using reproject.mosaicking.find_optimal_celestial_wcs. |
For long spectral cubes, reproject_cube() accepts
print_progress=True (drives draw_progress_bar()).
See that helper’s docstring for a tqdm alternative if you prefer wrapping
the per-plane loop yourself.