5.14. mul¶
Performs multiplication on the FitsArray object.
- FitsArray.mul(self, other: Self | Fits | float | int | List[Fits | float | int], output: str | None = None) Self¶
Performs multiplication on the
FitsArrayobject.Notes
This method can multiply numeric values, other
Fitsobjects, or lists of numeric values orFitsArrayobjects.If
otheris numeric, each element of the matrix will be multiplied by that number.If
otheris anotherFitsobject, element-wise multiplication will be performed.If
otheris a list of numeric values, the first value will be applied to each matrix. The number of elements in the list must equal the number of elements in theFitsArray.If
otheris anotherFitsArray, element-wise multiplication will be applied. The number of elements in bothFitsArrayobjects must be equal.
Parameters
otherUnion[Self, Fits, float, int, List[Union[Fits, float, int]]]Either a
FitsArrayobject, list of floats, list of integers,Fitsobject, float, or integer.outputOptional[str]New path to save the files.
Returns
FitsArrayA new
FitsArrayobject containing the saved FITS files.
Raises
NumberOfElementErrorRaised when the length of
otheris incorrect.
5.14.1. Example:¶
from myraflib import FitsArray, Fits
fa = FitsArray.sample()
fa_2 = FitsArray.sample()
fits = Fits.sample()
multiplied_fa_1 = fa.mul(10)
multiplied_fa_2 = fa.mul(fits)
multiplied_fa_3 = fa.mul([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
multiplied_fa_4 = fa.mul([Fits.sample() for _ in range(10)])
multiplied_fa_5 = fa.mul(fa_2)
multiplied_fa_6 = fa * 10
multiplied_fa_7 = fa * fits
multiplied_fa_8 = fa * [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
multiplied_fa_9 = fa * [Fits.sample() for _ in range(10)]
multiplied_fa_10 = fa * fa_2