Target

class gammapy.data.Target(on_region, position=None, obs_id=None, name='Target', tag='target')[source]

Bases: object

Observation Target.

This class represents an observation target. It can serve as input for several analysis classes, e.g. SpectrumExtraction.

TODO: This is usefull for pipelines when you want to attach a tag to a certain analysis. However, it does not do much. Should we keep it?

Parameters:

on_region : SkyRegion

Signal extraction region

position : SkyCoord, optional

Target position

obs_id : int, optional

Observations for this target

name : str, optional

Target name

tag : str, optional

Target identifier

Examples

Initialize target and define observations:

>>> import astropy.units as u
>>> from astropy.coordinates import SkyCoord
>>> from regions import CircleSkyRegion
>>> from gammapy.data import Target
>>> pos = SkyCoord(83.63 * u.deg, 22.01 * u.deg, frame='icrs')
>>> on_size = 0.3 * u.deg
>>> on_region = CircleSkyRegion(pos, on_size)
>>> target = Target(pos, on_region, name='Crab Nebula', tag='crab')
>>> print(target)
Target: Crab Nebula
Tag: crab
Position: <SkyCoord (ICRS): (ra, dec) in deg
    (83.63, 22.01)>
On region: CircleSkyRegion
    Center:<SkyCoord (ICRS): (ra, dec) in deg
        (83.63, 22.01)>
    Radius:0.3 deg

Methods Summary

from_config(config) Initialize target from config.

Methods Documentation

classmethod from_config(config)[source]

Initialize target from config.

The config dict is stored as attribute for later use by other analysis classes.