gammapy-0.16/0000755000076500000240000000000013615373601013641 5ustar adonathstaff00000000000000gammapy-0.16/.codacy.yml0000644000076500000240000000007413606434147015710 0ustar adonathstaff00000000000000--- engines: pylint: enabled: true python_version: 3 gammapy-0.16/.github/0000755000076500000240000000000013615373600015200 5ustar adonathstaff00000000000000gammapy-0.16/.github/ISSUE_TEMPLATE/0000755000076500000240000000000013615373600017363 5ustar adonathstaff00000000000000gammapy-0.16/.github/ISSUE_TEMPLATE/bug_report.md0000644000076500000240000000247313606434147022067 0ustar adonathstaff00000000000000--- name: Bug report about: Create a report to help us improve Gammapy! title: '' labels: bug assignees: '' --- **Gammapy version** Please use `gammapy info` or `python -c 'import gammapy; print(gammapy.__version__)'` to check which version of Gammapy you are using, and put that information here. If the error is possibly related to the version of Python, Numpy or Astropy or another package, please also include that version information. Are you using the latest stable version of Gammapy? (see https://gammapy.org/news.html) If no, can you upgrade and try with the latest stable version, please? **Bug description** A short description what the bug is (usually 1-2 sentences) **Expected behavior** A clear and concise description of what you expected to happen. **To Reproduce** Steps to reproduce the behavior. See https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports If you can't share an example that lets us reproduce the bug, it's likely that we'll need to start a guessing game and ask you for more information. The next best thing to a reproducible example is to copy & paste the code or command that caused the error, and the output you got (e.g. the full Python traceback if there's an exception). **Other information** Any other information you think will be useful for us to fix the issue can go here. gammapy-0.16/.github/ISSUE_TEMPLATE/feature_request.md0000644000076500000240000000113713606434147023116 0ustar adonathstaff00000000000000--- name: Feature request about: Suggest an idea to make Gammapy better! title: '' labels: feature assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. gammapy-0.16/.github/PULL_REQUEST_TEMPLATE.md0000644000076500000240000000200313606434147021000 0ustar adonathstaff00000000000000 **Description** This pull request ... **Dear reviewer** gammapy-0.16/.github/workflows/0000755000076500000240000000000013615373600017235 5ustar adonathstaff00000000000000gammapy-0.16/.github/workflows/greetings.yml0000644000076500000240000000072313606434147021755 0ustar adonathstaff00000000000000name: Greetings on: [pull_request, issues] jobs: greeting: runs-on: ubuntu-latest steps: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: 'Merci! We will respond to your issue shortly. In the meantime, try `import gammapy; gammapy.song()`' pr-message: 'Graçias! We will review your pull request shortly. In the meantime, try `import gammapy; gammapy.song(karaoke=True)`' gammapy-0.16/.gitignore0000644000076500000240000000203713611652223015627 0ustar adonathstaff00000000000000# Compiled files *.py[cod] *.a *.o *.so __pycache__ # Ignore .c files by default to avoid including generated code. If you want to # add a non-generated .c extension, use `git add -f filename.c`. *.c # Other generated files */version.py */cython_version.py htmlcov .coverage* .coverage.subprocess # Sphinx _build # Pytest .cache v .pytest_cache .tox # Packages/installer info *.egg *.egg-info dist build eggs parts bin var sdist develop-eggs .installed.cfg distribute-*.tar.gz .eggs # Other .*.swp .*.swo .*.swn *~ # Mac OSX .DS_Store .vscode .idea .settings .pydevproject .project htmlcov MANIFEST # notebooks *.ipynb_checkpoints docs/_static/notebooks docs/notebooks docs/modeling/gallery tutorials/fit_result_LogParabola.yaml tutorials/model-best-fit.yaml tutorials/crab-3datasets tutorials/analysis_1 tutorials/analysis_3d tutorials/*.yaml Tutorials/*.reg gammapy-datasets temp gammapy/gammapy.cfg docs/_generated docs/api .coverage dev/crab # Data files and images are usually generated *.png !tutorials/images/* *.fits *.fits.gz *.root gammapy-0.16/.travis.yml0000644000076500000240000001136113614326116015752 0ustar adonathstaff00000000000000# # This travis-ci build matrix config is a modified copy of the one from Astropy # # We can't use `language: python` here because it's not supported on Mac. # But that's OK ... the language here is irrelevant because we use conda # to install our own Python. language: c os: - linux stage: Comprehensive tests # This is a signal to travis-ci to use the new build infrastructure sudo: false addons: apt: packages: &default_apt - graphviz - texlive-latex-extra - dvipng - gfortran env: global: - PYTHON_VERSION=3.7 - NUMPY_VERSION=stable - ASTROPY_VERSION=stable - ASTROPY_USE_SYSTEM_PYTEST=1 - CONDA_DEPENDENCIES='Cython click scipy healpy matplotlib pyyaml pandas naima sherpa libgfortran regions reproject pandoc ipython iminuit' - CONDA_DEPENDENCIES_OSX='Cython click scipy healpy matplotlib pyyaml pandas naima sherpa regions reproject pandoc ipython iminuit' - CONDA_DEPENDENCIES_WO_SHERPA='Cython click scipy healpy matplotlib pyyaml pandas naima regions reproject pandoc ipython iminuit' - CONDA_DEPENDENCIES_DOCS='Cython click scipy healpy matplotlib pyyaml pandas naima pygments sherpa libgfortran regions reproject pandoc ipython jupyter iminuit' - PIP_DEPENDENCIES='nbsphinx sphinx-astropy sphinx-gallery sphinx-click sphinx_rtd_theme pytest-astropy parfive pydantic' - CONDA_CHANNELS='conda-forge sherpa' - FETCH_GAMMAPY_DATA=true - TEST_COVERAGE=false - TEST_PACKAGING=false - RUN_INSTALL=true - DEBUG=true stages: # Do the style check and a single test job, don't proceed if it fails - name: Initial tests # Test docs, dev dependencies, and without optional dependencies - name: Comprehensive tests matrix: # Don't wait for allowed failures fast_finish: true include: # Main test, used for coverage - stage: Initial tests env: TEST_COVERAGE=true CMD='make test-cov' PIP_DEPENDENCIES="$PIP_DEPENDENCIES pytest-cov codecov" # MacOS X tests - os: osx env: PYTHON_VERSION=3.6 CMD='make test' CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_OSX # Run tests without optional dependencies - env: PYTHON_VERSION=3.6 CMD='make test' CONDA_DEPENDENCIES='Cython click regions' PIP_DEPENDENCIES='pytest-astropy parfive pydantic' # Run tests without GAMMAPY_DATA available - stage: Initial tests env: CMD='make test' FETCH_GAMMAPY_DATA=false # Build docs - env: CMD='make docs-all' CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_DOCS # Test conda build (which runs a bunch of useful tests after building the package) # See https://conda.io/docs/bdist_conda.html - env: CMD='python setup.py bdist_conda' TEST_PACKAGING=true # Test with Astropy dev version - env: PYTHON_VERSION=3.6 ASTROPY_VERSION=dev CMD='make test' CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES # Test with Sherpa dev, this may take a longer time - env: PYTHON_VERSION=3.6 SETUP_CMD='make test' CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_WO_SHERPA DEBUG=True PIP_DEPENDENCIES='git+http://github.com/sherpa/sherpa.git#egg=sherpa pytest-astropy parfive pydantic' # Test Jupyter notebooks - env: PYTHON_VERSION=3.6 CMD='make test-nb' CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_DOCS # Test example scripts - env: PYTHON_VERSION=3.6 CMD='make test-scripts' CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES install: - git clone git://github.com/astropy/ci-helpers.git - source ci-helpers/travis/setup_conda.sh # From https://conda.io/docs/bdist_conda.html # bdist_conda must be installed into a root conda environment, # as it imports conda and conda_build. It is included as part of the conda build package. - if $TEST_PACKAGING; then conda install -n root conda-build astropy Cython click regions; conda info; conda --version; conda build --version; conda activate root; fi # This is needed to make matplotlib plot testing work - if [[ $TRAVIS_OS_NAME == 'linux' ]]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; export QT_API=pyqt; fi script: - if $FETCH_GAMMAPY_DATA; then export GAMMAPY_DATA=${HOME}/gammapy-data; pip install -e .; gammapy download datasets --out=$GAMMAPY_DATA --tests --silent; fi - if $RUN_INSTALL; then pip install -e .; fi - $CMD after_success: - if $TEST_COVERAGE; then codecov -X gcov; fi gammapy-0.16/CHANGES.rst0000644000076500000240000026371213615373451015461 0ustar adonathstaff00000000000000.. _gammapy_0p16_release: 0.16 (Feb 1, 2020) ------------------- Summary +++++++ - Released Feb 1, 2020 - 8 contributors - 61 pull requests (not all listed below) **What's new** For Gammapy v0.16 a ``FoVBackgroundMaker`` was implemented, which supports different methods of adapting the norm and tilt of a field of view background model to the data. To provide a visual overview of the available models in Gammapy a `model gallery `__ was added. A general introduction on how to work with the different models is now avilable in a dedicated `models tutorial `__. The spectral analysis of an extended source is demonstrated in the newly added `extended source spectral analysis tutorial `__. To further improve API consistency the ``EnergyDispersion`` class was renamed to ``EDispKernel`` and the ``SkyModels`` class was renamed to a more general ``Models`` class. The ``coordsys`` attribute of ``WcsGeom`` and ``HpxGeom`` was renamed to ``frame`` and now supports arbitrary Astropy coordinate frames. The ``Datasets`` and ``Models`` container objects now require unique names of the objects contained. By default unique identifiers are generated in the model and dataset objects. The ``Datasets``, ``Models`` as well as ``Observations`` container classes, were extended to now support in place ``.append()``, ``.extend()`` and ``.insert()`` operations. For Gammapy v0.16 the API of the ``SensitivityEstimator`` and ``TSMapEstimator`` was adapted to take a ``MapDataset`` or ``MapDatasetOnOff`` as input. The ``ASmooth`` class was renamed to ``ASmoothMapEstimator`` and also adapted to work with ``MapDataset`` and ``MapDatasetOnOff``. Again this release contains several API breaking changes and removal of non-essential parts of Gammapy (see PR list below). These changes are required to finally arrive at a more consistent and stable API for Gammapy v1.0. Thanks for your understanding! **Contributors:** In alphabetical order by first name: - Atreyee Sinha - Axel Donath - Christoph Deil - Fabio Pintore - José Enrique Ruiz - Luca Giunti - Quentin Remy - Régis Terrier Pull Requests +++++++++++++ This list is incomplete. Small improvements and bug fixes are not listed here. See the complete `Gammapy v0.16 merged pull requests list on Github `__. - [#2756] Add config params for get_flux_points method in High-level interface (José Enrique Ruiz) - [#2747] Modify Config and Analysis to support SafeMaskMaker (Régis Terrier) - [#2752] Add temporal model support to SkyModel (Quentin Remy) - [#2755] Fix WcsNDMap and MapDataset cutout to support mode='partial' (Régis Terrier) - [#2753] Make DataStoreObservation inherit from Observation (Axel Donath) - [#2751] Add checks for edisp, psf and bkg in MapDatasetEventSampler.run() (Fabio Pintore) - [#2750] Clean up MapDataset / BackgroundModel code (Axel Donath) - [#2746] Rework models notebook (Axel Donath) - [#2743] Add a MapDatasetOnOff.to_image() method (Régis Terrier) - [#2742] Add spectral models to gallery (José Enrique Ruiz) - [#2741] Adapt ASmooth to work with datasets and rename it to ASmoothMapEstimator (Axel Donath) - [#2739] Simplify and fix EDispMap.get_edisp_kernel() (Axel Donath) - [#2738] Unify analysis notebooks introductions (Régis Terrier) - [#2737] Add spatial models in models gallery (José Enrique Ruiz) - [#2735] Change configuration for sphinx gallery (José Enrique Ruiz) - [#2733] Handle MapDataset.to_image() without counts or background (Axel Donath) - [#2731] Add SmoothBrokenPowerLawSpectralModel (Axel Donath) - [#2730] Add an extended source spectral analysis tutorial (Régis Terrier) - [#2729] Unify SpectrumDataset and SpectrumDatasetOnOff overview methods (Axel Donath) - [#2728] Add auto-generated unique names (Quentin Remy) - [#2727] Rename SkyModels to Models (Axel Donath) - [#2726] Rename likelihood_type to stat_type (Axel Donath) - [#2725] Simplify trapz_loglog integrate method (Axel Donath) - [#2723] Add time scale info in GTI.__repr__ (Régis Terrier) - [#2719] Remove use of simulate_dataset from mcmc tutorial (Axel Donath) - [#2718] Adapt TSMapEstimator to take a MapDataset as input (Régis Terrier) - [#2715] Refactor sensitivity estimator (Axel Donath) - [#2713] Fix 3d array convolution with 2d kernel (Quentin Remy) - [#2712] Fix containment correction in MapDataset.to_spectrum_dataset (Régis Terrier) - [#2711] Remove Stats class (Axel Donath) - [#2709] Rename coordsys to frame in gammapy.maps (Axel Donath) - [#2707] Implement MapDatasetOnOff.to_spectrum_dataset() and .cutout() (Régis Terrier) - [#2705] Rename EnergyDispersion to EDispKernel (Axel Donath) - [#2703] Use sphinx gallery for a model gallery (Axel Donath) - [#2697] Add FoVBackgroundMaker class (Régis Terrier) - [#2692] Add PSF handling to MapDataset.to_image() (Atreyee) - [#2687] Allow interpolation of single bin axes in ScaledRegularGridInterpolator (Axel Donath) - [#2685] Move custom model tutorial to models notebook (Quentin Remy) - [#2684] Clean up image analysis tutorials (Atreyee Sinha) - [#2681] Update source detection notebook (Quentin Remy) - [#2674] Rewrite fit statistic rst page (Régis Terrier) - [#2673] Remove hard coded true energy axis in 1D HLI (Régis Terrier) - [#2672] Change lightcurve flare notebook to PKS 2155 flare (Régis Terrier) - [#2667] Add MapDatasetEventSampler.event_list_meta() and .run() method (Fabio Pintore) .. _gammapy_0p15_release: 0.15 (Dec 3, 2019) ------------------ Summary +++++++ - Released Dec 3, 2019 - 12 contributors - 187 pull requests (not all listed below) **What's new** For Gammapy v0.15 the high-level ``Analysis`` class was moved to the newly introduced ``gammapy.analysis`` sub-package. The syntax of the YAML config file was simplified and validation of config parameters is now available for interactive use of the ``Analysis`` class as well. Both is demonstrated in the `first analysis with Gammapy notebook `__. In addition a new ``gammapy analysis`` command line tool was introduced, which executes the data reduction part of an analysis, based on a given config file. The use of the tool is documented `here `__. Following the proposal in `PIG 18`_ the structure of the documentation was improved. The new `overview page `__ gives an introduction and overview of the Gammapy analysis workflow and package structure. The structure and content of the `tutorials page `__ was simplified and cleaned up and a `how to `__ page was introduced. A tutorial notebook showing how to do a joint `multi-instrument analysis `__ of the Crab Nebula using H.E.S.S. and Fermi-LAT data and HAWC flux points was added. Another focus of the work for Gammapy v0.15 was the clean-up and unification of the spectrum and map data reduction. Gammapy now features a ``MapDatasetMaker``, and ``SpectrumDatasetMaker`` which directly produce a ``MapDataset`` or ``SpectrumDataset`` from DL3 data. The existing background estimation classes were adapted by introducing a ``ReflectedRegionsBackgroundMaker``, ``RingBackgroundMaker`` and ``AdaptiveRingbackgroundMaker``. Those makers can also be chained to create custom data reduction workflows. The new data reduction API is shown in the `second analysis with Gammapy notebook `__ and corresponding `docs page `__. A ``MapDatasetOnOff`` class was introduced to handle on-off observation based analyses and as a container for image based ring-background estimation. All datasets now have a ``.create()`` method to allow an easy creation of the dataset from a map geometry or energy specification. Gammapy now supports spatially varying PSF and energy dispersion in the data reduction as well as during fitting. By introducing an in memory ``Observation`` class Gammapy now features unified support for binned simulations of spectrum and map datasets. This is shown in the `1d simulation `__ and `3d simulation `__ tutorial notebooks. The ``LightCurveEstimator`` was improved to use the GTIs defined on datasets and allow for grouping of datasets according to provided time intervals. Details are explained on the `time docs page