SkyModels

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

Bases: object

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

frame
names Sky model names
parameters
skymodels

Methods Summary

evaluate(self, lon, lat, energy)
from_xml(xml) Read from XML string.
from_yaml(filename) Write to YAML file.
read(filename) Read from XML file.
to_xml(self, filename) Write to XML file.
to_yaml(self, filename[, selection]) Write to YAML file.

Attributes Documentation

frame = None
names

Sky model names

parameters
skymodels

Methods Documentation

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

Read from XML string.

classmethod from_yaml(filename)[source]

Write to YAML file.

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_xml(self, filename)[source]

Write to XML file.

to_yaml(self, filename, selection='all')[source]

Write to YAML file.