3.1. Bumps interface¶
3.1.1. sasmodels.bumps_model¶
Wrap sasmodels for direct use by bumps.
Model is a wrapper for the sasmodels kernel which defines a bumps Parameter box for each kernel parameter. Model accepts keyword arguments to set the initial value for each parameter.
Experiment combines the Model function with a data file loaded by the sasview data loader. Experiment takes a cutoff parameter controlling how far the polydispersity integral extends.
A variety of helper functions are provided:
load_data() loads a sasview data file.
empty_data1D() creates an empty dataset, which is useful for plotting a theory function before the data is measured.
empty_data2D() creates an empty 2D dataset.
set_beam_stop() masks the beam stop from the data.
set_half() selects the right or left half of the data, which can be useful for shear measurements which have not been properly corrected for path length and reflections.
set_top() cuts the top part off the data.
plot_data() plots the data file.
plot_theory() plots a calculated result from the model.
- class sasmodels.bumps_model.Experiment(data, model, cutoff=1e-05)¶
Bases: object
Return a bumps wrapper for a SAS model.
data is the data to be fitted.
model is the SAS model from core.load_model().
cutoff is the integration cutoff, which avoids computing the the SAS model where the polydispersity weight is low.
Model parameters can be initialized with additional keyword arguments, or by assigning to model.parameter_name.value.
The resulting bumps model can be used directly in a FitProblem call.
- nllf()¶
- numpoints()¶
Return the number of points
- parameters()¶
Return a dictionary of parameters
- plot(view='log')¶
Plot the data and residuals.
- residuals()¶
- save(basename)¶
- simulate_data(noise=None)¶
- theory()¶
- update()¶
- class sasmodels.bumps_model.Model(kernel, **kw)¶
Bases: object
- parameters()¶
Return a dictionary of parameters
- sasmodels.bumps_model.BumpsModel(data, model, cutoff=1e-05, **kw)¶
- sasmodels.bumps_model.delay(dt)¶
Return number date-time delta as number seconds
- sasmodels.bumps_model.demo()¶
- sasmodels.bumps_model.empty_data1D(q, resolution=0.05)¶
Create empty 1D data using the given q as the x value.
resolution dq/q defaults to 5%.
- sasmodels.bumps_model.empty_data2D(qx, qy=None, resolution=0.05)¶
Create empty 2D data using the given mesh.
If qy is missing, create a square mesh with qy=qx.
resolution dq/q defaults to 5%.
- sasmodels.bumps_model.load_data(filename)¶
Load data using a sasview loader.
- sasmodels.bumps_model.plot_data(data, view='log')¶
Plot data loaded by the sasview loader.
- sasmodels.bumps_model.plot_theory(data, theory, view='log')¶
- sasmodels.bumps_model.set_beam_stop(data, radius, outer=None)¶
Add a beam stop of the given radius. If outer, make an annulus.
- sasmodels.bumps_model.set_half(data, half)¶
Select half of the data, either “right” or “left”.
- sasmodels.bumps_model.set_top(data, cutoff)¶
Chop the top off the data, above cutoff.
- sasmodels.bumps_model.tic()¶
Timer function.
Use “toc=tic()” to start the clock and “toc()” to measure a time interval.