Note
Go to the end to download the full example code. or to run this example in your browser via Binder
Broken power law spectral model#
This model parametrises a broken power law spectrum.
It is defined by the following equation:
\[\begin{split}\phi(E) = \phi_0 \cdot \begin{cases}
\left( \frac{E}{E_{break}} \right)^{-\Gamma1} & \text{if } E < E_{break} \\
\left( \frac{E}{E_{break}} \right)^{-\Gamma2} & \text{otherwise}
\end{cases}\end{split}\]
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_bounds = [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_bounds)
plt.grid(which="both")
YAML representation#
Here is an example YAML file using the model:
components:
- name: broken-power-law-model
type: SkyModel
spectral:
type: BrokenPowerLawSpectralModel
parameters:
- name: index1
value: 1.5
- name: index2
value: 2.5
- name: amplitude
value: 1.0e-12
unit: cm-2 s-1 TeV-1
- name: ebreak
value: 1.0
unit: TeV
metadata:
creator: Gammapy 1.3
date: '2024-11-26T10:08:50.757021'
origin: null