punchbowl.level2.resample#

Functions#

reproject_cube(→ numpy.ndarray)

Core reprojection function.

reproject_many_flow(→ list[ndcube.NDCube | None])

Reproject many flow.

find_central_pixel(→ list[tuple[float, float]])

Find the location of the central pixel of each cube in the mosaic frame.

Module Contents#

punchbowl.level2.resample.reproject_cube(input_cube: ndcube.NDCube, output_wcs: astropy.wcs.WCS, output_shape: tuple[int, int], rolloff_strength: float | list[float] = 1, rolloff_width: float | list[float] = 0.25, do_uncertainty: bool = True, repro_args: dict | None = None) numpy.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

  • 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)
punchbowl.level2.resample.reproject_many_flow(data: list[ndcube.NDCube | None], trefoil_wcs: astropy.wcs.WCS, trefoil_shape: numpy.ndarray, rolloff_strength: float | list[float] = 1, rolloff_width: float | list[float] = 0.25) list[ndcube.NDCube | None][source]#

Reproject many flow.

punchbowl.level2.resample.find_central_pixel(data_list: list[ndcube.NDCube | None], trefoil_wcs: astropy.wcs.WCS) list[tuple[float, float]][source]#

Find the location of the central pixel of each cube in the mosaic frame.

Parameters:
  • data_list – A list of data cubes

  • trefoil_wcs – The mosaic frame

Returns:

The (x, y) center of each data cube in the mosaic frame. Contains None wherever the input cube was None.

Return type:

centers