API#

Prior functions#

class lightspot.priors.ConstrainPvec(pmin=0, pmax=50, sinimin=0, sinimax=1, vmin=1e-09, vmax=1000000000.0, rmin=1e-09, rmax=1000000000.0, **kwargs)#

Bases: Prior

class lightspot.priors.Dirac(x0)#

Bases: Prior

class lightspot.priors.Duplicate(prior, **kwargs)#

Bases: Prior

class lightspot.priors.LogNormal(logmu=0.0, logsd=1.0, ndim=1, **kwargs)#

Bases: Prior

class lightspot.priors.LogUniform(logxmin=0.0, logxmax=1.0, ndim=1, **kwargs)#

Bases: Prior

class lightspot.priors.Normal(mu=0.0, sd=1.0, ndim=1, **kwargs)#

Bases: Prior

class lightspot.priors.Polygon(poly, **kwargs)#

Bases: Prior

class lightspot.priors.Prior(n_inputs, n_outputs, input_names='', wrap=False)#

Bases: object

class lightspot.priors.QuadraticLD(amin=0.0, amax=2.0, bmin=-1.0, bmax=1.0, **kwargs)#

Bases: Prior

class lightspot.priors.SineUniform(sinxmin=0.0, sinxmax=1.0, ndim=1, **kwargs)#

Bases: Prior

class lightspot.priors.Stack(prior1, prior2, **kwargs)#

Bases: Prior

class lightspot.priors.ThreeParamLD(**kwargs)#

Bases: Prior

class lightspot.priors.Triangular(triangle, **kwargs)#

Bases: Prior

class lightspot.priors.TruncNormal(mu=0.0, sd=1.0, xmin=0.0, xmax=1.0, ndim=1, **kwargs)#

Bases: Prior

class lightspot.priors.Uniform(xmin=0.0, xmax=1.0, ndim=1, **kwargs)#

Bases: Prior

Modeler classes#

class lightspot.sampler.AbstractModel(defaults, t, y, dy=None, priors=None)#

Bases: object

_latexify(name, i=None)#
_post_processing(results)#
_validate_params(priors)#
chi(theta)#

Chi squared of parameters given a set of observations

Parameters:

theta (array-like with shape (jmax,)) – Full parameter vector (physical units).

Returns:

sse – Sum of squared errors weighted by observation uncertainties.

Return type:

float

loglike(theta)#
mcmc(n_walkers, n_steps, burn, use_prior=True)#
minimize()#
nested_sample(resume=True, log_dir=None, n_slice=0, popsize=0, **kwargs)#
plot_fit(t_grid, color='k')#
predict(t, theta)#

Base method to be overridden by the actual model. Should be vectorized, i.e., return a 2d ndarray with shape (theta.shape[0], t.size)

prior_transform(cube)#
reduced_chi(theta)#
run(nlive=1000, cores=None, filename=None, seed=42, **kwargs)#
class lightspot.sampler.SimpleSpotModel(t, y, nspots, dy=None, priors=None)#

Bases: AbstractModel

chi(theta)#

Chi squared of parameters given a set of observations

Parameters:

theta (array-like with shape (jmax,)) – Full parameter vector (physical units).

Returns:

sse – Sum of squared errors weighted by observation uncertainties.

Return type:

float

eff_var(theta)#
loglike(theta)#
predict(t, theta)#

Base method to be overridden by the actual model. Should be vectorized, i.e., return a 2d ndarray with shape (theta.shape[0], t.size)

class lightspot.sampler.SpotModel(t, y, nspots, dy=None, priors=None, tstart=None, tend=None)#

Bases: AbstractModel

chi(theta)#

Chi squared of parameters given a set of observations

Parameters:

theta (array-like with shape (jmax,)) – Full parameter vector (physical units).

Returns:

sse – Sum of squared errors weighted by observation uncertainties.

Return type:

float

eff_var(theta)#
loglike(theta)#
predict(t, theta)#

Calculates the model flux for given parameter values

Parameters:
  • t (array-like with shape (ndata,)) – time samples where the flux function should be evaluated

  • theta (array-like with shape (jmax,)) – full parameter vector (physical units)

Returns:

yf – model flux

Return type:

array-like with shape (ndata,)