34. Distribution functions¶
sasmodels.weights¶
SAS distributions for polydispersity.
- class sasmodels.weights.ArrayDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
DispersionEmpirical dispersion curve.
Use
set_weights()to set \(w = f(x)\).- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Empirical dispersion curve.\n\n Use :meth:`set_weights` to set $w = f(x)$.\n ', 'type': 'array', 'default': {'npts': 35, 'width': 0, 'nsigmas': 1}, '__init__': <function ArrayDispersion.__init__>, 'set_weights': <function ArrayDispersion.set_weights>, '_weights': <function ArrayDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Empirical dispersion curve.\n\n Use :meth:`set_weights` to set $w = f(x)$.\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 35, 'nsigmas': 1, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights for the given x values.
- type = 'array'¶
- class sasmodels.weights.BoltzmannDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
DispersionBoltzmann dispersion, with \(\sigma=k T/E\).
\[w = \exp\left( -|x - c|/\sigma\right)\]- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Boltzmann dispersion, with $\\sigma=k T/E$.\n\n .. math::\n\n w = \\exp\\left( -|x - c|/\\sigma\\right)\n ', 'type': 'boltzmann', 'default': {'npts': 35, 'width': 0, 'nsigmas': 3}, '_weights': <function BoltzmannDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Boltzmann dispersion, with $\\sigma=k T/E$.\n\n .. math::\n\n w = \\exp\\left( -|x - c|/\\sigma\\right)\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 35, 'nsigmas': 3, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'boltzmann'¶
- class sasmodels.weights.Dispersion(npts=None, width=None, nsigmas=None)¶
Bases:
objectBase dispersion object.
Subclasses should define _weights(center, sigma, lb, ub) which returns the x points and their corresponding weights.
- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Base dispersion object.\n\n Subclasses should define *_weights(center, sigma, lb, ub)*\n which returns the x points and their corresponding weights.\n ', 'type': 'base disperser', 'default': {'npts': 35, 'width': 0, 'nsigmas': 3}, '__init__': <function Dispersion.__init__>, 'get_pars': <function Dispersion.get_pars>, 'set_weights': <function Dispersion.set_weights>, 'get_weights': <function Dispersion.get_weights>, '_weights': <function Dispersion._weights>, '_linspace': <function Dispersion._linspace>, '__dict__': <attribute '__dict__' of 'Dispersion' objects>, '__weakref__': <attribute '__weakref__' of 'Dispersion' objects>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Base dispersion object.\n\n Subclasses should define *_weights(center, sigma, lb, ub)*\n which returns the x points and their corresponding weights.\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 35, 'nsigmas': 3, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'base disperser'¶
- class sasmodels.weights.GaussianDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
DispersionGaussian dispersion, with 1-\(\sigma\) width.
\[w = \exp\left(-\tfrac12 (x - c)^2/\sigma^2\right)\]- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Gaussian dispersion, with 1-$\\sigma$ width.\n\n .. math::\n\n w = \\exp\\left(-\\tfrac12 (x - c)^2/\\sigma^2\\right)\n ', 'type': 'gaussian', 'default': {'npts': 35, 'width': 0, 'nsigmas': 3}, '_weights': <function GaussianDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Gaussian dispersion, with 1-$\\sigma$ width.\n\n .. math::\n\n w = \\exp\\left(-\\tfrac12 (x - c)^2/\\sigma^2\\right)\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 35, 'nsigmas': 3, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'gaussian'¶
- class sasmodels.weights.LogNormalDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
Dispersionlog Gaussian dispersion, with 1-\(\sigma\) width.
\[w = \frac{\exp\left(-\tfrac12 (\ln x - c)^2/\sigma^2\right)}{x\sigma}\]- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n log Gaussian dispersion, with 1-$\\sigma$ width.\n\n .. math::\n\n w = \\frac{\\exp\\left(-\\tfrac12 (\\ln x - c)^2/\\sigma^2\\right)}{x\\sigma}\n ', 'type': 'lognormal', 'default': {'npts': 80, 'width': 0, 'nsigmas': 8}, '_weights': <function LogNormalDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n log Gaussian dispersion, with 1-$\\sigma$ width.\n\n .. math::\n\n w = \\frac{\\exp\\left(-\\tfrac12 (\\ln x - c)^2/\\sigma^2\\right)}{x\\sigma}\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 80, 'nsigmas': 8, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'lognormal'¶
- class sasmodels.weights.RectangleDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
DispersionUniform dispersion, with width \(\sqrt{3}\sigma\).
\[w = 1\]- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Uniform dispersion, with width $\\sqrt{3}\\sigma$.\n\n .. math::\n\n w = 1\n ', 'type': 'rectangle', 'default': {'npts': 35, 'width': 0, 'nsigmas': 1.73205}, '_weights': <function RectangleDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Uniform dispersion, with width $\\sqrt{3}\\sigma$.\n\n .. math::\n\n w = 1\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 35, 'nsigmas': 1.73205, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'rectangle'¶
- class sasmodels.weights.SchulzDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
DispersionSchultz dispersion, with 1-\(\sigma\) width.
\[w = \frac{z^z\,R^{z-1}}{e^{Rz}\,c \Gamma(z)}\]where \(c\) is the center of the distribution, \(R = x/c\) and \(z=(c/\sigma)^2\).
This is evaluated using logarithms as
\[w = \exp\left(z \ln z + (z-1)\ln R - Rz - \ln c - \ln \Gamma(z) \right)\]- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Schultz dispersion, with 1-$\\sigma$ width.\n\n .. math::\n\n w = \\frac{z^z\\,R^{z-1}}{e^{Rz}\\,c \\Gamma(z)}\n\n where $c$ is the center of the distribution, $R = x/c$ and $z=(c/\\sigma)^2$.\n\n This is evaluated using logarithms as\n\n .. math::\n\n w = \\exp\\left(z \\ln z + (z-1)\\ln R - Rz - \\ln c - \\ln \\Gamma(z) \\right)\n ', 'type': 'schulz', 'default': {'npts': 80, 'width': 0, 'nsigmas': 8}, '_weights': <function SchulzDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Schultz dispersion, with 1-$\\sigma$ width.\n\n .. math::\n\n w = \\frac{z^z\\,R^{z-1}}{e^{Rz}\\,c \\Gamma(z)}\n\n where $c$ is the center of the distribution, $R = x/c$ and $z=(c/\\sigma)^2$.\n\n This is evaluated using logarithms as\n\n .. math::\n\n w = \\exp\\left(z \\ln z + (z-1)\\ln R - Rz - \\ln c - \\ln \\Gamma(z) \\right)\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 80, 'nsigmas': 8, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'schulz'¶
- class sasmodels.weights.UniformDispersion(npts=None, width=None, nsigmas=None)¶
Bases:
DispersionUniform dispersion, with width \(\sigma\).
\[w = 1\]- __annotations__ = {}¶
- __delattr__(name, /)¶
Implement delattr(self, name).
- __dict__ = mappingproxy({'__module__': 'sasmodels.weights', '__doc__': '\n Uniform dispersion, with width $\\sigma$.\n\n .. math::\n\n w = 1\n ', 'type': 'uniform', 'default': {'npts': 35, 'width': 0, 'nsigmas': None}, '_weights': <function UniformDispersion._weights>, '__annotations__': {}})¶
- __dir__()¶
Default dir() implementation.
- __doc__ = '\n Uniform dispersion, with width $\\sigma$.\n\n .. math::\n\n w = 1\n '¶
- __eq__(value, /)¶
Return self==value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- __getstate__()¶
Helper for pickle.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __init__(npts=None, width=None, nsigmas=None)¶
- classmethod __init_subclass__()¶
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(value, /)¶
Return self<=value.
- __lt__(value, /)¶
Return self<value.
- __module__ = 'sasmodels.weights'¶
- __ne__(value, /)¶
Return self!=value.
- classmethod __new__(*args, **kwargs)¶
- __reduce__()¶
Helper for pickle.
- __reduce_ex__(protocol, /)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __sizeof__()¶
Size of object in memory, in bytes.
- __str__()¶
Return str(self).
- classmethod __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__¶
list of weak references to the object
- _linspace(center, sigma, lb, ub)¶
helper function to provide linear spaced weight points within range
- _weights(center, sigma, lb, ub)¶
actual work of computing the weights
- default = {'npts': 35, 'nsigmas': None, 'width': 0}¶
- get_pars()¶
Return the parameters to the disperser as a dictionary.
- 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)¶
Set the weights on the disperser if it is
ArrayDispersion.
- type = 'uniform'¶
- 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 on the possible values.
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.
- sasmodels.weights.load_weights(pattern: str = None) None¶
Load dispersion distributions matching the given glob pattern
- sasmodels.weights.plot_weights(model_info: ModelInfo, mesh: list[tuple[float, ndarray, ndarray]]) None¶
Plot the weights returned by
get_weights().model_info defines model parameters, etc.
mesh is a list of tuples containing (value, dispersity, weights) for each parameter, where (dispersity, weights) pairs are the distributions to be plotted.