2. Bumps interface¶
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.
-
class
sasmodels.bumps_model.
Model
(model, **kwargs)¶ Bases:
object
Bumps wrapper for a SAS model.
model is a runnable module as returned from
core.load_model()
.cutoff is the polydispersity weight cutoff.
Any additional key=value pairs are model dependent parameters.
-
parameters
()¶ Return a dictionary of parameters objects for the parameters, excluding polydispersity distribution type.
-
state
()¶ Return a dictionary of current values for all the parameters, including polydispersity distribution type.
-
-
class
sasmodels.bumps_model.
Experiment
(data, model, cutoff=1e-05, name=None)¶ Bases:
sasmodels.direct_model.DataMixin
Bumps wrapper for a SAS experiment.
data is a
data.Data1D
,data.Data2D
ordata.Sesans
object. Usedata.empty_data1D()
ordata.empty_data2D()
to define \(q, \Delta q\) calculation points for displaying the SANS curve when there is no measured data.model is a
Model
object.cutoff is the integration cutoff, which avoids computing the the SAS model where the polydispersity weight is low.
The resulting model can be used directly in a Bumps FitProblem call.
-
nllf
()¶ Return the negative log likelihood of seeing data given the model parameters, up to a normalizing constant which depends on the data uncertainty.
-
numpoints
()¶ Return the number of data points
-
parameters
()¶ Return a dictionary of parameters
-
plot
(view='log')¶ Plot the data and residuals.
-
residuals
()¶ Return theory minus data normalized by uncertainty.
-
save
(basename)¶ Save the model parameters and data into a file.
Not Implemented.
-
simulate_data
(noise=None)¶ Generate simulated data.
-
theory
()¶ Return the theory corresponding to the model parameters.
This method uses lazy evaluation, and requires model.update() to be called when the parameters have changed.
-
update
()¶ Call when model parameters have changed and theory needs to be recalculated.
-