Esempio n. 1
0
    def __init__(self, r_s=None, rho_s=1 * u.Unit("GeV / cm3")):
        r_s = self.DEFAULT_SCALE_RADIUS if r_s is None else r_s

        self.parameters = Parameters([
            Parameter("r_s", u.Quantity(r_s)),
            Parameter("rho_s", u.Quantity(rho_s))
        ])
 def __init__(self, index, amplitude, reference, mean, width):
     self.parameters = Parameters([
         Parameter("index", index, min=0),
         Parameter("amplitude", amplitude, min=0),
         Parameter("reference", reference, frozen=True),
         Parameter("mean", mean, min=0),
         Parameter("width", width, min=0, frozen=True),
     ])
Esempio n. 3
0
    def __init__(self, r_s=None, alpha=None, rho_s=1 * u.Unit("GeV / cm3")):
        alpha = self.DEFAULT_ALPHA if alpha is None else alpha
        r_s = self.DEFAULT_SCALE_RADIUS if r_s is None else r_s

        self.parameters = Parameters([
            Parameter("r_s", u.Quantity(r_s)),
            Parameter("alpha", u.Quantity(alpha)),
            Parameter("rho_s", u.Quantity(rho_s)),
        ])
Esempio n. 4
0
    def parameters(self):
        """List of parameters (`~gammapy.utils.fitting.Parameters`)"""
        parameters = []

        if self.model:
            parameters += self.model.parameters.parameters

        if self.background_model:
            parameters += self.background_model.parameters.parameters

        return Parameters(parameters)
Esempio n. 5
0
 def __init__(self,
              amplitude=1E-12 * u.Unit('cm-2 s-1 TeV-1'),
              reference=10 * u.TeV,
              alpha=2,
              beta=1):
     self.parameters = Parameters([
         Parameter('amplitude', amplitude),
         Parameter('reference', reference, frozen=True),
         Parameter('alpha', alpha),
         Parameter('beta', beta)
     ])
Esempio n. 6
0
 def __init__(
     self,
     amplitude=1e-12 * u.Unit("cm-2 s-1 TeV-1"),
     reference=10 * u.TeV,
     alpha=2,
     beta=1,
 ):
     self.parameters = Parameters([
         Parameter("amplitude", amplitude),
         Parameter("reference", reference, frozen=True),
         Parameter("alpha", alpha),
         Parameter("beta", beta),
     ])
 def __init__(self):
     self.parameters = Parameters(
         [
             Parameter("amplitude", 3e-12, unit="cm-2 s-1 TeV-1"),
             Parameter("reference", 1, unit="TeV", frozen=True),
             Parameter("alpha", 2.4, min=1, max=5),
             Parameter("beta", 0.2, min=0.001, max=1),
             Parameter("z_fermi", 0),
             Parameter("z_magic", 0),
             Parameter("z_veritas", 0),
             Parameter("z_fact", 0),
             Parameter("z_hess", 0),
         ]
     )
Esempio n. 8
0
 def model(self, model):
     self._model = model
     if model is not None:
         self._parameters = Parameters(self._model.parameters.parameters)
         self._predictor = SpectrumEvaluator(
             model=self.model,
             livetime=self.livetime,
             aeff=self.aeff,
             e_true=self._energy_axis.edges,
             edisp=self.edisp,
         )
     else:
         self._parameters = None
         self._predictor = None
Esempio n. 9
0
def pars():
    x = Parameter("x", 2.1)
    y = Parameter("y", 3.1, scale=1e5)
    z = Parameter("z", 4.1, scale=1e-5)
    return Parameters([x, y, z])
Esempio n. 10
0
 def __init__(self):
     self.parameters = Parameters(
         [Parameter("x", 2),
          Parameter("y", 3e2),
          Parameter("z", 4e-2)])
Esempio n. 11
0
 def parameters(self):
     parameters = []
     for skymodel in self.skymodels:
         for p in skymodel.parameters:
             parameters.append(p)
     return Parameters(parameters)
Esempio n. 12
0
 def spectral_model(self, model):
     """`~gammapy.spectrum.models.SpectralModel`"""
     self._spectral_model = model
     self._parameters = Parameters(
         self.spatial_model.parameters.parameters +
         self.spectral_model.parameters.parameters)
Esempio n. 13
0
 def __init__(self):
     self.parameters = Parameters(
         [Parameter("x", 2),
          Parameter("y", 3e2),
          Parameter("z", 4e-2)])
     self.data_shape = (1, )
Esempio n. 14
0
def pars():
    return Parameters(
        [Parameter("spam", 42, "deg"),
         Parameter("ham", 99, "TeV")])
Esempio n. 15
0
def test_parameters_autoscale():
    pars = Parameters([Parameter("", 20)])
    pars.autoscale()
    assert_allclose(pars[0].factor, 2)
    assert_allclose(pars[0].scale, 10)