4.10. sub¶
Performs a subtraction operation on the Fits object.
- Fits.sub(other, output=None, override=False) Self¶
Performs a subtraction operation on the
Fitsobject.Notes
This method can subtract numeric values or another
Fitsobject.If
otheris numeric, each element of the matrix will be subtracted by that number.If other is another
Fitsobject, element-wise subtraction will be performed.
Parameters
otherUnion[Self, float, int]Either a
Fitsobject, a float, or an integer.outputOptional[str]New path to save the resulting file.
overridebool, optional, default=FalseIf
True, will overwrite theoutputpath if a file already exists.
Returns
FitsA new
Fitsobject representing the result of the subtraction.
Raises
FileExistsErrorIf the file already exists and
overrideisFalse.
4.10.1. Example:¶
from myraflib import Fits
fits = Fits.sample()
other = Fits.sample()
new_fits_1 = fits.sub(120)
new_fits_2 = fits - 120
new_fits_3 = fits.sub(other)
new_fits_4 = fits - other