API reference

Models

General Models

Note

The abstract baseclass BaseModel defines a few methods for retrieving information about the current state of the fit. These methods are not documented in the child classes, but will be regularly used.

satlas.models.basemodel.BaseModel() Abstract baseclass for all models.
satlas.models.summodel.SumModel(models) Create a model that sums all the underlying models for a single input variable.
satlas.models.linkedmodel.LinkedModel(models) Links different models for simultaneous fitting.
satlas.models.models.MiscModel(func, args[, ...]) Constructs a response from a supplied function.
satlas.models.models.PolynomialModel(args) Constructs a polynomial response.

Specialized Models

satlas.models.hfsmodel.HFSModel(I, J, ABC, ...) Constructs a HFS spectrum, consisting of different peaks described by a certain profile.
satlas.models.transformmodel.TransformHFSModel(...) Create an HFSModel that applies both a pre-processing transformation on the input data and a post-processing transformation on the output data.

Fitting routines

Implementation of fitting routines specialised for BaseModel objects. Note that not all functions are loaded into the global satlas namespace.

satlas.stats.fitting.calculate_analytical_uncertainty(f, x, y) Calculates the analytical errors on the parameters, by changing the value for a parameter and finding the point where the chisquare for the refitted parameters is one greater.
satlas.stats.fitting.chisquare_fit(f, x, y) Use a non-linear least squares minimization (Levenberg-Marquardt) algorithm to minimize the chi-square of the fit to data x and y with errorbars yerr.
satlas.stats.fitting.chisquare_model(params, ...) Model function for chisquare fitting routines as established in this module.
satlas.stats.fitting.chisquare_spectroscopic_fit(f, x, y) Use the chisquare_fit function, automatically estimating the errors on the counts by the square root.
satlas.stats.fitting.likelihood_fit(f, x, y) Fits the given model to the given data using the Maximum Likelihood Estimation technique.
satlas.stats.fitting.likelihood_walk(f, x, y) Calculates the uncertainty on MLE-optimized parameter values by performing a random walk through parameter space and comparing the resulting loglikelihood values.
satlas.stats.fitting.likelihood_x_err(f, x, ...) Calculates the loglikelihood for a model given x and y values.
satlas.stats.fitting.likelihood_lnprob(...) Calculates the logarithm of the probability that the data fits the model given the current parameters.
satlas.stats.fitting.likelihood_loglikelihood(f, ...) Given a parameters object, a Model object, experimental data and a loglikelihood function, calculates the loglikelihood for all data points.
satlas.stats.fitting.create_band(f, x, ...) Calculates prediction or confidence bounds at the 1 \sigma level.
satlas.stats.fitting.assign_hessian_estimate(...) Calculates the Hessian of the model at the given parameters, and associates uncertainty estimates based on the inverted Hessian matrix.
satlas.stats.fitting.process_walk(model, ...) Given a model and H5 file with the results of a random walk, the parameters varied in the walk are set to the 50% percentile, and the uncertainty is set to either the difference between the 50% and 16% percentile, or between the 84% and 50%, whichever is the largest.

Likelihood calculations

Implementation of calculation of the loglikelihood for common distributions.

satlas.loglikelihood.poisson_llh(y, f, x) Returns the loglikelihood for a Poisson distribution.
satlas.loglikelihood.create_gaussian_llh([...]) Returns the loglikelihood-function for a Gaussian distribution, with the given uncertainty on the data points.
satlas.loglikelihood.create_gaussian_priormap(...) Generates a function that describes a Gaussian prior mapping around the given literature value with the given uncertainty.

Lineshapes

Implementation of classes for different lineshapes, creating callables for easy and intuitive calculations.

satlas.profiles.Crystalball([fwhm, mu, amp, ...]) A callable Crystalball profile.
satlas.profiles.Gaussian([fwhm, mu, amp, ...]) A callable normalized Gaussian profile.
satlas.profiles.Lorentzian([fwhm, mu, amp, ...]) A callable normalized Lorentzian profile.
satlas.profiles.AsymmLorentzian([fwhm, mu, ...]) A callable normalized Lorentzian profile with builtin asymmetry.
satlas.profiles.Voigt([fwhm, mu, amp, ampIsArea]) A callable normalized Voigt profile.
satlas.profiles.PseudoVoigt([eta, fwhm, mu, amp]) A callable normalized PseudoVoigt profile.

Utilities

Implementation of various functions that ease the work, but do not belong in one of the other modules.

satlas.utilities.utilities.generate_spectrum(...) Generates a model by random sampling from the provided HFSModel and range.
satlas.utilities.utilities.poisson_interval(data) Calculates the confidence interval for the mean of a Poisson distribution.
satlas.utilities.utilities.weighted_average(x, ...) Takes the weighted average of an array of values and the associated errors.
satlas.utilities.utilities.beta(mass, V) Calculates the beta-factor for a mass in amu and applied voltage in Volt.
satlas.utilities.utilities.dopplerfactor(mass, V) Calculates the Doppler shift of the laser frequency for a given mass in amu and voltage in V.

Visualisations

satlas.utilities.plotting.generate_correlation_map(f, ...) Generates a correlation map for either the chisquare or the MLE method.
satlas.utilities.plotting.generate_correlation_plot(...) Given the random walk data, creates a triangle plot: distribution of a single parameter on the diagonal axes, 2D contour plots with 1, 2 and 3 sigma contours on the off-diagonal.
satlas.utilities.plotting.generate_walk_plot(...) Given the random walk data, the random walk for the selected parameters is plotted.