New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some scripts and examples #353

merged 5 commits into from Sep 16, 2015
Jump to file or symbol
Failed to load files and symbols.
+62 −0
Diff settings


Just for now

Viewing a subset of changes. View all

Add image analysis pipeline script

This is work in progress ... it doesn't do anything useful yet.
I just wanted to move this over to Gammapy and continue here ...
  • Loading branch information...
cdeil committed Sep 16, 2015
commit 5f321edb29d74cf75f023dd8981560d9c6deb8e6
@@ -0,0 +1,42 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
import logging
from gammapy.utils.scripts import get_parser
__all__ = ['GammapyImageAnalysis']
log = logging.getLogger(__name__)
def main(args=None):
parser = get_parser(GammapyImageAnalysis)
parser.add_argument('config_file', type=str,
help='Config file in YAML format')
# TODO: add option to dump the default config file
args = parser.parse_args(args)
analysis = GammapyImageAnalysis.from_yaml(args.config_file)
class GammapyImageAnalysis(object):
"""Gammapy 2D image based analysis.
def __init__(self, config):
self.config = config
def from_yaml(cls, filename):
"""Read config from YAML file."""
import yaml'Reading {}'.format(filename))
with open(filename) as fh:
config = yaml.safe_load(fh)
return cls(config)
def run(self):
"""Run analysis chain."""'Running analysis ...')
@@ -0,0 +1,19 @@
# Example Gammapy image analysis pipeline config file
outdir: crab
clobber: false
lon: 83.6332124
lat: 22.0144601
system: icrs
binsize: 0.02
fov: 2.0
method: ring
inner_radius: 0.5
outer_radius: 1.0
@@ -87,6 +87,7 @@
'gammapy-detect = gammapy.scripts.detect:main',
'gammapy-find-obs = gammapy.scripts.find_obs:main',
'gammapy-image-decompose-a-trous = gammapy.scripts.image_decompose_a_trous:main',
'gammapy-image-pipe = gammapy.scripts.image_pipe:main',
'gammapy-info =',
'gammapy-irf-info = gammapy.scripts.irf_info:main',
'gammapy-iterative-source-detect = gammapy.scripts.iterative_source_detect:main',
ProTip! Use n and p to navigate between commits in a pull request.