cube_cut

astrocut.cube_cut(cube_file: Union[str, Path, S3Path], coordinates: Union[SkyCoord, str], cutout_size: Union[int, ndarray, Quantity, List[int], Tuple[int]], product: str = 'SPOC', target_pixel_file: Optional[str] = None, output_path: Union[str, Path] = '.', memory_only: bool = False, threads: Union[int, Literal['auto']] = 1, verbose: bool = False)[source]

Takes a cube file (as created by CubeFactory), and makes a cutout target pixel file of the given size around the given coordinates. The target pixel file is formatted like a TESS pipeline target pixel file.

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

Parameters
cube_filestr

The cube file containing all the images to be cutout. Must be in the format returned by ~astrocut.make_cube.

coordinatesstr or astropy.coordinates.SkyCoord object

The position around which to cutout. It may be specified as a string (“ra dec” in degrees) or as the appropriate SkyCoord object.

cutout_sizeint, array-like, Quantity

The size of the cutout array. If cutout_size is a scalar number or a scalar Quantity, then a square cutout of cutout_size will be created. If cutout_size has two elements, they should be in (ny, nx) order. Scalar numbers in cutout_size are assumed to be in units of pixels. Quantity objects must be in pixel or angular units.

productstr

The product type to make the cutouts from. Can either be ‘SPOC’ or ‘TICA’ (default is ‘SPOC’).

target_pixel_filestr

Optional. The name for the output target pixel file. If no name is supplied, the file will be named: <cube_file_base>_<ra>_<dec>_<cutout_size>_astrocut.fits

output_pathstr

Optional. The path where the output file is saved. The current directory is default.

memory_onlybool

Optional. If true, the cutout is made in memory only and not saved to disk. Default is False.

threadsint, “auto”, default=1

Number of threads to use when making remote (e.g. s3) cutouts, will not use threads for local access <=1 disables the threadpool, >1 sets threadpool to the specified number of threads, “auto” uses concurrent.futures.ThreadPoolExecutor’s default: cpu_count + 4, limit to max of 32

verbosebool

Optional. If true intermediate information is printed.

Returns
response: string or HDUList or None

If successful, returns the target pixel file as an HDUList object, or the path to the target pixel file if saved to disk. If unsuccessful, returns None.