##############################################################################
# This software was developed by the University of Tennessee as part of the
# Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
# project funded by the US National Science Foundation.
#
# If you use DANSE applications to do scientific research that leads to
# publication, we ask that you acknowledge the use of the software with the
# following sentence:
#
# This work benefited from DANSE software developed under NSF award DMR-0520547
#
# Copyright 2008-2011, University of Tennessee
##############################################################################
"""
Provide functionality for a C extension model
.. WARNING::
THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
DO NOT MODIFY THIS FILE, MODIFY
src/sas/models/include/TwoYukawa.h
AND RE-RUN THE GENERATOR SCRIPT
"""
from sas.models.BaseComponent import BaseComponent
from sas.models.sas_extension.c_models import CTwoYukawaModel
[docs]def create_TwoYukawaModel():
"""
Create a model instance
"""
obj = TwoYukawaModel()
# CTwoYukawaModel.__init__(obj) is called by
# the TwoYukawaModel constructor
return obj
[docs]class TwoYukawaModel(CTwoYukawaModel, BaseComponent):
"""
Class that evaluates a TwoYukawaModel model.
This file was auto-generated from src/sas/models/include/TwoYukawa.h.
Refer to that file and the structure it contains
for details of the model.
List of default parameters:
* volfraction = 0.2
* effect_radius = 50.0 [A]
* scale_K1 = 6.0
* decayConst_Z1 = 10.0
* scale_K2 = -1.0
* decayConst_Z2 = 2.0
"""
def __init__(self, multfactor=1):
""" Initialization """
self.__dict__ = {}
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CTwoYukawaModel.__init__, (self,))
CTwoYukawaModel.__init__(self)
self.is_multifunc = False
## Name of the model
self.name = "TwoYukawaModel"
## Model description
self.description = """
Structure factor for interacting particles: .
Calculates the structure factor, S(q), for a monodisperse spherical particle interacting
through a two-Yukawa potential. The Mean Spherical Approximation is used as the
closure to solve the Ornstein-Zernicke equations.
The function calculated is S(q), based on the solution of the Ornstein-Zernicke equations
using the Two-Yukawa potential (in its scaled form, r=r/diam):
Radius is that of the hard core. The returned value is dimensionless.
"""
## Parameter details [units, min, max]
self.details = {}
self.details['volfraction'] = ['', None, None]
self.details['effect_radius'] = ['[A]', None, None]
self.details['scale_K1'] = ['', None, None]
self.details['decayConst_Z1'] = ['', None, None]
self.details['scale_K2'] = ['', None, None]
self.details['decayConst_Z2'] = ['', None, None]
## fittable parameters
self.fixed = []
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
## parameters with magnetism
self.magnetic_params = []
self.category = None
self.multiplicity_info = None
def __setstate__(self, state):
"""
restore the state of a model from pickle
"""
self.__dict__, self.params, self.dispersion = state
def __reduce_ex__(self, proto):
"""
Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
c model.
"""
state = (self.__dict__, self.params, self.dispersion)
return (create_TwoYukawaModel, tuple(), state, None, None)
[docs] def clone(self):
""" Return a identical copy of self """
return self._clone(TwoYukawaModel())
[docs] def run(self, x=0.0):
"""
Evaluate the model
:param x: input q, or [q,phi]
:return: scattering function P(q)
"""
return CTwoYukawaModel.run(self, x)
[docs] def runXY(self, x=0.0):
"""
Evaluate the model in cartesian coordinates
:param x: input q, or [qx, qy]
:return: scattering function P(q)
"""
return CTwoYukawaModel.runXY(self, x)
[docs] def evalDistribution(self, x):
"""
Evaluate the model in cartesian coordinates
:param x: input q[], or [qx[], qy[]]
:return: scattering function P(q[])
"""
return CTwoYukawaModel.evalDistribution(self, x)
[docs] def calculate_ER(self):
"""
Calculate the effective radius for P(q)*S(q)
:return: the value of the effective radius
"""
return CTwoYukawaModel.calculate_ER(self)
[docs] def calculate_VR(self):
"""
Calculate the volf ratio for P(q)*S(q)
:return: the value of the volf ratio
"""
return CTwoYukawaModel.calculate_VR(self)
[docs] def set_dispersion(self, parameter, dispersion):
"""
Set the dispersion object for a model parameter
:param parameter: name of the parameter [string]
:param dispersion: dispersion object of type DispersionModel
"""
return CTwoYukawaModel.set_dispersion(self,
parameter, dispersion.cdisp)
# End of file