Fix formatting for code cells.
@@ -39,32 +39,28 @@ once a set of random numbers is determined, it samples a set of events.
The basic design of the class works as following:
- from gammapy.utils.distributions import InverseCDFSampler
+.. code::
+ from gammapy.utils.distributions import InverseCDFSampler
cdf_sampler = InverseCDFSampler(pdf=npred_map.data, axis=None, random_state=random_state)
-where the gammapy.utils.random.get_random_state method is used.
-
+Where the `gammapy.utils.random.get_random_state` method is used. The class implements the following methods:
-The class implements the following methods:
+.. code::
cdf_sampler = InverseCDFSampler()
-
cdf_sampler.sample_axis()
-
cdf_sampler.sample()
-
-that will allow us to sample alternatively along all the axes or a given axis of the input map.
+That will allow us to sample alternatively along all the axes or a given axis of the input map.
MapEventSampler
===============
-The next fundamental step is the creation of a map of the predicted events. This can be performed, for a given exposure time,
- with the MapDataset class which takes as input a Skymodel(s) object. The predicted event map is then the input of the new
-proposed class MapEventSampler(). The same approach can be applied to the background events. The source events will be simulated
-as following:
+The next fundamental step is the creation of a map of the predicted events. This can be performed, for a given exposure time, with the `MapDataset` class which takes as input a Skymodel(s) object. The predicted event map is then the input of the new proposed class `MapEventSampler`. The same approach can be applied to the background events. The source events will be simulated as following:
+
+.. code::
src = SkyModel()
evaluator = MapEvaluator(src, exposure, psf=None, edisp=None)
@@ -78,7 +74,7 @@ bkg_map = Map()
bkg_sampler = MapEventSampler(bkg_map, psf_map=None, edisp_map=None)
events_bkg = bkg_sample.sample()
-where the MapEventSampler() class can be used to generate alternatively source or background events.
+Where the `MapEventSampler` class can be used to generate alternatively source or background events.
IRFMapSampler
@@ -90,6 +86,8 @@ the psf and the energy dispersion calculated for each event true position and tr
positions are then listed into an astropy table. We propose two different options to accomplish this task, which should work
as follows:
+.. code::
+
events = vstack([events_src_1, events_src_2, ..., events_src_N])
irf_sampler = IRFSampler(events, psf_map, edisp_map)
events_obs = irf_sampler.sample()
@@ -111,6 +109,8 @@ MapDatasetEventSampler?
Propose high level structure:
+.. code::
+
dataset_sampler = MapDatasetEventSampler(dataset)
events = dataset_sampler.sample()
@@ -121,6 +121,8 @@ Propose high level structure:
More detailed:
+.. code::
+
events = []
# sample from source components
