Image Resampling#
To later merge each individual PUNCH spacecraft observation into a unified virtual observatory later in the pipeline, first each observation must be reprojected into a standardized frame.
Concept#
Each observation contains a corresponding World Coordinate System (WCS), describing the physical coordinates of each pixel in the data. With an output WCS defined for the full PUNCH field of view observation, the AstroPy reproject package can be used to transform the data from the spacecraft frame into the full mosaic frame.
Note that here we use the adaptive reprojection methodology based on a DeForest (2004) algorithm - better preserving structure and photometry.
Applying correction#
Image resampling is carried out in the punchbowl.level2.resmaple.reproject_cube function:
- punchbowl.level2.resample.reproject_cube(input_cube: NDCube, output_wcs: WCS, output_shape: tuple[int, int], rolloff_strength: float | list[float] = 1, rolloff_width: float | list[float] = 0.25, do_uncertainty: bool = True, output_array: ndarray | None = None, repro_args: dict | None = None) ndarray[source]
Core reprojection function.
- Core reprojection function of the PUNCH mosaic generation module.
With an input data array and corresponding WCS object, the function performs a reprojection into the output WCS object system, along with a specified pixel size for the output array. This utilizes the adaptive reprojection routine implemented in the reprojection astropy package.
- Parameters:
input_cube (NDCube) – input cube to be reprojected
output_wcs – astropy WCS object describing the coordinate system to transform to
output_shape – pixel shape of the reprojected output array
rolloff_width (float | list[float]) – Image uncertainties are enhanced at the edges, to provide a smooth rolloff in merging. This controls the width of that rolloff. The rolloff width will be this number, times the shortest distance from image-center to image-mask-edge. A list can be provided to give one value for each spacecraft. Has no effect if do_uncertainties is False.
rolloff_strength (float | list[float]) – Image uncertainties are enhanced at the edges, to provide a smooth rolloff in merging. This controls the strength of that rolloff. Merging weights at the mask edge will be reduced by this fractional amount. A strength of zero means no rolloff. A list can be provided to give one value for each spacecraft. Has no effect if do_uncertainties is False.
do_uncertainty (bool) – Whether to reproject the uncertainty layer as well and return a 2 x ny x nx array
output_array (np.ndarray) – Optional, a destination in which to put the output data.
repro_args (dict) – Additional kwargs to pass to the reproject call
- Returns:
output array after reprojection of the input array
- Return type:
np.ndarray
Example Call#
>>> reprojected_arrays = reproject_cube(input_cube, output_wcs, output_shape)
If you wish to incorporate this as a Prefect task in a custom pipeline,
using something like the punchbowl.level2.resmaple.reproject_many_flow is recommended.