errors  Plot sample profile uncertainty¶
reload_errors 
Reload the MCMC state and compute the model confidence intervals. 
run_errors 
Command line tool for generating error plots from models. 
calc_errors 
Align the sample profiles and compute the residual difference from the measured reflectivity for a set of points. 
align_profiles 
Align profiles for each sample 
show_errors 
Plot the aligned profiles and the distribution of the residuals for profiles and residuals returned from calc_errors. 
show_profiles 

show_residuals 
Visual representation of model uncertainty.
For reflectivity models, this aligns and plots a set of profiles chosen from the parameter uncertainty distribution, and plots the distribution of the residual values.
Use run_errors in a model file to reload the results of a batch DREAM fit.

refl1d.errors.
reload_errors
(model, store, nshown=50, random=True)[source]¶ Reload the MCMC state and compute the model confidence intervals.
The loaded error data is a sample from the fit space according to the fit parameter uncertainty. This is a subset of the samples returned by the DREAM MCMC sampling process.
model is the name of the model python file
store is the name of the store directory containing the dream results
nshown and random are as for
calc_errors_from_state()
.Returns errs for
show_errors()
.

refl1d.errors.
run_errors
(**kw)[source]¶ Command line tool for generating error plots from models.
Type the following to regenerate the profile contour plots plots:
$ refl1d align <model>.py <store> [<align>] [012n]Align is either auto for the current behaviour, or it is an interface number. You can align on the center of a layer by adding 0.5 to the interface number. You can count interfaces from the surface by prefixing with R. For example, 0 is the substrate interface, R1 is the surface interface, 2.5 is the the middle of layer 2 above the substrate.
You can plot the profiles and residuals on one plot by setting plots to 1, on two separate plots by setting plots to 2, or each curve on its own plot by setting plots to n. Plots are saved in <store>/<model>err#.png. If plots is 0, then no plots are created.
Additional parameters include:
nshown, random :
seebumps.errplot.calc_errors_from_state()
contours, npoints, plots, save :
seeshow_errors()

refl1d.errors.
calc_errors
(problem, points)[source]¶ Align the sample profiles and compute the residual difference from the measured reflectivity for a set of points.
The points should be sampled from the posterior probability distribution computed from MCMC, bootstrapping or sampled from the error ellipse calculated at the minimum.
Each of the returned arguments is a dictionary mapping model number to error sample data as follows:
Returns (profiles, slabs, Q, residuals).
profiles
Arrays of (z, rho, irho) for nonmagnetic models or arrays of (z, rho, irho, rhoM, thetaM) for magnetic models. There will be one set of arrays returned per error sample.slabs
Array of slab thickness for the layers in the models. There will be one array returned per error sample. Using slab thickness, profiles can be aligned on interface boundaries and layer centers.Q
Array of Q values for the data points in the model. The data points are the same for all error samples, so only one Q array is needed per model.residuals
Array of (theorydata)/uncertainty for each data point in the measurement. There will be one array returned per error sample.

refl1d.errors.
show_errors
(errors, contours=(68, 95), npoints=200, align='auto', plots=1, save=None)[source]¶ Plot the aligned profiles and the distribution of the residuals for profiles and residuals returned from calc_errors.
contours can be a list of percentiles or []. If percentiles are given, then show uncertainty using a contour plot with the given levels, otherwise just overplot sample lines. contours defaults to [68, 95, 100].
npoints is the number of points to use when generating the profile contour. Since the z values for the various lines do not correspond, the contour generator interpolates the entire profile range with linear spacing using this number of points.
align is the interface number plus fractional distance within the layer following the interface. For example, use 0 for the substrate interface, use 1 for the surface interface, or use 2.5 for the center of the second slab above the substrate.
plots is the number of plots to use (1, 2, or ‘n’).
save is the basename of the plot to save. This should usually be “<store>/<model>”. The program will add ‘err#.png’ where ‘#’ is the number of the plot.