Survey map

Here’s an example of a Gammapy analysis as a Python script:

"""Make a survey counts map.

We create an all-sky map in AIT projection
for the HESS DL3 DR1 dataset.
import logging
from import DataStore
from gammapy.maps import Map

log = logging.getLogger(__name__)

def main():
    data_store = DataStore.from_dir("$GAMMAPY_DATA/hess-dl3-dr1")
    obs_id = data_store.obs_table["OBS_ID"]
    observations = data_store.get_observations(obs_id)

    m = Map.create()
    for obs in observations:"Processing obs_id: {obs.obs_id}")


if __name__ == "__main__":

To execute it run:

$ python

For interactive use, IPython and Jupyter are great, and most Gammapy examples use those. However, for long-running, non-interactive tasks like data reduction or survey maps, you might prefer a Python script.