3.15. Distribution functions¶
3.15.1. sasmodels.weights¶
SAS distributions for polydispersity.
- class sasmodels.weights.ArrayDispersion(npts=None, width=None, nsigmas=None)¶
Bases: sasmodels.weights.Dispersion
- get_pars()¶
- get_weights(center, lb, ub, relative)¶
Return the weights for the distribution.
center is the center of the distribution
lb,*ub* are the min and max allowed values
relative is True if the distribution width is proportional to the center value instead of absolute. For polydispersity use relative. For orientation parameters use absolute.
- set_weights(values, weights)¶
- default = {'width': 0, 'nsigmas': 1, 'npts': 35}¶
- type = 'array'¶
- class sasmodels.weights.Dispersion(npts=None, width=None, nsigmas=None)¶
Bases: object
Base dispersion object.
Subclasses should define _weights(center, sigma, lb, ub) which returns the x points and their corresponding weights.
- get_pars()¶
- get_weights(center, lb, ub, relative)¶
Return the weights for the distribution.
center is the center of the distribution
lb,*ub* are the min and max allowed values
relative is True if the distribution width is proportional to the center value instead of absolute. For polydispersity use relative. For orientation parameters use absolute.
- set_weights(values, weights)¶
- default = {'width': 0, 'nsigmas': 3, 'npts': 35}¶
- type = 'base disperser'¶
- class sasmodels.weights.GaussianDispersion(npts=None, width=None, nsigmas=None)¶
Bases: sasmodels.weights.Dispersion
- get_pars()¶
- get_weights(center, lb, ub, relative)¶
Return the weights for the distribution.
center is the center of the distribution
lb,*ub* are the min and max allowed values
relative is True if the distribution width is proportional to the center value instead of absolute. For polydispersity use relative. For orientation parameters use absolute.
- set_weights(values, weights)¶
- default = {'width': 0, 'nsigmas': 3, 'npts': 35}¶
- type = 'gaussian'¶
- class sasmodels.weights.LogNormalDispersion(npts=None, width=None, nsigmas=None)¶
Bases: sasmodels.weights.Dispersion
- get_pars()¶
- get_weights(center, lb, ub, relative)¶
Return the weights for the distribution.
center is the center of the distribution
lb,*ub* are the min and max allowed values
relative is True if the distribution width is proportional to the center value instead of absolute. For polydispersity use relative. For orientation parameters use absolute.
- set_weights(values, weights)¶
- default = {'width': 0, 'nsigmas': 8, 'npts': 80}¶
- type = 'lognormal'¶
- class sasmodels.weights.RectangleDispersion(npts=None, width=None, nsigmas=None)¶
Bases: sasmodels.weights.Dispersion
- get_pars()¶
- get_weights(center, lb, ub, relative)¶
Return the weights for the distribution.
center is the center of the distribution
lb,*ub* are the min and max allowed values
relative is True if the distribution width is proportional to the center value instead of absolute. For polydispersity use relative. For orientation parameters use absolute.
- set_weights(values, weights)¶
- default = {'width': 0, 'nsigmas': 1.70325, 'npts': 35}¶
- type = 'rectangle'¶
- class sasmodels.weights.SchulzDispersion(npts=None, width=None, nsigmas=None)¶
Bases: sasmodels.weights.Dispersion
- get_pars()¶
- get_weights(center, lb, ub, relative)¶
Return the weights for the distribution.
center is the center of the distribution
lb,*ub* are the min and max allowed values
relative is True if the distribution width is proportional to the center value instead of absolute. For polydispersity use relative. For orientation parameters use absolute.
- set_weights(values, weights)¶
- default = {'width': 0, 'nsigmas': 8, 'npts': 80}¶
- type = 'schulz'¶
- sasmodels.weights.get_weights(disperser, n, width, nsigmas, value, limits, relative)¶
Return the set of values and weights for a polydisperse parameter.
disperser is the name of the disperser.
n is the number of points in the weight vector.
width is the width of the disperser distribution.
nsigmas is the number of sigmas to span for the dispersion convolution.
value is the value of the parameter in the model.
limits is [lb, ub], the lower and upper bound of the weight value.
relative is true if width is defined in proportion to the value of the parameter, and false if it is an absolute width.
Returns (value,weight), where value and weight are vectors.