set primary flux to zero outside energy range
@@ -6,6 +6,7 @@ from astropy.table import Table
from gammapy.modeling import Parameter
from gammapy.modeling.models import SpectralModel, TemplateSpectralModel
from gammapy.utils.scripts import make_path
+from gammapy.utils.interpolation import LogScale
__all__ = ["PrimaryFlux", "DarkMatterAnnihilationSpectralModel"]
@@ -117,7 +118,7 @@ class PrimaryFlux:
channel_name = self.channel_registry[self.channel]
dN_dlogx = subtable[channel_name]
dN_dE = dN_dlogx / (energies * np.log(10))
- return TemplateSpectralModel(energy=energies, values=dN_dE)
+ return TemplateSpectralModel(energy=energies, values=dN_dE, interp_kwargs={"fill_value":np.log(LogScale.tiny)})
class DarkMatterAnnihilationSpectralModel(SpectralModel):
