4.24. fits_crop¶
Crops the data of the Fits object.
- Fits.crop(x: int, y: int, width: int, height: int, output: str | None = None, override: bool = False) Self¶
Crops the data of the
Fitsobject.Parameters
- x (
int): The x-coordinate of the top-left corner of the crop area.
- x (
- y (
int): The y-coordinate of the top-left corner of the crop area.
- y (
- width (
int): The width of the cropped image.
- width (
- height (
int): The height of the cropped image.
- height (
- output (
str, optional): Path of the new fits file where the cropped data will be saved.
- output (
- override (
bool, default=False): If
True, will overwrite the output if a file with the same name already exists.
- override (
Returns
FitsA cropped
Fitsobject.
Raises
- IndexError
When the data is empty after cropping.
4.24.1. Example:¶
from myraflib import Fits
fits = Fits.sample()
cropped_fits = Fits.crop(100, 100, 200, 200)