.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials/scripts/survey_map.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorials_scripts_survey_map.py: Survey Map Script ================= Make a survey counts map using a script. We create an all-sky map in AIT projection for the `H.E.S.S. DL3 DR1 `__ dataset. .. GENERATED FROM PYTHON SOURCE LINES 11-35 .. code-block:: Python import logging from gammapy.data 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: log.info(f"Processing obs_id: {obs.obs_id}") m.fill_events(obs.events) m.write("survey_map.fits.gz", overwrite=True) if __name__ == "__main__": logging.basicConfig(level=logging.INFO) main() .. _sphx_glr_download_tutorials_scripts_survey_map.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/gammapy/gammapy-webpage/main?urlpath=lab/tree/notebooks/dev/tutorials/scripts/survey_map.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: survey_map.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: survey_map.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_