reggae.utils¶
Classes¶
Replacement for scipy.interpolate.interp1d in jax |
|
Container for scaling relations |
|
Functions¶
|
Read background samples during prior. |
|
Transform to value to log10 |
|
Helper function for evaluating the beta distribution quantile function |
|
Helper function for evaluating the beta distribution quantile function |
|
Helper function for evaluating the beta distribution quantile function |
|
Helper function for evaluating the beta distribution quantile function |
|
Helper function for evaluating the beta distribution quantile function |
Module Contents¶
- reggae.utils.readBkgFits(ID)¶
Read background samples during prior.
Read in the previosly fit background model parameters to use as a prior during sampling.
Paramaters¶
- IDstr
Target identifier
Returns¶
- outdict
Dictionary containing parameters for three harvey laws.
- class reggae.utils.jaxInterp1D(xp, fp, left=None, right=None, period=None)¶
Replacement for scipy.interpolate.interp1d in jax
This is used to initialize a callable object for interpolating.
- xp¶
- fp¶
- left = None¶
- right = None¶
- period = None¶
- class reggae.utils.scalingRelations¶
Container for scaling relations
This is a helper class which contains methods for the various scaling relations.
- __init_()¶
- dnuScale(nu, gamma=0.0, p=[0.79101684, -0.63285292])¶
Compute dnu from numax
Computes an estimate of the large separation from a given value of numax, assuming the two parameters scale as a polynomial in log(dnu) and log(numax).
The default is a linear function in log(dnu) and log(numax), estimated based on a polynomial fit performed on a set of main-sequence and sub- giant stars in the literature.
The output may be scaled by a factor gamma, e.g., for setting credible intervals.
Parameters¶
- nufloat, array
Value(s) at which to compute dnu, assuming nu corresponds to numax. (muHz)
- gammafloat
Scaling factor to apply.
- parray-like, optional
Polynomial coefficients to use for log(dnu), log(numax), starting with the coefficient of the Nth order term and ending at the bias term.
Returns¶
- dnufloat, array
Estimate of the large separation dnu
- reggae.utils.to_log10(x, xerr)¶
Transform to value to log10
Takes a value and related uncertainty and converts them to logscale. Approximate.
Parameters¶
- xfloat
Value to transform to logscale
- xerrfloat
Value uncertainty
Returns¶
- logvallist
logscaled value and uncertainty
- class reggae.utils.normal(**kwargs)¶
- norm¶
- lognorm¶
- fac¶
- pdf(x, norm=True)¶
Evaluate the probability density function
Returns the probability density of the normal distribution at x. The distribution is normalized to unit integral by default so that it may be used as a PDF.
In some cases the normalization is not necessary, and since it’s marginally slower it may as well be left out.
Parameters¶
- xarray
Support for the probability density.
Returns¶
- yarray
The probability density at x.
- logpdf(x, norm=True)¶
Evaluate the log-probability density function
Returns the probability density of the normal distribution at x. The distribution is normalized to unit integral by default so that it may be used as a PDF.
In some cases the normalization is not necessary, and since it’s marginally slower it may as well be left out.
Parameters¶
- xarray
Support for the probability density.
Returns¶
- yarray
The probability density at x.
- class reggae.utils.uniform(**kwargs)¶
- a¶
- b¶
- mu¶
- pdf(x)¶
Evaluate the probability density function
Returns the probability density of the uniform distribution at x. The distribution is normalized to unit integral by default so that it may be used as a PDF.
Parameters¶
- xarray
Support for the probability density.
Returns¶
- yarray
The probability density at x.
- logpdf(x)¶
Evaluate the log-probability density function
Returns the probability density of the uniform distribution at x. The distribution is normalized to unit integral by default so that it may be used as a PDF.
In some cases the normalization is not necessary, and since it’s marginally slower it may as well be left out.
Parameters¶
- xarray
Support for the probability density.
Returns¶
- yarray
The probability density at x.
- class reggae.utils.beta(**kwargs)¶
- loc = 0¶
- scale = 1¶
- fac¶
- logfac¶
- am1¶
- bm1¶
- _transformx(x)¶
Transform x
Translates and scales the input x to the unit interval according to the loc and scale parameters.
Parameters¶
- xarray-like
Input support for the probability density.
Returns¶
- _xarray-like
x translated and scaled to the range 0 to 1.
- _inverse_transform(x)¶
Invert transformation on x
Translates and scales the input x to the original interval according to the loc and scale parametrs.
Parameters¶
- xarray-like
Input support for the probability on the interval 0 to 1.
Returns¶
- _xarray-like
x translated and scaled from the range 0 to 1 to the loc and scale.
- pdf(x, norm=True)¶
Return PDF
Returns the beta distribution at x. The distribution is normalized to unit integral by default so that it may be used as a PDF.
In some cases the normalization is not necessary, and since it’s marginally slower it may as well be left out.
Parameters¶
- xarray
Input support for the probability density.
- normbool, optional
If true, returns the normalized beta distribution. The default is True.
Returns¶
- yarray
The value of the beta distribution at x.
- logpdf(x, norm=True)¶
Return log-PDF
Returns the log of the beta distribution at x. The distribution is normalized to unit integral (in linear units) by default so that it may be used as a PDF.
In some cases the normalization is not necessary, and since it’s marginally slower it may as well be left out.
Parameters¶
- xarray
Input support for the probability density.
- normbool, optional
If true, returns the normalized beta distribution. The default is True.
Returns¶
- yarray
The value of the logarithm of the beta distribution at x.
- reggae.utils._update_x(x, a, b, p, a1, b1, afac)¶
Helper function for evaluating the beta distribution quantile function
- reggae.utils._func_1(a, b, p)¶
Helper function for evaluating the beta distribution quantile function
- reggae.utils._func_2(a, b, p)¶
Helper function for evaluating the beta distribution quantile function
- reggae.utils._compute_x(p, a, b)¶
Helper function for evaluating the beta distribution quantile function
- reggae.utils._betaincinv(a, b, p)¶
Helper function for evaluating the beta distribution quantile function