stacie.cost module¶
Cost function to optimize models for the low-frequency part of the spectrum.
- class LowFreqCost(freqs, ndofs, amplitudes, weights, model)[source]¶
Bases:
object
Cost function to fit a model to the low-frequency part of the spectrum.
- Parameters:
-
amplitudes:
ndarray
[tuple
[Any
,...
],dtype
[float
]]¶ The actual spectrum amplitudes at frequencies in
self.freqs
.
-
freqs:
ndarray
[tuple
[Any
,...
],dtype
[float
]]¶ The frequencies for which the spectrum amplitudes are computed.
-
model:
SpectrumModel
¶ The model to be fitted to the spectrum.
- entropy_gamma(alpha, theta, *, deriv=0)[source]¶
Compute the entropy of the Gamma distribution.
- Parameters:
- Returns:
results – A list of results (function value and requested derivatives.) All elements have the same shape as the
alpha
andtheta
arrays.
- logpdf_gamma(x, alpha, theta, *, deriv=0)[source]¶
Compute the logarithm of the probability density function of the Gamma distribution.
- Parameters:
x (
ndarray
[tuple
[Any
,...
],dtype
[float
]]) – The argument of the PDF (random variable). Array with shape(nfreq,)
.alpha (
ndarray
[tuple
[Any
,...
],dtype
[float
]]) – The shape parameter. Array with shape(nfreq,)
.theta (
ndarray
[tuple
[Any
,...
],dtype
[float
]]) – The scale parameter. Array with shape(..., nfreq,)
.deriv (
int
) – The order of the derivatives toward theta to compute: 0, 1 or 2.
- Returns:
results – A list of results (function value and requested derivatives.) All elements have the same shape as the
theta
array.