Beispiel #1
0
                         \end{cases}
    """

# %%
# 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 BrokenPowerLawSpectralModel, Models, SkyModel

energy_range = [0.1, 100] * u.TeV
model = BrokenPowerLawSpectralModel(
    index1=1.5,
    index2=2.5,
    amplitude="1e-12 TeV-1 cm-2 s-1",
    ebreak="1 TeV",
)
model.plot(energy_range)
plt.grid(which="both")

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

model = SkyModel(spectral_model=model, name="broken-power-law-model")
models = Models([model])

print(models.to_yaml())
Beispiel #2
0
         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,
     ),
     val_at_2TeV=u.Quantity(0.871694294554192, "cm-2 s-1 TeV-1"),
     integral_1_10TeV=u.Quantity(3.026342, "cm-2 s-1"),
     eflux_1_10TeV=u.Quantity(7.38652453, "TeV cm-2 s-1"),
     e_peak=1.7677669529663684 * u.TeV,
 ),
 dict(
     name="bpl",
     model=BrokenPowerLawSpectralModel(
         index1=1.5 * u.Unit(""),
         index2=2.5 * u.Unit(""),
         amplitude=4 / u.cm ** 2 / u.s / u.TeV,
         ebreak=0.5 * u.TeV,
     ),
     val_at_2TeV=u.Quantity(0.125, "cm-2 s-1 TeV-1"),
     integral_1_10TeV=u.Quantity(0.45649740094103286, "cm-2 s-1"),
     eflux_1_10TeV=u.Quantity(0.9669999668731384, "TeV cm-2 s-1"),
 ),
 dict(
     name="sbpl",
     model=SmoothBrokenPowerLawSpectralModel(
         index1=1.5 * u.Unit(""),
         index2=2.5 * u.Unit(""),
         amplitude=4 / u.cm ** 2 / u.s / u.TeV,
         ebreak=0.5 * u.TeV,
         reference=1 * u.TeV,
         beta=1,