reproject_image#
- niriss_tools.isophotal.reproject_image(input_path, output_path, output_wcs, output_shape, input_hdu_index=0, method='adaptive', conserve_flux=True, compress=True, overwrite=False, prefix='repr_', preliminary_buffer=250, **reproject_kwargs)[source]#
Reproject an image to a new WCS.
A wrapper around
reproject, for file handling and default parameters. Ifreproject_adaptiveis used as the method, the flux is conserved by default (conserve_flux=True). For other methods, the input is assumed to be in surface brightness units.- Parameters:
- input_path
PathLike The path of the original image.
- output_path
PathLike The path of the output file. If a directory is passed, the output filename will be the same as the input, with the addition of
prefix.- output_wcs
WCS The new WCS onto which the image will be reprojected.
- output_shape
tuple[int,int] The shape of the reprojected image.
- input_hdu_index
int, optional The index of the HDU containing the input image, by default 0.
- method{“interp”, “adaptive”, “exact”}
The reprojection method to use, by default
"adaptive".- conserve_fluxbool, optional
If True (default), the input flux will be conserved. This will only work if
method="adaptive".- compressbool, optional
If True (default), the output file will be compressed and saved with the extension “.fits.gz”.
- overwritebool, optional
Overwrite the file if it exists already, by default False.
- prefix
str, optional The string to prepend to the output filename, by default
"repr_". Only used ifoutput_pathis a directory.- preliminary_buffer
int|None, optional For very large images, perform a rough initial crop, padded by
preliminary_buffer, before the full reprojection. By default, this is set to 250 pixels.- **reproject_kwargs
dict, optional Additional keyword arguments to pass to the reproject function.
- input_path
- Returns:
PathLikeThe path of the reprojected image.
- Raises:
ValueErrorAn error will be raised if the
methodargument is not valid.
Notes
To reproject a segmentation map, call this function with
method=interpandorder="nearest-neighbour".