Prior Generators

model_fitter.make_gen(min, max)
model_fitter.make_norm_gen(mean, std)
model_fitter.make_lognorm_gen(mean, std)

Make a natural-log normal distribution for a variable. The specified mean and std should be in the ln() space.

model_fitter.make_log10norm_gen(mean_in_log10, std_in_log10)

Scale scipy lognorm from natural log to base 10. Note the mean and std should be in the log10() space already.

Parameters
mean:

mean of the underlying log10 gaussian (i.e. a log10 quantity)

std:

variance of underlying log10 gaussian

model_fitter.make_truncnorm_gen(mean, std, lo_cut, hi_cut)

lo_cut and hi_cut are in the units of sigma

model_fitter.make_truncnorm_gen_with_bounds(mean, std, low_bound, hi_bound)

low_bound and hi_bound are in the same units as mean and std

model_fitter.make_t0_gen(t, mag)

Get an approximate t0 search range by finding the brightest point and then searching days where flux is higher than 80% of this peak.

model_fitter.make_mag_base_gen(mag)

Make a prior for baseline magnitude using the data.

model_fitter.make_mag_src_gen(mag)

Make a prior for source magnitude using the data. Allow negative blending.

model_fitter.make_xS0_gen(pos)
model_fitter.make_xS0_norm_gen(pos)
model_fitter.make_muS_EN_gen(t, pos, scale_factor=100.0)

Get an approximate muS search range by looking at the best fit straight line to the astrometry. Then allows lots of free space.

Returns
gen:

uniform generator for velocity in mas/yr

model_fitter.make_muS_EN_norm_gen(t, pos, n_use=None, scale_factor=10.0)

Get an approximate muS search range by looking at the best fit straight line to the astrometry. Then allows lots of free space.

Parameters
t:

array of times in days

pos:

array of positions in arcsec

Returns
gen:

uniform generator for velocity in mas/yr

model_fitter.make_invgamma_gen(t_arr)

ADD DESCRIPTION

Parameters
t_arr:

time array

model_fitter.compute_invgamma_params(t_arr)
Based on function of same name from

Fran Bartolic’s caustic package: https://github.com/fbartolic/caustic | Returns parameters of an inverse gamma distribution s.t.

  • 1% of total prob. mass is assigned to values of \(t < t_{min}\) and

  • 1% of total prob. masss to values greater than t_{tmax}.

t_{min} is defined to be the median spacing between consecutive data points in the time series and t_{max} is the total duration of the time series.

Parameters
t_arrarray

Array of times

Returns
invgamma_a, invgamma_bfloat (?)

The parameters a,b of the inverse gamma function.

model_fitter.make_piS()
model_fitter.make_fdfdt()
model_fitter.random_prob(generator, x)
model_fitter.weighted_quantile(values, quantiles, sample_weight=None, values_sorted=False, old_style=False)

Very close to numplt.percentile, but supports weights.

Parameters

values:

numplt.array with data

quantiles:

array-like with many quantiles needed

sample_weight:

array-like of the same length as array

values_sorted: bool,

if True, then will avoid sorting of initial array

old_style:

if True, will correct output to be consistent with numplt.percentile.

Returns
arr:

numplt.array with computed quantiles.

Notes

Note

quantiles should be in [0, 1]!

model_fitter.split_param_filter_index1(s)

Split a parameter name into the <string><number> components where <string> is the parameter name and <number> is the filter index (1-based). If there is no number at the end for a filter index, then return None for the second argument.

Returns
param_namestr

The name of the parameter.

filt_indexint (or None)

The 1-based filter index.

model_fitter.generate_params_dict(params, fitter_param_names)

Take a list, dictionary, or astropy Row of fit parameters and extra parameters and convert it into a well-formed dictionary that can be fed straight into a model object.

The output object will only contain parameters specified by name in fitter_param_names. Multi-filter photometry parameters are treated specially and grouped together into an array such as [‘mag_src’] = [mag_src1, mag_src2].

Parameters
paramslist, dict, Row

Contains values of parameters. Note that if the params are in a list, they need to be in the same order as fitter_param_names. If the params are in a dict or Row, then order is irrelevant.

fitter_param_nameslist

The names of the parameters that will be delivered, in order, in the output.

Returns
params_dictdict

Dictionary of the parameter names and values.