当前位置: 首页>>代码示例>>Python>>正文


Python NoNewAttributesAfterInit.__init__方法代码示例

本文整理汇总了Python中sherpa.utils.NoNewAttributesAfterInit.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python NoNewAttributesAfterInit.__init__方法的具体用法?Python NoNewAttributesAfterInit.__init__怎么用?Python NoNewAttributesAfterInit.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sherpa.utils.NoNewAttributesAfterInit的用法示例。


在下文中一共展示了NoNewAttributesAfterInit.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self, modelname, name, val, min=-hugeval, max=hugeval,
                 hard_min=-hugeval, hard_max=hugeval, units='',
                 frozen=False, alwaysfrozen=False, hidden=False, aliases=None):
        self.modelname = modelname
        self.name = name
        self.fullname = '%s.%s' % (modelname, name)

        self._hard_min = SherpaFloat(hard_min)
        self._hard_max = SherpaFloat(hard_max)
        self.units = units

        self._alwaysfrozen = bool(alwaysfrozen)
        if alwaysfrozen:
            self._frozen = True
        else:
            self._frozen = frozen

        self.hidden = hidden

        # Set validated attributes.  Access them via their properties so that
        # validation takes place.
        self.min = min
        self.max = max
        self.val = val
        self.default_min = min
        self.default_max = max
        self.default_val = val
        self.link = None
        self._guessed = False

        self.aliases = [a.lower() for a in aliases] if aliases is not None else []

        NoNewAttributesAfterInit.__init__(self)
开发者ID:DougBurke,项目名称:sherpa,代码行数:35,代码来源:parameter.py

示例2: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self, pha):
        self.pha = pha
        arf, rmf = pha.get_response()
        if arf is None and rmf is None:
            raise DataErr('norsp', pha.name)

        NoNewAttributesAfterInit.__init__(self)
开发者ID:mirca,项目名称:sherpa,代码行数:9,代码来源:instrument.py

示例3: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self):
     self.priors = {}
     self._walker = Walk
     self._sampler = MetropolisMH
     self._sampler_opt = get_keyword_defaults(MetropolisMH.init)
     self.sample = None
     self.walk = lambda: None
     NoNewAttributesAfterInit.__init__(self)
开发者ID:DougBurke,项目名称:sherpa,代码行数:10,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self, ratios, stats, samples, lr, ppp, null, alt):
     self.ratios = numpy.asarray(ratios)
     self.stats = numpy.asarray(stats)
     self.samples = numpy.asarray(samples)
     self.lr = float(lr)
     self.ppp = float(ppp)
     self.null = float(null)
     self.alt = float(alt)
     NoNewAttributesAfterInit.__init__(self)
开发者ID:anetasie,项目名称:sherpa,代码行数:11,代码来源:simulate.py

示例5: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self, name, type, crval, crpix, cdelt,
              crota=0.0, epoch=2000.0, equinox=2000.0):
     self.name = name
     self.type = type
     self.crval = numpy.asarray(crval, dtype=float)
     self.crpix = numpy.asarray(crpix, dtype=float)
     self.cdelt = numpy.asarray(cdelt, dtype=float)
     self.crota = crota
     self.epoch = epoch
     self.equinox = equinox
     NoNewAttributesAfterInit.__init__(self)
开发者ID:anetasie,项目名称:sherpa-old,代码行数:13,代码来源:wcs.py

示例6: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self):
        """

        Initialize a Plot object.  All 1D line plot
        instances utilize Plot, which provides a generic
        interface to a backend.

        Once an instance of Plot is initialized no new
        attributes of the class can be made. (To eliminate
        the accidental creation of erroneous attributes)
        
        """
        self.plot_prefs = self.plot_prefs.copy()
        NoNewAttributesAfterInit.__init__(self)
开发者ID:brefsdal,项目名称:sherpa,代码行数:16,代码来源:__init__.py

示例7: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self, fit, results, init_stat, param_warnings):
        _vals   = fit.data.eval_model_to_fit(fit.model)
        _dof    = len(_vals) - len(tuple(results[1]))
        _qval   = None
        _rstat  = None
        _covarerr = results[4].get('covarerr')
        if (isinstance(fit.stat, (CStat,Chi2)) and
            not isinstance(fit.stat, LeastSq)):
            if _dof > 0 and results[2] >= 0.0:
                _qval = igamc(_dof/2., results[2]/2.)
                _rstat = results[2]/_dof
            else:
                _rstat = nan

        self.succeeded    = results[0]
        self.parnames     = tuple(p.fullname for p in fit.model.pars
                                  if not p.frozen)
        self.parvals      = tuple(results[1])
        self.istatval     = init_stat
        self.statval      = results[2]
        self.dstatval     = abs(results[2]-init_stat)
        self.numpoints    = len(_vals)
        self.dof          = _dof
        self.qval         = _qval
        self.rstat        = _rstat
        self.message      = results[3]
        if _covarerr is not None:
            self.covarerr      = tuple(_covarerr)
        else:
            self.covarerr      = None
        self.nfev         = results[4].get('nfev')
        self.extra_output = results[4]
        self.modelvals    = _vals
        self.methodname   = type(fit.method).__name__.lower()
        self.itermethodname = fit._iterfit.itermethod_opts['name']
        statname     = type(fit.stat).__name__.lower()
	if isinstance(fit.stat, Chi2) and not isinstance(fit.stat, LeastSq):
		isSimulFit = isinstance(fit.data, DataSimulFit)
           	if isSimulFit:
			is_error_set = [d.staterror is not None for d in fit.data.datasets]
			if all(is_error_set):
                		statname = 'chi2'
		elif fit.data.staterror is not None:
            		statname = 'chi2'
	self.statname = statname
        self.datasets     = None # To be filled by calling function
        self.param_warnings = param_warnings
        NoNewAttributesAfterInit.__init__(self)
