MapDatasetEventSampler#
- class gammapy.datasets.MapDatasetEventSampler(random_state='random-seed', oversample_energy_factor=10, t_delta=<Quantity 0.5 s>, keep_mc_id=True, n_event_bunch=10000)[source]#
Bases:
object
Sample events from a map dataset.
- Parameters:
- random_state{int, ‘random-seed’, ‘global-rng’,
RandomState
}, optional Defines random number generator initialisation via the
get_random_state
function.- oversample_energy_factorint, optional
Defines an oversampling factor for the energies; it is used only when sampling an energy-dependent time-varying source.
- t_delta
Quantity
, optional Time interval used to sample the time-dependent source.
- keep_mc_idbool, optional
Flag to tag sampled events from a given model with a Montecarlo identifier. Default is True. If set to False, no identifier will be assigned.
- n_event_bunchint
Size of events bunches to sample. If None, sample all events in memory. Default is 10000.
- random_state{int, ‘random-seed’, ‘global-rng’,
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[, psf_update])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:
- observation
Observation
In memory observation.
- events
EventList
Event list.
- observation
- Returns:
- events
EventList
Event list with columns of event detector coordinates.
- events
- static event_list_meta(dataset, observation, keep_mc_id=True)[source]#
Event list meta info. Please, note that this function will be updated in the future.
- Parameters:
- dataset
MapDataset
Map dataset.
- observation
Observation
In memory observation.
- keep_mc_idbool
Flag to tag sampled events from a given model with a Montecarlo identifier. Default is True. If set to False, no identifier will be assigned.
- dataset
- Returns:
- metadict
Meta dictionary.
- run(dataset, observation=None)[source]#
Run the event sampler, applying IRF corrections.
- Parameters:
- dataset
MapDataset
Map dataset.
- observation
Observation
, optional In memory observation. Default is None.
- dataset
- Returns:
- events
EventList
Event list.
- events
- sample_background(dataset)[source]#
Sample background.
- Parameters:
- dataset
MapDataset
Map dataset.
- dataset
- Returns:
- events
gammapy.data.EventList
Background events.
- events
- sample_sources(dataset, psf_update=False)[source]#
Sample source model components.
- Parameters:
- dataset
MapDataset
Map dataset.
- psf_updatebool
Parameter to switch-off (on) the update of the PSF in the dataset; default is False.
- dataset
- Returns:
- events
EventList
Event list.
- events