Observation

class gammapy.data.Observation(obs_id=None, obs_info=None, gti=None, aeff=None, edisp=None, psf=None, bkg=None, rad_max=None, events=None, obs_filter=None)[source]

Bases: object

In-memory observation.

Parameters
obs_idint

Observation id

obs_infodict

Observation info dict

aeffEffectiveAreaTable2D

Effective area

edispEnergyDispersion2D

Energy dispersion

psfPSF3D

Point spread function

bkgBackground3D

Background rate model

rad_max: `~gammapy.irf.RadMax2D` or `~astropy.units.Quantity`

Only for point-like IRFs: RAD_MAX table (energy dependent RAD_MAX) or a single angle (global RAD_MAX)

gtiGTI

Table with GTI start and stop time

eventsEventList

Event list

obs_filterObservationFilter

Observation filter.

Attributes Summary

aeff

A lazy FITS data descriptor.

available_irfs

Which irfs are available

bkg

A lazy FITS data descriptor.

edisp

A lazy FITS data descriptor.

events

fixed_pointing_info

Fixed pointing info for this observation (FixedPointingInfo).

gti

muoneff

Observation muon efficiency.

observation_dead_time_fraction

Dead-time fraction (float).

observation_live_time_duration

Live-time duration in seconds (Quantity).

observation_time_duration

Observation time duration in seconds (Quantity).

observatory_earth_location

Observatory location (EarthLocation).

pointing_altaz

Pointing ALT / AZ sky coordinates (SkyCoord).

pointing_radec

Pointing RA / DEC sky coordinates (SkyCoord).

pointing_zen

Pointing zenith angle sky (Quantity).

psf

A lazy FITS data descriptor.

rad_max

A lazy FITS data descriptor.

target_radec

Target RA / DEC sky coordinates (SkyCoord).

tstart

Observation start time (Time).

tstop

Observation stop time (Time).

Methods Summary

check([checks])

Run checks.

create(pointing[, obs_id, livetime, tstart, …])

Create an observation.

peek([figsize])

Quick-look plots in a few panels.

read(event_file[, irf_file])

Create an Observation from a Event List and an (optional) IRF file.

select_time(time_interval)

Select a time interval of the observation.

Attributes Documentation

aeff

A lazy FITS data descriptor.

Parameters
cachebool

Whether to cache the data.

available_irfs

Which irfs are available

bkg

A lazy FITS data descriptor.

Parameters
cachebool

Whether to cache the data.

edisp

A lazy FITS data descriptor.

Parameters
cachebool

Whether to cache the data.

events
fixed_pointing_info

Fixed pointing info for this observation (FixedPointingInfo).

gti
muoneff

Observation muon efficiency.

observation_dead_time_fraction

Dead-time fraction (float).

Defined as dead-time over observation time.

Dead-time is defined as the time during the observation where the detector didn’t record events: https://en.wikipedia.org/wiki/Dead_time https://ui.adsabs.harvard.edu/abs/2004APh….22..285F

The dead-time fraction is used in the live-time computation, which in turn is used in the exposure and flux computation.

observation_live_time_duration

Live-time duration in seconds (Quantity).

The dead-time-corrected observation time.

Computed as t_live = t_observation * (1 - f_dead) where f_dead is the dead-time fraction.

observation_time_duration

Observation time duration in seconds (Quantity).

The wall time, including dead-time.

observatory_earth_location

Observatory location (EarthLocation).

pointing_altaz

Pointing ALT / AZ sky coordinates (SkyCoord).

pointing_radec

Pointing RA / DEC sky coordinates (SkyCoord).

pointing_zen

Pointing zenith angle sky (Quantity).

psf

A lazy FITS data descriptor.

Parameters
cachebool

Whether to cache the data.

rad_max

A lazy FITS data descriptor.

Parameters
cachebool

Whether to cache the data.

target_radec

Target RA / DEC sky coordinates (SkyCoord).

tstart

Observation start time (Time).

tstop

Observation stop time (Time).

Methods Documentation

check(checks='all')[source]

Run checks.

This is a generator that yields a list of dicts.

classmethod create(pointing, obs_id=0, livetime=None, tstart=None, tstop=None, irfs=None, deadtime_fraction=0.0, reference_time='2000-01-01')[source]

Create an observation.

User must either provide the livetime, or the start and stop times.

Parameters
pointingSkyCoord

Pointing position

obs_idint

Observation ID as identifier

livetime~astropy.units.Quantity`

Livetime exposure of the simulated observation

tstartQuantity

Start time of observation w.r.t reference_time

tstopQuantity w.r.t reference_time

Stop time of observation

irfsdict

IRFs used for simulating the observation: bkg, aeff, psf, edisp

deadtime_fractionfloat, optional

Deadtime fraction, defaults to 0

reference_timeTime

the reference time to use in GTI definition

Returns
obsgammapy.data.MemoryObservation
peek(figsize=(12, 10))[source]

Quick-look plots in a few panels.

Parameters
figsizetuple

Figure size

classmethod read(event_file, irf_file=None)[source]

Create an Observation from a Event List and an (optional) IRF file.

Parameters
event_filestr, Path

path to the .fits file containing the event list and the GTI

irf_filestr, Path

(optional) path to the .fits file containing the IRF components, if not provided the IRF will be read from the event file

Returns
observationObservation

observation with the events and the irf read from the file

select_time(time_interval)[source]

Select a time interval of the observation.

Parameters
time_intervalastropy.time.Time

Start and stop time of the selected time interval. For now we only support a single time interval.

Returns
new_obsObservation

A new observation instance of the specified time interval