MapDatasetEventSampler#

class gammapy.datasets.MapDatasetEventSampler(random_state='random-seed', oversample_energy_factor=10, t_delta=<Quantity 0.5 s>)[source]#

Bases: object

Sample events from a map dataset.

Parameters
random_state{int, ‘random-seed’, ‘global-rng’, RandomState}

Defines random number generator initialisation via the get_random_state function

oversample_energy_factor: {int}

Defines an oversampling factor for the energies; it is used only when sampling an energy-dependent time-varying source

t_deltaQuantity

Time interval used to sample the time-dependent source

Methods Summary

event_det_coords(observation, events)

Add columns of detector coordinates (DETX-DETY) to the event list.

event_list_meta(dataset, observation)

Event list meta info.

run(dataset[, observation])

Run the event sampler, applying IRF corrections.

sample_background(dataset)

Sample background.

sample_edisp(edisp_map, events)

Sample energy dispersion map.

sample_psf(psf_map, events)

Sample psf map.

sample_sources(dataset)

Sample source model components.

Methods Documentation

static event_det_coords(observation, events)[source]#

Add columns of detector coordinates (DETX-DETY) to the event list.

Parameters
observationObservation

In memory observation

eventsEventList

Event list

Returns
eventsEventList

Event list with columns of event detector coordinates

static event_list_meta(dataset, observation)[source]#

Event list meta info.

Parameters
datasetMapDataset

Map dataset

observationObservation

In memory observation

Returns
metadict

Meta dictionary

run(dataset, observation=None)[source]#

Run the event sampler, applying IRF corrections.

Parameters
datasetMapDataset

Map dataset

observationObservation

In memory observation

edispBool

Whether to include or exclude the Edisp in the simulation

Returns
eventsEventList

Event list

sample_background(dataset)[source]#

Sample background.

Parameters
datasetMapDataset

Map dataset

Returns
eventsgammapy.data.EventList

Background events

sample_edisp(edisp_map, events)[source]#

Sample energy dispersion map.

Parameters
edisp_mapEDispMap

Energy dispersion map

eventsEventList

Event list with the true energies

Returns
eventsEventList

Event list with reconstructed energy column

sample_psf(psf_map, events)[source]#

Sample psf map.

Parameters
psf_mapPSFMap

PSF map

eventsEventList

Event list

Returns
eventsEventList

Event list with reconstructed position columns

sample_sources(dataset)[source]#

Sample source model components.

Parameters
datasetMapDataset

Map dataset

Returns
eventsEventList

Event list