MulensModel.fit module¶
-
class
MulensModel.fit.Fit(data=None, magnification=None, n_sources=None)¶ Bases:
objectFits source and blending fluxes for given data and model magnification.
- Keywords :
- data:
MulensDataor list ofMulensData - Photometric data to be fitted.
- magnification: np.ndarray or list of np.ndarrays
- Model magnification.
- n_sources: int
- The number of microlensing sources. It’s suggested not to use this option now.
- data:
-
fit_fluxes(fit_blending=True)¶ Fit source(s) and blending fluxes. Performs a least squares linear fit (np.linalg.lstsq()) to the data for the flux parameters. I.e., given the data \(y\) and magnification \(A\), solves for \(f_{source}\) and \(f_{blend}\):
\[y = f_{source} * A + f_{blend}\]- Parameters :
- fit_blending: boolean, optional
- Do you want the blending to be fitted (True) or to be fixed at 0 (False)? Default is True
-
flux_of_sources(dataset)¶ Fluxes of source(s).
- Parameters :
- dataset:
MulensData - A dataset for which source fluxes will be given.
- dataset:
- Returns :
- source_fluxes: np.ndarray
- Fluxes of sources in units where 1 corresponds to 22 mag. The number of array elements is the same as number of sources.
-
blending_flux(dataset)¶ Blending flux for given dataset.
- Parameters :
- dataset:
MulensData - A dataset for which blending flux will be given.
- dataset:
- Returns :
- blending_flux: np.float64
- Blending flux in units where 1 corresponds to 22 mag.
-
get_flux(data)¶ Microlensing model in flux units.
- Parameters :
- data:
MulensData - A dataset for which model will be returned.
- data:
- Returns :
- flux: np.ndarray
- Microlensing model in flux units.
-
get_input_format(data=None)¶ Microlensing model in the same format as given dataset. The output is either in flux units or magnitudes, depending on format of the input data.
- Parameters :
- data:
MulensData - A dataset for which model will be returned.
- data:
- Returns :
- model: np.ndarray
- Microlensing model in flux units or magnitudes (depending on the format of input data).
-
get_chi2_format(data)¶ Microlensing model in the format used for chi^2 calculation. The output is in flux space in most cases, but can be in magnitudes depending on dataset format.
- Parameters :
- data:
MulensData - A dataset for which model will be returned.
- data:
- Returns :
- model: np.ndarray
- Microlensing model in flux units or magnitudes (depending on the settings of input data).
-
get_n_sources()¶ Count sources.
- Returns :
- n_sources: int
- Number of sources in input data.