Note
Go to the end to download the full example code. or to run this example in your browser via Binder
Constant spectral model#
This model takes a constant value along the spectral range.
\[\phi(E) = k\]
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 ConstantSpectralModel, Models, SkyModel
energy_bounds = [0.1, 100] * u.TeV
model = ConstantSpectralModel(const="1 / (cm2 s TeV)")
model.plot(energy_bounds)
plt.grid(which="both")
YAML representation#
Here is an example YAML file using the model:
components:
- name: constant-model
type: SkyModel
spectral:
type: ConstantSpectralModel
parameters:
- name: const
value: 1.0
unit: cm-2 s-1 TeV-1
metadata:
creator: Gammapy 1.3
date: '2024-11-26T10:08:44.164450'
origin: null