Esempio n. 1
0
     name="ecpl_2",
     model=ExpCutoffPowerLawSpectralModel(
         index=2.0 * u.Unit(""),
         amplitude=4 / u.cm**2 / u.s / u.TeV,
         reference=1 * u.TeV,
         lambda_=0.1 / u.TeV,
     ),
     val_at_2TeV=u.Quantity(0.81873075, "cm-2 s-1 TeV-1"),
     integral_1_10TeV=u.Quantity(2.83075297, "cm-2 s-1"),
     eflux_1_10TeV=u.Quantity(6.41406327, "TeV cm-2 s-1"),
     e_peak=np.nan * u.TeV,
 ),
 dict(
     name="GaussianSpectralModel",
     model=GaussianSpectralModel(amplitude=4 / u.cm**2 / u.s,
                                 mean=2 * u.TeV,
                                 sigma=0.2 * u.TeV),
     val_at_2TeV=u.Quantity(7.978845608028654, "cm-2 s-1 TeV-1"),
     val_at_3TeV=u.Quantity(2.973439029468601e-05, "cm-2 s-1 TeV-1"),
     integral_1_10TeV=u.Quantity(3.9999988533937123, "cm-2 s-1"),
     integral_infinity=u.Quantity(4, "cm-2 s-1"),
     eflux_1_10TeV=u.Quantity(7.999998896163037, "TeV cm-2 s-1"),
 ),
 dict(
     name="ecpl",
     model=ExpCutoffPowerLawSpectralModel(
         index=1.8 * u.Unit(""),
         amplitude=4 / u.cm**2 / u.s / u.TeV,
         reference=1 * u.TeV,
         lambda_=0.1 / u.TeV,
         alpha=0.8,
Esempio n. 2
0
     name="ecpl_2",
     model=ExpCutoffPowerLawSpectralModel(
         index=2.0 * u.Unit(""),
         amplitude=4 / u.cm ** 2 / u.s / u.TeV,
         reference=1 * u.TeV,
         lambda_=0.1 / u.TeV,
     ),
     val_at_2TeV=u.Quantity(0.81873075, "cm-2 s-1 TeV-1"),
     integral_1_10TeV=u.Quantity(2.83075297, "cm-2 s-1"),
     eflux_1_10TeV=u.Quantity(6.41406327, "TeV cm-2 s-1"),
     e_peak=np.nan * u.TeV,
 ),
 dict(
     name="GaussianSpectralModel",
     model=GaussianSpectralModel(
         norm=4 / u.cm ** 2 / u.s, mean=2 * u.TeV, sigma=0.2 * u.TeV
     ),
     val_at_2TeV=u.Quantity(7.978845608028654, "cm-2 s-1 TeV-1"),
     val_at_3TeV=u.Quantity(2.973439029468601e-05, "cm-2 s-1 TeV-1"),
     integral_1_10TeV=u.Quantity(3.9999988533937123, "cm-2 s-1"),
     integral_infinity=u.Quantity(4, "cm-2 s-1"),
     eflux_1_10TeV=u.Quantity(7.999998896163037, "TeV cm-2 s-1"),
 ),
 dict(
     name="ecpl",
     model=ExpCutoffPowerLawSpectralModel(
         index=1.8 * u.Unit(""),
         amplitude=4 / u.cm ** 2 / u.s / u.TeV,
         reference=1 * u.TeV,
         lambda_=0.1 / u.TeV,
         alpha=0.8,
Esempio n. 3
0
    \phi(E) = \frac{N_0}{\sigma \sqrt{2\pi}}  \exp{ \frac{- \left( E-\bar{E} \right)^2 }{2 \sigma^2} }

"""

# %%
# Example plot
# ------------
# Here is an example plot of the model:

from astropy import units as u
import matplotlib.pyplot as plt
from gammapy.modeling.models import GaussianSpectralModel, Models, SkyModel

energy_range = [0.1, 100] * u.TeV
model = GaussianSpectralModel(norm="1e-2 cm-2 s-1",
                              mean=2 * u.TeV,
                              sigma=0.2 * u.TeV)
model.plot(energy_range)
plt.grid(which="both")
plt.ylim(1e-24, 1e-1)

# %%
# YAML representation
# -------------------
# Here is an example YAML file using the model:

model = SkyModel(spectral_model=model, name="gaussian-model")
models = Models([model])

print(models.to_yaml())