punchbowl.level3.celestial_intermediary#
Functions#
|
Reproject an image to a bounding-box cutout of an all-sky map. |
|
Aligns one image to the frame of a second, if both are different cutouts of the same all-sky coordinate frame. |
Module Contents#
- punchbowl.level3.celestial_intermediary.to_celestial_frame_cutout(data_cube: ndcube.NDCube, cdelt: float = 0.02) ndcube.NDCube[source]#
Reproject an image to a bounding-box cutout of an all-sky map.
The bounding box of the input image in the celestial frame is found, and that cutout of the all-sky map is returned with the input image reprojected into it. All outputs from this function will be on the same pixel grid (if the same
cdeltvalue is provided), so that different outputs from this function can easily be co-aligned by adding and removing pixel rows and columns (no reprojected needed).Input files must have two image dimensions, and can have arbitrarily-many extra leading dimensions.
The all-sky map used is a plate carrée (CAR) projection. The CRPIX/CRVAL values of the WCSes returned by this function will vary in longitude so that the output frame is approximately centered on the output data, but CRVAL latitude will always be zero (as otherwise the CAR projection no longer has straight lat/lon lines).
The motivation behind this function is to reduce reprojection time and disk space usage when saving a lot of images in celestial coordinates, but still keep the stackability that the output images would have if every image were reprojected into the same all-sky map.
The uncertainty layer of the NDCube is expected to be present and is handled.
- Parameters:
data_cube (NDCube) – The data cube to be reprojected
cdelt (float) – The CDELT value to use for the output projection
- Returns:
reprojected_cube – The cutout of the all-sky map containing the reprojected input data
- Return type:
NDCube
- punchbowl.level3.celestial_intermediary.shift_image_onto(source: ndcube.NDCube, target: ndcube.NDCube, fill_value: float = np.nan) ndcube.NDCube[source]#
Aligns one image to the frame of a second, if both are different cutouts of the same all-sky coordinate frame.
These two input images should be outputs from to_celestial_frame_cutout. Co-aligning the images only requires cropping and padding the first image, since the two images are cutouts of the same pixel grid. This provides the same accuracy (to within ~floating-point error) as reprojecting the first image into the second’s frame, while being incredibly faster.
Input files must have two image dimensions, and can have arbitrarily-many extra leading dimensions.
The uncertainty layer of the NDCube is expected to be present and is handled.
- Parameters:
source (NDCube) – The image to the aligned
target (NDCube) – The image onto which
inputis to be alignedfill_value (float) – The value to be used for empty pixels (pixels of the output frame that aren’t spanned by the input image)
- Returns:
aligned_image – The data of the
inputin the WCS frame oftarget.- Return type:
NDCube