本文整理汇总了Python中model.ArithmeticModel类的典型用法代码示例。如果您正苦于以下问题:Python ArithmeticModel类的具体用法?Python ArithmeticModel怎么用?Python ArithmeticModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArithmeticModel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, name='integrate1d'):
tol = numpy.finfo(float).eps
self.epsabs = Parameter(name, 'epsabs', tol, alwaysfrozen=True)
self.epsrel = Parameter(name, 'epsrel', 0, alwaysfrozen=True)
self.maxeval = Parameter(name, 'maxeval', 10000, alwaysfrozen=True)
ArithmeticModel.__init__(self, name, (self.epsabs,self.epsrel,
self.maxeval))
示例2: __init__
def __init__(self, name='templatemodel', pars=(), parvals=[], templates=[]):
self.parvals = parvals
self.templates = templates
for par in pars:
self.__dict__[par.name] = par
# Construct kdtree from parameter space
self.tree = None
lpars = len(pars)
if lpars < 2:
raise TypeError("Use tablemodel for a single template parameter")
if lpars > 10:
raise TypeError("Greater than 10 template parameters is unsupported")
klass = getattr(sherpa.utils.kdtree, 'KDTree_%iDouble' % lpars)
tree = klass()
for ii, parval in enumerate(parvals):
tree.add((tuple(parval), ii))
tree.optimize()
self.tree = tree
ArithmeticModel.__init__(self, name, pars)
示例3: __init__
def __init__(self, name="box2d"):
self.xlow = Parameter(name, "xlow", 0)
self.xhi = Parameter(name, "xhi", 0)
self.ylow = Parameter(name, "ylow", 0)
self.yhi = Parameter(name, "yhi", 0)
self.ampl = Parameter(name, "ampl", 1)
ArithmeticModel.__init__(self, name, (self.xlow, self.xhi, self.ylow, self.yhi, self.ampl))
self.cache = 0
示例4: __init__
def __init__(self, name='tablemodel'):
# these attributes should remain somewhat private
# as not to conflict with user defined parameter names
self.__x = None
self.__y = None
self.__filtered_y = None
self.filename = None
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name, (self.ampl,))
示例5: __init__
def __init__(self, name='templatemodel', pars=(), parvals=[], templates=[]):
self.parvals = parvals
self.templates = templates
self.index = {}
for par in pars:
self.__dict__[par.name] = par
for ii, parval in enumerate(parvals):
self.index[tuple(parval)] = templates[ii]
ArithmeticModel.__init__(self, name, pars)
self.is_discrete = True
示例6: __init__
def __init__(self, name='sigmagauss2d'):
self.sigma_a = Parameter(name, 'sigma_a', 10, tinyval, hard_min=tinyval)
self.sigma_b = Parameter(name, 'sigma_b', 10, tinyval, hard_min=tinyval)
self.xpos = Parameter(name, 'xpos', 0)
self.ypos = Parameter(name, 'ypos', 0)
self.theta = \
Parameter(name, 'theta', 0, -2*numpy.pi, 2*numpy.pi, \
-2*numpy.pi, 4*numpy.pi, 'radians', frozen=True)
self.ampl = Parameter(name, 'ampl', 1)
ArithmeticModel.__init__(self, name,
(self.sigma_a, self.sigma_b, self.xpos,
self.ypos, self.theta, self.ampl))
self.cache = 0
示例7: __setstate__
def __setstate__(self, state):
self.__x = None
self.__y = state.pop('_y', None)
self.__filtered_y = state.pop('_filtered_y', None)
self.filename = state.pop('_file', None)
ArithmeticModel.__setstate__(self, state)
示例8: __init__
def __init__(self, name, template_model):
self.template_model = template_model
for par in template_model.pars:
self.__dict__[par.name] = par
ArithmeticModel.__init__(self, name, template_model.pars)