4.25. fits_bin¶
Bins the data of the Fits object.
- Fits.bin(binning_factor: int | List[int], func: Callable[[Any], float] = np.mean, output: str | None = None, override: bool = False) Self¶
Bins the data of the
Fitsobject.Parameters
- binning_factor (
Union[int, List[int]]): The binning factor to reduce the data.
- binning_factor (
- func (
Callable[[Any], float], default:np.mean): The function to be applied to the binned data (e.g.,
np.mean,np.sum, etc.).
- func (
- output (
str, optional): Path of the new fits file where the binned 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 binned
Fitsobject.
Raises
- ValueError
When the
binning_factoris invalid.
- ValueError
When the
binning_factoris too large for the data dimensions.
4.25.1. Example:¶
from myraflib import Fits
fits = Fits.sample()
binned_fits = Fits.bin(10)