asdf_cut

astrocut.asdf_cut(input_files: List[Union[str, Path, S3Path]], ra: float, dec: float, cutout_size: int = 25, output_file: Union[str, Path] = 'example_roman_cutout.fits', write_file: bool = True, fill_value: Union[int, float] = nan, output_dir: Union[str, Path] = '.', output_format: str = '.asdf', key: str = None, secret: str = None, token: str = None, lite: bool = False, verbose: bool = False) Cutout2D[source]

Takes one of more ASDF input files (input_files) and generates a cutout of designated size cutout_size around the given coordinates (coordinates). The cutout is written to a file or returned as an object.

This function is maintained for backwards compatibility. For maximum flexibility, we recommend using the ASDFCutout class directly.

Parameters
input_filestr | Path | S3Path

The input ASDF file.

rafloat

The right ascension of the central cutout.

decfloat

The declination of the central cutout.

cutout_sizeint

Optional, default 25. The image cutout pixel size. Note: Odd values for cutout_size generally result in a cutout that is more accurately centered on the target coordinates compared to even values, due to the symmetry of the pixel grid.

output_filestr | Path

Optional, default “example_roman_cutout.fits”. The name of the output cutout file. This parameter is deprecated and will be removed in a future version.

write_filebool

Optional, default True. Flag to write the cutout to a file or not.

fill_value: int | float

Optional, default np.nan. The fill value for pixels outside the original image.

output_dirstr | Path

Optional, default “.”. The directory to write the cutout file(s) to.

output_formatstr

Optional, default “.asdf”. The format of the output cutout file. If write_file is False, then cutouts will be returned as asdf.AsdfFile objects if output_format is “.asdf” or as astropy.io.fits.HDUList objects if output_format is “.fits”.

keystring

Default None. Access key ID for S3 file system. Only applicable if input_file is a cloud resource.

secretstring

Default None. Secret access key for S3 file system. Only applicable if input_file is a cloud resource.

tokenstring

Default None. Security token for S3 file system. Only applicable if input_file is a cloud resource.

litebool

Optional, default False. By default, the class creates cutouts of all arrays in the input file (e.g., data, error, uncertainty, variance, etc.) where the last two dimensions match the shape of the science data array. It also preserves all of the metadata from the input file.

If this parameter is True, the cutout will be created in “lite” mode, which means that it will only contain the data and an updated world coordinate system.

verbosebool

Default False. If True, intermediate information is printed.

Returns
responsestr | list

A list of cutout file paths if write_file is True, otherwise a list of cutout objects.