GammaCatResourceIndex

class gammapy.catalog.GammaCatResourceIndex(resources)[source]

Bases: object

Resource index for gamma-cat.

Parameters:
resources : list

List of GammaCatResource objects

Attributes Summary

global_ids List of global resource IDs (list of str).
unique_reference_ids Sorted list of unique source IDs (list of str).
unique_source_ids Sorted list of unique source IDs (list of int).

Methods Summary

from_list(data) Create from list of dicts.
from_pandas(dataframe) Create from pandas.DataFrame.
from_table(table) Create from Table.
query(*args, **kwargs) Query to select subset of resources.
sort() Return a sorted copy (leave self unchanged).
to_list() Convert to list of dict.
to_pandas() Convert to pandas.DataFrame.
to_table() Convert to Table.

Attributes Documentation

global_ids

List of global resource IDs (list of str).

In original order, not sorted.

unique_reference_ids

Sorted list of unique source IDs (list of str).

unique_source_ids

Sorted list of unique source IDs (list of int).

Methods Documentation

classmethod from_list(data)[source]

Create from list of dicts.

classmethod from_pandas(dataframe)[source]

Create from pandas.DataFrame.

classmethod from_table(table)[source]

Create from Table.

query(*args, **kwargs)[source]

Query to select subset of resources.

Calls pandas.DataFrame.query and passes arguments to that method.

Examples

>>> resource_index = GammaCatResourceIndex(...)
>>> resource_index2 = resource_index.query('type == "sed" and source_id == 42')
sort()[source]

Return a sorted copy (leave self unchanged).

to_list()[source]

Convert to list of dict.

to_pandas()[source]

Convert to pandas.DataFrame.

to_table()[source]

Convert to Table.