本文整理汇总了Python中sans.models.BaseComponent.BaseComponent类的典型用法代码示例。如果您正苦于以下问题:Python BaseComponent类的具体用法?Python BaseComponent怎么用?Python BaseComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
## Name of the model
self.name = "Debye"
self.description="""
F(x) = 2( exp(-x) + x - 1 )/x**2
with x = (q*R_g)**2
The model has three parameters:
Rg = radius of gyration
scale = scale factor
bkd = Constant background
"""
## Define parameters
self.params = {}
self.params['rg'] = 50.0
self.params['scale'] = 1.0
self.params['background'] = 0.0
## Parameter details [units, min, max]
self.details = {}
self.details['rg'] = ['[A]', None, None]
self.details['scale'] = ['', None, None]
self.details['background'] = ['[1/cm]', None, None]
#list of parameter that cannot be fitted
self.fixed= []
示例2: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CSLDCalFunc.__init__, (self,))
CSLDCalFunc.__init__(self)
## Name of the model
self.name = "SLDCalFunc"
## Model description
self.description ="""To calculate sld values"""
## Parameter details [units, min, max]
self.details = {}
self.details['fun_type'] = ['', None, None]
self.details['npts_inter'] = ['', None, None]
self.details['shell_num'] = ['', None, None]
self.details['nu_inter'] = ['', None, None]
self.details['sld_left'] = ['[1/A^(2)]', None, None]
self.details['sld_right'] = ['[1/A^(2)]', None, None]
## fittable parameters
self.fixed=['</text>']
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例3: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CSchulz.__init__, (self,))
CSchulz.__init__(self)
## Name of the model
self.name = "Schulz"
## Model description
self.description =""" f(x)=scale * math.pow(z+1, z+1)*math.pow((R), z)*
math.exp(-R*(z+1))/(center*gamma(z+1)
z= math.pow[(1/(sigma/center),2]-1"""
## Parameter details [units, min, max]
self.details = {}
self.details['scale'] = ['', None, None]
self.details['sigma'] = ['', None, None]
self.details['center'] = ['', None, None]
## fittable parameters
self.fixed=[]
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例4: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
## Name of the model
self.name = "Power_Law"
## Define parameters
self.params = {}
self.params['m'] = 4.0
self.params['scale'] = 1.0
self.params['background'] = 0.0
self.description=""" The Power_Law model.
F(x) = scale* (x)^(-m) + bkd
The model has three parameters:
m = power
scale = scale factor
bkd = incoherent background"""
## Parameter details [units, min, max]
self.details = {}
self.details['m'] = ['', 0, None]
self.details['scale'] = ['', None, None]
self.details['background'] = ['[1/cm]', None, None]
#list of parameter that cannot be fitted
self.fixed= []
示例5: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CFlexCylEllipXModel.__init__, (self,))
CFlexCylEllipXModel.__init__(self)
## Name of the model
self.name = "FlexCylEllipXModel"
## Model description
self.description =""" Note : scale and contrast=sldCyl-sldSolv are both multiplicative factors in the
model and are perfectly correlated. One or
both of these parameters must be held fixed
during model fitting."""
## Parameter details [units, min, max]
self.details = {}
self.details['scale'] = ['', None, None]
self.details['length'] = ['[A]', None, None]
self.details['kuhn_length'] = ['[A]', None, None]
self.details['radius'] = ['[A]', None, None]
self.details['axis_ratio'] = ['', None, None]
self.details['sldCyl'] = ['[1/A^(2)]', None, None]
self.details['sldSolv'] = ['[1/A^(2)]', None, None]
self.details['background'] = ['[1/cm]', None, None]
## fittable parameters
self.fixed=['length.width', 'kuhn_length.width', 'radius.width', 'axis_ratio.width']
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例6: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CGaussian.__init__, (self,))
CGaussian.__init__(self)
## Name of the model
self.name = "Gaussian"
## Model description
self.description ="""f(x)=scale * 1/(sigma^2*2pi)e^(-(x-mu)^2/2sigma^2)"""
## Parameter details [units, min, max]
self.details = {}
self.details['scale'] = ['', None, None]
self.details['sigma'] = ['', None, None]
self.details['center'] = ['', None, None]
## fittable parameters
self.fixed=[]
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例7: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CDiamCylFunc.__init__, (self,))
CDiamCylFunc.__init__(self)
## Name of the model
self.name = "DiamCylFunc"
## Model description
self.description ="""To calculate the 2nd virial coefficient for
the non-spherical object, then find the
radius of sphere that has this value of
virial coefficient."""
## Parameter details [units, min, max]
self.details = {}
self.details['radius'] = ['A', None, None]
self.details['length'] = ['A', None, None]
## fittable parameters
self.fixed=['radius.width', 'length.width']
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例8: setParam
def setParam(self, name, value):
"""
"""
if name.lower() in self.params:
BaseComponent.setParam(self, name, value)
else:
self.model.setParam(name, value)
示例9: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CLorentzian.__init__, (self,))
CLorentzian.__init__(self)
## Name of the model
self.name = "Lorentzian"
## Model description
self.description ="""f(x)=scale * 1/pi 0.5gamma / [ (x-x_0)^2 + (0.5gamma)^2 ]"""
## Parameter details [units, min, max]
self.details = {}
self.details['scale'] = ['', None, None]
self.details['gamma'] = ['', None, None]
self.details['center'] = ['', None, None]
## fittable parameters
self.fixed=[]
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例10: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CDiamEllipFunc.__init__, (self,))
CDiamEllipFunc.__init__(self)
## Name of the model
self.name = "DiamEllipFunc"
## Model description
self.description ="""To calculate the 2nd virial coefficient for
the non-spherical object, then find the
radius of sphere that has this value of
virial coefficient:
radius_a = polar radius,
radius_b = equatorial radius;
radius_a > radius_b: Prolate spheroid,
radius_a < radius_b: Oblate spheroid."""
## Parameter details [units, min, max]
self.details = {}
self.details['radius_a'] = ['A', None, None]
self.details['radius_b'] = ['A', None, None]
## fittable parameters
self.fixed=['radius_a.width', 'radius_b.width']
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []
示例11: __init__
def __init__(self, model_info, parameter_collection):
""" Initialization"""
BaseComponent.__init__(self)
self.model_info = model_info
pars = model_info.parameters
# ===== Variable state which needs to be copied/saved =====
self.params = dict((p.name, p.default) for p in pars)
self.details = dict((p.name, [p.unit, None, None]) for p in pars)
self.dispersion = dict((p.name, GaussianDispersion().get_pars()) for p in pars
if p.flags & ParameterFlags.Polydisperse)
#list of parameter that start out fixed by default
self.fixed = []
# ===== Fixed state that is not changed by the sasview gui =====
## Name of the model
self.name = model_info.name
self.description = model_info.description
self.non_fittable = [p.name for p in pars
if p.flags & (ParameterFlags.Unfittable | ParameterFlags.RepeatCount)]
self.orientation_params = [p.name for p in pars
if p.flags & ParameterFlags.Orientation]
self.magnetic_params = [p.name for p in pars
if p.flags & ParameterFlags.Magnetic]
## independent parameter name and unit [string]
self.input_name = "Q"
self.input_unit = "A^{-1}"
## output name and unit [string]
self.output_name = "Intensity"
self.output_unit = "cm^{-1}"
示例12: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
## Name of the model
self.name = "GuinierPorod"
self.description=""" I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql
= scale/q^m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql
where ql = sqrt((m-s)(3-s)/2)/Rg.
List of parameters:
scale = Guinier Scale
s = Dimension Variable
Rg = Radius of Gyration [A]
m = Porod Exponent
background = Background [1/cm]"""
## Define parameters
self.params = {}
self.params['scale'] = 1.0
self.params['dim'] = 1.0
self.params['rg'] = 100.0
self.params['m'] = 3.0
self.params['background'] = 0.1
## Parameter details [units, min, max]
self.details = {}
self.details['scale'] = ['', None, None]
self.details['dim'] = ['', None, None]
self.details['rg'] = ['[A]', None, None]
self.details['m'] = ['', None, None]
self.details['background'] = ['[1/cm]', None, None]
#list of parameter that cannot be fitted
self.fixed= []
示例13: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
## Name of the model
self.name = "GaussLorentzGel"
self.description="""I(q)=scale_g*exp(-q^2*Z^2/2)+scale_l/(1+q^2*z^2)
+ background
List of default parameters:
scale_g = Gauss scale factor
stat_colength = Static correlation length
scale_l = Lorentzian scale factor
dyn_colength = Dynamic correlation length
background = Incoherent background
"""
## Define parameters
self.params = {}
self.params['scale_g'] = 100.0
self.params['stat_colength'] = 100.0
self.params['scale_l'] = 50.0
self.params['dyn_colength'] = 20.0
self.params['background'] = 0.0
## Parameter details [units, min, max]
self.details = {}
self.details['scale_g'] = ['', None, None]
self.details['stat_colength'] = ['A', None, None]
self.details['scale_l'] = ['', None, None]
self.details['dyn_colength'] = ['A', None, None]
self.details['background'] = ['[1/cm]', None, None]
#list of parameter that cannot be fitted
self.fixed= []
示例14: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
## Name of the model
self.name = "Teubner Strey"
self.description="""The TeubnerStrey model.
F(x) = 1/( scale + c1*(x)^(2)+ c2*(x)^(4)) + bkd
The model has Four parameters:
scale = scale factor
c1 = constant
c2 = constant
bkd = incoherent background"""
## Define parameters
self.params = {}
self.params['c1'] = -30.0
self.params['c2'] = 5000.0
self.params['scale'] = 0.1
self.params['background'] = 0.0
## Parameter details [units, min, max]
self.details = {}
self.details['c1'] = ['', None, None ]
self.details['c2'] = ['', None, None ]
self.details['scale'] = ['', None, None]
self.details['background'] = ['[1/cm]', None, None]
#list of parameter that cannot be fitted
self.fixed= []
示例15: __init__
def __init__(self):
""" Initialization """
# Initialize BaseComponent first, then sphere
BaseComponent.__init__(self)
#apply(CPoly_GaussCoil.__init__, (self,))
CPoly_GaussCoil.__init__(self)
## Name of the model
self.name = "Poly_GaussCoil"
## Model description
self.description ="""I(q)=(scale)*2*[(1+U*x)^(-1/U)+x-1]/[(1+U)*x^2] + background
where x = [rg^2*q^2]
and the polydispersity is
U = [M_w/M_n]-1.
scale = scale factor * volume fraction
rg = radius of gyration
poly_m = polydispersity of molecular weight
background = incoherent background"""
## Parameter details [units, min, max]
self.details = {}
self.details['scale'] = ['', None, None]
self.details['rg'] = ['[A]', None, None]
self.details['poly_m'] = ['[Mw/Mn]', None, None]
self.details['background'] = ['[1/cm]', None, None]
## fittable parameters
self.fixed=[]
## non-fittable parameters
self.non_fittable = []
## parameters with orientation
self.orientation_params = []