SkyModels

class gammapy.cube.models.SkyModels(skymodels)[source]

Bases: gammapy.utils.fitting.Model

Collection of SkyModel

Parameters:
skymodels : list of SkyModel

Sky models

Examples

Read from an XML file:

from gammapy.cube import SkyModels
filename = '$GAMMAPY_DATA/tests/models/fermi_model.xml'
sourcelib = SkyModels.read(filename)

Attributes Summary

parameters Concatenated parameters.

Methods Summary

copy() A deep copy.
evaluate(lon, lat, energy)
from_xml(xml) Read from XML string.
read(filename) Read from XML file.
to_compound_model() Return CompoundSkyModel
to_xml(filename) Write to XML file.

Attributes Documentation

parameters

Concatenated parameters.

Currently no way to distinguish spectral and spatial.

Methods Documentation

copy()

A deep copy.

evaluate(lon, lat, energy)[source]
classmethod from_xml(xml)[source]

Read from XML string.

classmethod read(filename)[source]

Read from XML file.

The XML definition of some models is uncompatible with the models currently implemented in gammapy. Therefore the following modifications happen to the XML model definition

  • PowerLaw: The spectral index is negative in XML but positive in gammapy. Parameter limits are ignored
  • ExponentialCutoffPowerLaw: The cutoff energy is transferred to lambda = 1 / cutof energy on read
to_compound_model()[source]

Return CompoundSkyModel

to_xml(filename)[source]

Write to XML file.