How to use the sherpa.models.Parameter function in sherpa

To help you get started, we’ve selected a few sherpa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pkgw / pwkit / pwkit / sherpa.py View on Github external
def __init__(self, name, kt_array=None):
        if kt_array is None:
            kt_array = DEFAULT_KT_ARRAY
        else:
            kt_array = np.atleast_1d(np.asfarray(kt_array))

        self.gfac = Parameter(name, 'gfac', 0.5, 1e-4, 1e4, 1e-6, 1e6)
        self.Abundanc = Parameter(name, 'Abundanc', 1., 0., 5., 0.0, hugeval, frozen=True)
        self.redshift = Parameter(name, 'redshift', 0., -0.999, 10., -0.999, hugeval, frozen=True)
        self.norm = Parameter(name, 'norm', 1.0, 0.0, 1e24, 0.0, hugeval)

        self._kt_array = kt_array
        self._cur_cache_key = None
        self._cached_vals = None
        XSAdditiveModel.__init__(self, name, (self.gfac, self.Abundanc, self.redshift, self.norm))
github gammapy / gammapy / gammapy / hspec / models / plexpcutoff.py View on Github external
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))
github gammapy / gammapy / gammapy / hspec / models / plexpcutoff.py View on Github external
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))
github gammapy / gammapy / gammapy / cube / sherpa_.py View on Github external
def __init__(self, name='normgauss2dint'):
        # Gauss source parameters
        self.wcs = WCS.WCS()
        self.coordsys = "galactic"  # default
        self.binsize = 1.0
        self.xpos = Parameter(name, 'xpos', 0)  # p[0]
        self.ypos = Parameter(name, 'ypos', 0)  # p[1]
        self.ampl = Parameter(name, 'ampl', 1)  # p[2]
        self.fwhm = Parameter(name, 'fwhm', 1, min=0)  # p[3]
        self.shape = None
        self.n_ebins = None
        ArithmeticModel.__init__(self, name, (self.xpos, self.ypos, self.ampl, self.fwhm))
github pkgw / pwkit / pwkit / sherpa.py View on Github external
def __init__(self, name, kt_array=None):
        if kt_array is None:
            kt_array = DEFAULT_KT_ARRAY
        else:
            kt_array = np.atleast_1d(np.asfarray(kt_array))

        self.gfac = Parameter(name, 'gfac', 0.5, 1e-4, 1e4, 1e-6, 1e6)
        self.Abundanc = Parameter(name, 'Abundanc', 1., 0., 5., 0.0, hugeval, frozen=True)
        self.redshift = Parameter(name, 'redshift', 0., -0.999, 10., -0.999, hugeval, frozen=True)
        self.norm = Parameter(name, 'norm', 1.0, 0.0, 1e24, 0.0, hugeval)

        self._kt_array = kt_array
        self._cur_cache_key = None
        self._cached_vals = None
        XSAdditiveModel.__init__(self, name, (self.gfac, self.Abundanc, self.redshift, self.norm))
github gammapy / gammapy / gammapy / spectrum / sherpa_utils.py View on Github external
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
github gammapy / gammapy / gammapy / spectrum / sherpa_models.py View on Github external
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
github gammapy / gammapy / gammapy / hspec / models / proton.py View on Github external
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))
github gammapy / gammapy / gammapy / spectrum / sherpa_utils.py View on Github external
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
github gammapy / gammapy / gammapy / hspec / models / proton.py View on Github external
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))