catalog - Source catalogs

Introduction

gammapy.catalog provides utilities to work with source catalogs in general, and catalogs relevant for gamma-ray astronomy specifically.

Support for the following catalogs is available:

More catalogs can be added to gammapy.catalog, and users can also add support for their favourite catalog in their Python script or package, by following the examples how the built-in catalogs are implemented.

Some catalogs can be interactively explored at http://gamma-sky.net .

How it works

This section provides some information how gammapy.catalog works. In principle, to use it, you don’t have to know how it’s implemented, and just follow the examples in the sections below. In practice, if you want to work with catalogs via gammapy.catalog or directly, it really helps if you spend a little time and learn about Astropy tables.

Catalog data is stored as an astropy.table.Table object, with the information for each source in a astropy.table.Row. In gammapy.catalog we have implemented a base class gammapy.catalog.SourceCatalog that stores the astropy.table.Table in the table attribute, and a base gammapy.catalog.SourceCatalogObject class that can extract the astropy.table.Row data into a Python dictionary in the data attribute and then provides conveniences to work with the data for a given source.

For every given concrete catalog, two classes (“catalog” and “source/object”) are needed. E.g. for the Fermi-LAT 3FGL catalog, there are the gammapy.catalog.SourceCatalog3FGL and the gammapy.catalog.SourceCatalogObject3FGL classes.

The SourceCatalog class mostly handles data file loading, as well as source access by integer row index or source name. The SourceCatalogObject class implements in __str__ a pretty-printed version of source.data, so that you can print(source), as well as factory methods to create Gammapy objects such as gammapy.modeling.models.SpectralModel or gammapy.modeling.models.SpatialModel or gammapy.spectrum.FluxPoints representing spatial and spectral models, or spectral points, which you can then print or plot or use for simulation and analysis.

Getting Started

Let’s start by checking which catalogs are available:

>>> from gammapy.catalog import SOURCE_CATALOGS
>>> list(SOURCE_CATALOGS)
['gamma-cat', 'hgps', '2hwc', '3fgl', '4fgl', '2fhl', '3fhl']

The SOURCE_CATALOG dict maps names to classes, so you have to call the class to instantiate a catalog object:

>>> SOURCE_CATALOGS['3fgl']
<class 'gammapy.catalog.fermi.SourceCatalog3FGL'>
>>> SOURCE_CATALOGS['3fgl']()
<gammapy.catalog.fermi.SourceCatalog3FGL object at 0x1006fa198>

Alternatively, you can also import and call the class directly:

>>> from gammapy.catalog import SourceCatalog3FGL
>>> catalog = SourceCatalog3FGL()

Usually you create a catalog object, which loads the catalog from disk once, and then index into it to get source objects representing a given source:

>>> catalog = SOURCE_CATALOGS["3fgl"]()
>>> source = catalog['3FGL J0004.7-4740']  # access by source name
>>> source = catalog[15]  # access by row index

The source object contains all of the information in the data attribute:

>>> source.data['RAJ2000']
1.1806999
>>> source.data['CLASS1']
'fsrq '
>>> source.pprint()
# print all info on this source in a readable format

TODO: continue here describing how to access spectra, finder charts, … once that’s implemented.


Using gammapy.catalog

Tutorials that show examples using gammapy.catalog:

The following pages describe gammapy.catalog in more detail:

Reference/API

gammapy.catalog Package

Source catalogs.

Classes

GammaCatDataCollection(data_index) Data store for gamma-cat.
GammaCatResource(source_id, reference_id[, …]) Reference for a single resource in gamma-cat.
GammaCatResourceIndex(resources) Resource index for gamma-cat.
SourceCatalog(table[, source_name_key, …]) Generic source catalog.
SourceCatalog2FHL([filename]) Fermi-LAT 2FHL source catalog.
SourceCatalog2HWC([filename]) HAWC 2HWC catalog.
SourceCatalog3FGL([filename]) Fermi-LAT 3FGL source catalog.
SourceCatalog3FHL([filename]) Fermi-LAT 3FHL source catalog.
SourceCatalog4FGL([filename]) Fermi-LAT 4FGL source catalog.
SourceCatalogGammaCat([filename]) Gammacat open TeV source catalog.
SourceCatalogHGPS([filename, hdu]) HESS Galactic plane survey (HGPS) source catalog.
SourceCatalogLargeScaleHGPS(table[, …]) Gaussian band model.
SourceCatalogObject(data[, data_extended]) Source catalog object.
SourceCatalogObject2FHL(data[, data_extended]) One source from the Fermi-LAT 2FHL catalog.
SourceCatalogObject2HWC(data[, data_extended]) One source from the HAWC 2HWC catalog.
SourceCatalogObject3FGL(data[, data_extended]) One source from the Fermi-LAT 3FGL catalog.
SourceCatalogObject3FHL(data[, data_extended]) One source from the Fermi-LAT 3FHL catalog.
SourceCatalogObject4FGL(data[, data_extended]) One source from the Fermi-LAT 4FGL catalog.
SourceCatalogObjectGammaCat(data[, …]) One object from the gamma-cat source catalog.
SourceCatalogObjectHGPS(data[, data_extended]) One object from the HGPS catalog.
SourceCatalogObjectHGPSComponent(data) One Gaussian component from the HGPS catalog.

Variables

SOURCE_CATALOGS