arrakis.utils.fitting
Fitting utilities
Functions
|
Find the best AIC for a set of AICs using Occam's razor. |
|
Calculate chi squared. |
|
A curved power law model. |
|
Perform a power law fit to a spectrum. |
|
Calculate the mean of a distribution. |
|
Calculate the standard deviation of a distribution. |
|
A flat power law model. |
|
A power law model. |
Module Contents
- arrakis.utils.fitting.best_aic_func(aics: numpy.ndarray, n_param: numpy.ndarray) Tuple[float, int, int] [source]
Find the best AIC for a set of AICs using Occam’s razor.
- arrakis.utils.fitting.chi_squared(model: numpy.ndarray, data: numpy.ndarray, error: numpy.ndarray) float [source]
Calculate chi squared.
- Parameters:
model (np.ndarray) – Model flux.
data (np.ndarray) – Data flux.
error (np.ndarray) – Data error.
- Returns:
Chi squared.
- Return type:
np.ndarray
- arrakis.utils.fitting.curved_power_law(nu: numpy.ndarray, norm: float, alpha: float, beta: float, ref_nu: float) numpy.ndarray [source]
A curved power law model.
- Parameters:
nu (np.ndarray) – Frequency array.
norm (float) – Reference flux.
alpha (float) – Spectral index.
beta (float) – Spectral curvature.
ref_nu (float) – Reference frequency.
- Returns:
Model flux.
- Return type:
np.ndarray
- arrakis.utils.fitting.fit_pl(freq: numpy.ndarray, flux: numpy.ndarray, fluxerr: numpy.ndarray, nterms: int) dict [source]
Perform a power law fit to a spectrum.
- Parameters:
freq (np.ndarray) – Frequency array.
flux (np.ndarray) – Flux array.
fluxerr (np.ndarray) – Error array.
nterms (int) – Number of terms to use in the fit.
- Returns:
Best fit parameters.
- Return type:
dict
- arrakis.utils.fitting.fitted_mean(data: numpy.ndarray, axis: int | None = None) float [source]
Calculate the mean of a distribution.
- Parameters:
data (np.ndarray) – Data array.
- Returns:
Mean.
- Return type:
float
- arrakis.utils.fitting.fitted_std(data: numpy.ndarray, axis: int | None = None) float [source]
Calculate the standard deviation of a distribution.
- Parameters:
data (np.ndarray) – Data array.
- Returns:
Standard deviation.
- Return type:
float
- arrakis.utils.fitting.flat_power_law(nu: numpy.ndarray, norm: float, ref_nu: float) numpy.ndarray [source]
A flat power law model.
- Parameters:
nu (np.ndarray) – Frequency array.
norm (float) – Reference flux.
ref_nu (float) – Reference frequency.
- Returns:
Model flux.
- Return type:
np.ndarray
- arrakis.utils.fitting.power_law(nu: numpy.ndarray, norm: float, alpha: float, ref_nu: float) numpy.ndarray [source]
A power law model.
- Parameters:
nu (np.ndarray) – Frequency array.
norm (float) – Reference flux.
alpha (float) – Spectral index.
ref_nu (float) – Reference frequency.
- Returns:
Model flux.
- Return type:
np.ndarray