本文整理汇总了Python中sherpa.models.ArithmeticModel.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ArithmeticModel.__init__方法的具体用法?Python ArithmeticModel.__init__怎么用?Python ArithmeticModel.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sherpa.models.ArithmeticModel
的用法示例。
在下文中一共展示了ArithmeticModel.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='normal'):
self.sigma = Parameter(name, 'sigma', 1., alwaysfrozen=True)
self.x0 = Parameter(name, 'x0', 1., alwaysfrozen=True)
self.norm = Parameter(name, 'norm', 1., alwaysfrozen=True)
ArithmeticModel.__init__(self, name, (self.sigma, self.x0, self.norm))
示例2: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='simple_overfilling'):
self.amplitude = Parameter(name, 'amplitude', c0, min=0) # p[0], calibration constant
self.Ck = Parameter(name,'Ck', 1, min=0) # p[1], telescope efficiency parameter
# self.b = Parameter(name, 'b', 2, min=1, max=3) # p[2], range factor
# self.Cb = Parameter(name, 'Cb', 1) # background noise
# ArithmeticModel.__init__(self, name, (self.amplitude, self.Ck, self.Cb))
ArithmeticModel.__init__(self, name, (self.amplitude, self.Ck))
示例3: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, coord, energies, name='cube-model', use_psf=True, exposure=None, psf=None, spatial_model=None,
spectral_model=None, select_region=False, index_selected_region=None):
from scipy import signal
self.spatial_model = spatial_model
self.spectral_model = spectral_model
self.use_psf = use_psf
self.exposure = exposure
self.psf = psf
self._fftconvolve = signal.fftconvolve
xx = coord.data.lon.degree
yy = coord.data.lat.degree
self.xx_lo = xx[0:-1, 1:]
self.xx_hi = xx[0:-1, 0:-1]
self.yy_lo = yy[0:-1, 0:-1]
self.yy_hi = yy[1:, 0:-1]
self.ee_lo = energies[:-1]
self.ee_hi = energies[1:]
self.select_region = select_region
self.index_selected_region = index_selected_region
# Fix spectral ampl parameter
spectral_model.ampl = 1
spectral_model.ampl.freeze()
pars = []
for _ in spatial_model.pars + spectral_model.pars:
setattr(self, _.name, _)
pars.append(_)
self._spatial_pars = slice(0, len(spatial_model.pars))
self._spectral_pars = slice(len(spatial_model.pars), len(pars))
ArithmeticModel.__init__(self, name, pars)
示例4: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='myplexpcutoff'):
self.Eo = Parameter(name, 'Eo', 1, frozen=True, units='keV') # p[0] Normalized at 1 TeV by default
self.beta = Parameter(name, 'beta', 1e-1, min=1e-3, max=10, units='1/TeV') # p[1]
self.gamma = Parameter(name, 'gamma', 2, min=-1, max=5) # p[2]
self.No = Parameter(name, 'No', 1e-11, min=1e-15, max=1e-5, units='1/cm^2/s/TeV') # p[3]
ArithmeticModel.__init__(self, name, (self.Eo, self.beta, self.gamma, self.No))
示例5: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='normshell2d'):
self.xpos = Parameter(name, 'xpos', 0)
self.ypos = Parameter(name, 'ypos', 0)
self.ampl = Parameter(name, 'ampl', 1) # misnomer ... this is really the integral
self.r0 = Parameter(name, 'r0', 1, 0)
self.width = Parameter(name, 'width', 0.1, 0)
ArithmeticModel.__init__(self, name, (self.xpos, self.ypos, self.ampl, self.r0, self.width))
示例6: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='simple_overfilling'):
# p[0]
self.c0= Parameter(name, 'c1', 1)
#p[1]
self.c1 = Parameter(name, 'c2', 1)
#p[2]
self.c2=Parameter(name,'c3',1) #extra parameter
ArithmeticModel.__init__(self, name, (self.c0,self.c1,self.c2))
示例7: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='ecpl'):
self.gamma = Parameter(name, 'gamma', 2, min=-10, max=10)
self.ref = Parameter(name, 'ref', 1, frozen=True)
self.ampl = Parameter(name, 'ampl', 1, min=0)
self.cutoff = Parameter(name, 'cutoff', 1, min=0, units='1/TeV')
ArithmeticModel.__init__(self, name, (self.gamma, self.ref, self.ampl,
self.cutoff))
self._use_caching = True
self.cache = 10
示例8: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, gp_model):
self.gp_model = gp_model
self.parts = (self,)
modelname = 'GP' + gp_model.__class__.__name__
sherpa_pars = []
for par in gp_model.parameters.parameters:
sherpa_pars.append(par.to_sherpa())
ArithmeticModel.__init__(self, modelname, sherpa_pars)
示例9: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='cube-model', spatial_model=None, spectral_model=None):
self.spatial_model = spatial_model
self.spectral_model = spectral_model
# Fix spectral ampl parameter
spectral_model.ampl = 1
spectral_model.ampl.freeze()
pars = []
for _ in spatial_model.pars + spectral_model.pars:
setattr(self, _.name, _)
pars.append(_)
self._spatial_pars = slice(0, len(spatial_model.pars))
self._spectral_pars = slice(len(spatial_model.pars), len(pars))
ArithmeticModel.__init__(self, name, pars)
示例10: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, fit):
self.fit = fit
sherpa_name = 'sherpa_model'
par_list = list()
for par in self.fit.model.parameters.parameters:
sherpa_par = par.to_sherpa(modelname='source')
#setattr(self, name, sherpa_par)
par_list.append(sherpa_par)
if fit.stat != 'wstat' and self.fit.background_model is not None:
for par in self.fit.background_model.parameters.parameters:
sherpa_par = par.to_sherpa(modelname='background')
#setattr(self, name, sherpa_par)
par_list.append(sherpa_par)
ArithmeticModel.__init__(self, sherpa_name, par_list)
self._use_caching = True
self.cache = 10
示例11: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='proton'):
# First precompute some quantities
self.Ep_min = 1e-1 # TeV
self.Ep_max = 1e5 # TeV
self.nbins = 300
self.lEp_min = np.log10(self.Ep_min)
self.lEp_max = np.log10(self.Ep_max)
self.Ep = np.logspace(self.lEp_min, self.lEp_max, self.nbins)
self.lbsize = (self.lEp_max - self.Ep_min) / self.nbins
self.Fgam = None
self.EG = None
self.EP = None
self.ncalc = 0
# Instantiate parameters
self.Eo = Parameter(name, 'Eo', 10, frozen=True, units='TeV') # p[0] Normalized at 10 TeV by default
self.beta = Parameter(name, 'beta', 1., min=1e-3, max=1e4, units='1/PeV') # p[1]
self.gamma = Parameter(name, 'gamma', 2.2, min=-1, max=5) # p[2]
self.ampl = Parameter(name, 'ampl', 1e-11, min=1e-15, max=1e15, units='1/cm^2/s/TeV') # p[3]
self.Einf = Parameter(name, 'Einf', 1, frozen=True, units='TeV') # p[4] 1 TeV by default
self.Esup = Parameter(name, 'Esup', 100, frozen=True, units='TeV') # p[5] 100 TeV by default
ArithmeticModel.__init__(self, name, (self.Eo, self.beta, self.gamma, self.ampl, self.Einf, self.Esup))
示例12: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='simple_overfilling'):
self.C0 = Parameter(name, 'C0', 1, min=1)
self.C1 = Parameter(name, 'C1', 1, min=1)
self.C2 = Parameter(name, 'C2', 1, min=0)
self.b = Parameter(name, 'b', 2, min=1, max=3)
ArithmeticModel.__init__(self, name, (self.C0, self.C1, self.C2, self.b))
示例13: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name):
self.has_25 = Parameter(name, "has_25", 0, min=0, max=1)
ArithmeticModel.__init__(self, name, (self.has_25,))
示例14: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name="usermodel"):
self.param1 = Parameter(name, "param1", 1, min=0, max=100)
self.param2 = Parameter(name, "param2", 1, min=-100, max=100)
ArithmeticModel.__init__(self, name, (self.param1, self.param2))
示例15: __init__
# 需要导入模块: from sherpa.models import ArithmeticModel [as 别名]
# 或者: from sherpa.models.ArithmeticModel import __init__ [as 别名]
def __init__(self, name='usermodel'):
self.param1 = Parameter(name, 'param1', 1, min=0, max=100)
self.param2 = Parameter(name, 'param2', 1, min=-100, max=100)
ArithmeticModel.__init__(self, name, (self.param1,
self.param2))