开发者ID:anetasie,项目名称:sherpa-old,代码行数:50,代码来源:fit.py

示例8: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self):
        """

        Initialize a data object.  This method can only be called from
        a derived class constructor.  Attempts to create a BaseData
        instance will raise NotImplementedErr.

        Derived class constructors must call this method directly (and
        not indirectly through a superclass constructor).  When thus
        invoked, this method will extract the argument names and
        values from the derived class constructor invocation and set
        corresponding attributes on the instance (thereby eliminating
        the need for the derived class constructor to do its own
        attribute setting).  If the name of an argument matches the
        name of a DataProperty of the derived class, then the
        corresponding attribute name will have an underscore prepended
        (meaning the property will use the value directly instead of
        relying on _get_*/_set_* methods).

        """

        if type(self) is BaseData:
            raise NotImplementedErr('noinstanceallowed', 'BaseData')

        frame = sys._getframe().f_back
        cond = (frame.f_code is self.__init__.im_func.func_code)
        assert cond, (('%s constructor must call BaseData constructor ' +
                       'directly') % type(self).__name__)
        args = inspect.getargvalues(frame)

        self._fields = tuple(args[0][1:])
        for f in self._fields:
            cond = (f not in vars(self))
            assert cond, (("'%s' object already has attribute '%s'") %
                          (type(self).__name__, f))
            setattr(self, f, args[3][f])

        self.filter = None
        self.mask = True

        NoNewAttributesAfterInit.__init__(self)
开发者ID:OrbitalMechanic,项目名称:sherpa,代码行数:43,代码来源:data.py

示例9: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self, dshape, kshape, norm=False, frozen=True,
                 center=None, args=[], kwargs={},
                 do_pad=False, pad_mask=None, origin=None):

        if origin is None:
            origin = numpy.zeros(len(kshape))
        self.dshape = dshape
        self.kshape = kshape
        self.kernel = None
        self.skshape= None
        self.norm   = norm
        self.origin = origin
        self.frozen = frozen
        self.center = center
        self.args = args
        self.kwargs = kwargs
        self.renorm_shape = None
        self.renorm = None
        self.do_pad = do_pad
        self.pad_mask = pad_mask
        self.frac = None
        self._tcd = tcdData()
        NoNewAttributesAfterInit.__init__(self)
开发者ID:cxcdev,项目名称:sherpa,代码行数:25,代码来源:instrument.py

示例10: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self, name, optfunc):        
        self.name = name
	self._optfunc = optfunc
        self.config = self.default_config
        NoNewAttributesAfterInit.__init__(self)
开发者ID:anetasie,项目名称:sherpa-old,代码行数:7,代码来源:__init__.py

示例11: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self):
     self.__header = {}
     NoNewAttributesAfterInit.__init__(self)
开发者ID:DougBurke,项目名称:sherpa,代码行数:5,代码来源:meta.py

示例12: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self):
     NoNewAttributesAfterInit.__init__(self)
开发者ID:anetasie,项目名称:sherpa-old,代码行数:4,代码来源:__init__.py

示例13: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self):
     self.x = 1
     self.y = 2
     self.z = 3
     del self.z
     NoNewAttributesAfterInit.__init__(self)
开发者ID:mirca,项目名称:sherpa,代码行数:8,代码来源:test_utils.py

示例14: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
    def __init__(self, name, pars=()):
	self.name = name
        self.type = self.__class__.__name__.lower()
	self.pars = tuple(pars)
        NoNewAttributesAfterInit.__init__(self)
开发者ID:anetasie,项目名称:sherpa-old,代码行数:7,代码来源:model.py

示例15: __init__

# 需要导入模块: from sherpa.utils import NoNewAttributesAfterInit [as 别名]
# 或者: from sherpa.utils.NoNewAttributesAfterInit import __init__ [as 别名]
 def __init__(self, name):
     self.name = name
     NoNewAttributesAfterInit.__init__(self)
开发者ID:cxcdev,项目名称:sherpa,代码行数:5,代码来源:__init__.py


注:本文中的sherpa.utils.NoNewAttributesAfterInit.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。