GammaCatResource

class gammapy.catalog.GammaCatResource(source_id, reference_id, file_id=-1, type='none', location='none')[source]

Bases: object

Reference for a single resource in gamma-cat.

This can be considered an implementation detail, used to assign global_id and to load resources.

TODO: explain how global_id, type and location work. Uses the Python hash function on the tuple (source_id, reference_id, file_id)

Parameters:
source_id : int

Gamma-cat source ID

reference_id : str

Gamma-cat reference ID (usually the ADS paper bibcode)

file_id : int

File ID (a counter for cases with multiple measurements per reference / source) (use integer -1 if missing)

type : str

Resource type (use string ‘none’ if missing)

location : str

Resource location (use string ‘none’ if missing)

Examples

>>> from gammapy.catalog.gammacat import GammaCatResource
>>> resource = GammaCatResource(source_id=42, reference_id='2010A&A...516A..62A', file_id=2)
>>> resource
GammaCatResource(source_id=42, reference_id='2010A&A...516A..62A', file_id=2, type='none', location='none')

Attributes Summary

global_id Globally unique (within gamma-cat) resource ID (str).

Methods Summary

from_dict(data) Create from dict.
to_dict(self) Convert to collections.OrderedDict.
to_namedtuple(self) Convert to collections.namedtuple.

Attributes Documentation

global_id

Globally unique (within gamma-cat) resource ID (str).

(see class docstring for explanation and example).

Methods Documentation

classmethod from_dict(data)[source]

Create from dict.

to_dict(self)[source]

Convert to collections.OrderedDict.

to_namedtuple(self)[source]

Convert to collections.namedtuple.