stats
¶
-
class
aims3.stats.
Likelihood
(obs, sigma)¶ An object to setup and evaluate a likelihood function for fitting models to observations.
Calling the object evaluates the likelihood, i.e. –χ²/2.
-
chi2
(model, a=None)¶ Return χ² of the given
model
using surface correction parametersa
.
-
chi2_seismic
(model, a=None)¶ Return the seismic χ² of the given
model
using surface correction parametersa
.
-
chi2_nonseismic
(model)¶ Return the non-seismic χ² of the given
model
.
-
extend_frequency_function
(names, num_rows, den_rows=None)¶ A utility function to extend the frequency function by appending the
names
of the new components, their numerator matrixnum_rows
and, if present, denominator matrixden_rows
.
-
setup_frequency_function
(function_names=[])¶ Set up the frequency function using the list of options in
function_names
(e.g.['avg_dnu1', 'r02']
). Current options (see The frequency function) are:nu<l>
: the individual frequenciesnu_min<i>
: use the i-th lowest radial mode frequencyr02
: the r₀₂ separation ratiosr13
: the r₁₃ separation ratiosr01
: the r₀₁ separation ratiosr10
: the r₁₀ separation ratiosd2nu
: the second frequency differences \(\Delta_2\nu_{l,n}=\nu_{l,n-1}-2\nu_{l,n}+\nu_{l,n+1}\)dnu<l>
: the first frequency differences \(\Delta\nu_{l,n}=\nu_{l,n}-\nu_{l,n-1}\)avg_dnu<l>
: the average large separation \(\langle\Delta\nu_l\rangle\) (found by linear regression)
<l>
indicates an optional angular degree. If omitted, all available angular degrees will be used.avg_dnu
gives a single large separation fit by regression using all the modes.
-
frequency_function
(freqs)¶ Evaluate the frequency function using the frequencies in array
freqs
, which must have already been selected to match the observations.
-
set_chi2_weights
(weight_option, seismic_weight_factor=1.0, nonseismic_weight_factor=1.0)¶ Assigns the relative weights for the log-likelihoods of the seismic and non-seismic parts (\(w_\mathrm{seismic}\) and \(w_\mathrm{non-seismic}\)) of the likelihood function depending on the number of terms in each. e.g. Given \(T_\mathrm{eff}\), [Fe/H] and four frequency separation ratios, we have two non-seismic terms and four seismic terms, i.e. \(n_\mathrm{non-seismic}=2\) and \(n_\mathrm{seismic}=4\).
- Parameters
weight_option (str) –
For each option, the non-seismic and seismic weights are, respectively:
None
or''
: both 1, ignoring the extra weight factors.'absolute'
: both 1, multiplied by the extra weight factors.'relative'
: 1 and \(n_\mathrm{non-seismic}/n_\mathrm{seismic}\)'reduced'
: both \(1/(n_\mathrm{non-seismic}+n_\mathrm{seismic}-1)\)'reduced_bis'
: \(1/(n_\mathrm{non-seismic}-1)\) and \(1/(n_\mathrm{seismic}-1)\)
seismic_weight_factor (float) – Additional absolute weight by which to multiply the seismic component.
nonseismic_weight_factor (float) – Additional absolute weight by which to multiply the non-seismic component.
-
get_optimal_surface_correction
(model, name=None, obs=None, sigma=None, fixed=None, maxiter=20)¶ Calculates the optimal surface correction parameters for
model
relative to some observations. By default, this uses the data stored in the Likelihood object (i.e.self
) but you can pass keyword arguments to override these with other values.- Parameters
model (AIMS3 Model) – model for which to compute optimal surface correction parameters
name (str, optional) –
name of the surface correction, options are
None
: don’t use any surface corrections'Ball2014'
: use one-term (or cubic) correction by Ball & Gizon (2014)'Ball2014_2'
: use two-term (or combined) correction by Ball & Gizon (2014)'Kjeldsen2008'
: use power-law correction by Kjeldsen et al. (2008) with powerfixed[0]
and free amplitude'Kjeldsen2008_scaling'
: likeKjeldsen2008
but the power is based on the scaling relation by Sonoi et al. (2015), as implemented inb_Kjeldsen2008
'Kjeldsen2008_2'
or'PowerLaw'
: likeKjeldsen2008
but both the amplitude and power are free'Sonoi2015'
: use the modified Lorentzian by Sonoi et al. (2015) with powerfixed[0]
and free amplitude'Sonoi2015_scaling'
: likeSonoi2015
but the power is based on the scaling relation by Sonoi et al. (2015), as implemented inbeta_Sonoi2015
'Sonoi2015_2'
: likeSonoi2015
but both the amplitude and power are free
obs (array, optional) – observed frequencies
sigma (array, optional) – uncertainties on observed frequencies
fixed (iterable of floats) – fixed parameters for surface correction
maxiter (int) – maximum number of iterations for Newton’s method when optimising a surface correction with non-linear parameters
- Returns
free – optimal free parameters of the surface correction
- Return type
array
-