本文整理汇总了Python中parameter.Parameter.set方法的典型用法代码示例。如果您正苦于以下问题:Python Parameter.set方法的具体用法?Python Parameter.set怎么用?Python Parameter.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameter.Parameter
的用法示例。
在下文中一共展示了Parameter.set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Gauss2D
# 需要导入模块: from parameter import Parameter [as 别名]
# 或者: from parameter.Parameter import set [as 别名]
class Gauss2D(ArithmeticModel):
def __init__(self, name='gauss2d'):
self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
self.xpos = Parameter(name, 'xpos', 0)
self.ypos = Parameter(name, 'ypos', 0)
self.ellip = Parameter(name, 'ellip', 0, 0, 0.999, 0, 0.9999,
frozen=True)
self.theta = Parameter(name, 'theta', 0, 0, 2*numpy.pi, -2*numpy.pi,
4*numpy.pi, 'radians', frozen=True)
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name,
(self.fwhm, self.xpos, self.ypos, self.ellip,
self.theta, self.ampl))
self.cache = 0
def get_center(self):
return (self.xpos.val, self.ypos.val)
def set_center(self, xpos, ypos, *args, **kwargs):
self.xpos.set(xpos)
self.ypos.set(ypos)
def guess(self, dep, *args, **kwargs):
xpos, ypos = guess_position(dep, *args)
norm = guess_amplitude2d(dep, *args)
param_apply_limits(xpos, self.xpos, **kwargs)
param_apply_limits(ypos, self.ypos, **kwargs)
param_apply_limits(norm, self.ampl, **kwargs)
def calc(self, *args, **kwargs):
kwargs['integrate']=bool_cast(self.integrate)
return _modelfcts.gauss2d(*args, **kwargs)
示例2: Delta2D
# 需要导入模块: from parameter import Parameter [as 别名]
# 或者: from parameter.Parameter import set [as 别名]
class Delta2D(ArithmeticModel):
def __init__(self, name='delta2d'):
self.xpos = Parameter(name, 'xpos', 0)
self.ypos = Parameter(name, 'ypos', 0)
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name, (self.xpos, self.ypos, self.ampl))
self.cache = 0
def get_center(self):
return (self.xpos.val, self.ypos.val)
def set_center(self, xpos, ypos, *args, **kwargs):
self.xpos.set(xpos)
self.ypos.set(ypos)
def guess(self, dep, *args, **kwargs):
xpos, ypos = guess_position(dep, *args)
norm = guess_amplitude2d(dep, *args)
param_apply_limits(xpos, self.xpos, **kwargs)
param_apply_limits(ypos, self.ypos, **kwargs)
param_apply_limits(norm, self.ampl, **kwargs)
def calc(self, *args, **kwargs):
kwargs['integrate']=bool_cast(self.integrate)
return _modelfcts.delta2d(*args, **kwargs)
示例3: NormGauss1D
# 需要导入模块: from parameter import Parameter [as 别名]
# 或者: from parameter.Parameter import set [as 别名]
class NormGauss1D(ArithmeticModel):
def __init__(self, name='normgauss1d'):
self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
self.pos = Parameter(name, 'pos', 0)
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name, (self.fwhm, self.pos, self.ampl))
def get_center(self):
return (self.pos.val,)
def set_center(self, pos, *args, **kwargs):
self.pos.set(pos)
def guess(self, dep, *args, **kwargs):
ampl = guess_amplitude(dep, *args)
pos = get_position(dep, *args)
fwhm = guess_fwhm(dep, *args)
param_apply_limits(pos, self.pos, **kwargs)
param_apply_limits(fwhm, self.fwhm, **kwargs)
# Apply normalization factor to guessed amplitude
norm = numpy.sqrt(numpy.pi/_gfactor)*self.fwhm.val
for key in ampl.keys():
if ampl[key] is not None:
ampl[key] *= norm
param_apply_limits(ampl, self.ampl, **kwargs)
@modelCacher1d
def calc(self, *args, **kwargs):
kwargs['integrate']=bool_cast(self.integrate)
return _modelfcts.ngauss1d(*args, **kwargs)
示例4: Gauss1D
# 需要导入模块: from parameter import Parameter [as 别名]
# 或者: from parameter.Parameter import set [as 别名]
class Gauss1D(ArithmeticModel):
def __init__(self, name='gauss1d'):
self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
self.pos = Parameter(name, 'pos', 0)
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name, (self.fwhm, self.pos, self.ampl))
def get_center(self):
return (self.pos.val,)
def set_center(self, pos, *args, **kwargs):
self.pos.set(pos)
def guess(self, dep, *args, **kwargs):
norm = guess_amplitude(dep, *args)
pos = get_position(dep, *args)
fwhm = guess_fwhm(dep, *args)
param_apply_limits(norm, self.ampl, **kwargs)
param_apply_limits(pos, self.pos, **kwargs)
param_apply_limits(fwhm, self.fwhm, **kwargs)
@modelCacher1d
def calc(self, *args, **kwargs):
kwargs['integrate']=bool_cast(self.integrate)
return _modelfcts.gauss1d(*args, **kwargs)
示例5: NormGauss2D
# 需要导入模块: from parameter import Parameter [as 别名]
# 或者: from parameter.Parameter import set [as 别名]
class NormGauss2D(ArithmeticModel):
def __init__(self, name='normgauss2d'):
self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
self.xpos = Parameter(name, 'xpos', 0)
self.ypos = Parameter(name, 'ypos', 0)
self.ellip = Parameter(name, 'ellip', 0, 0, 0.999, 0, 0.9999,
frozen=True)
self.theta = Parameter(name, 'theta', 0, 0, 2*numpy.pi, -2*numpy.pi,
4*numpy.pi, 'radians', frozen=True)
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name,
(self.fwhm, self.xpos, self.ypos, self.ellip,
self.theta, self.ampl))
self.cache = 0
def get_center(self):
return (self.xpos.val, self.ypos.val)
def set_center(self, xpos, ypos, *args, **kwargs):
self.xpos.set(xpos)
self.ypos.set(ypos)
def guess(self, dep, *args, **kwargs):
xpos, ypos = guess_position(dep, *args)
ampl = guess_amplitude2d(dep, *args)
param_apply_limits(xpos, self.xpos, **kwargs)
param_apply_limits(ypos, self.ypos, **kwargs)
# Apply normalization factor to guessed amplitude
norm = (numpy.pi/_gfactor)*self.fwhm.val*self.fwhm.val*numpy.sqrt(1.0 - (self.ellip.val*self.ellip.val))
for key in ampl.keys():
if ampl[key] is not None:
ampl[key] *= norm
param_apply_limits(ampl, self.ampl, **kwargs)
def calc(self, *args, **kwargs):
kwargs['integrate']=bool_cast(self.integrate)
return _modelfcts.ngauss2d(*args, **kwargs)
示例6: Delta1D
# 需要导入模块: from parameter import Parameter [as 别名]
# 或者: from parameter.Parameter import set [as 别名]
class Delta1D(ArithmeticModel):
def __init__(self, name="delta1d"):
self.pos = Parameter(name, "pos", 0)
self.ampl = Parameter(name, "ampl", 1)
ArithmeticModel.__init__(self, name, (self.pos, self.ampl))
def get_center(self):
return (self.pos.val,)
def set_center(self, pos, *args, **kwargs):
self.pos.set(pos)
def guess(self, dep, *args, **kwargs):
norm = guess_amplitude(dep, *args)
pos = get_position(dep, *args)
param_apply_limits(norm, self.ampl, **kwargs)
param_apply_limits(pos, self.pos, **kwargs)
@modelCacher1d
def calc(self, *args, **kwargs):
kwargs["integrate"] = bool_cast(self.integrate)
return _modelfcts.delta1d(*args, **kwargs)