Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeil committed Feb 23, 2016
1 parent 5214ad9 commit 1a02721
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
30 changes: 29 additions & 1 deletion gammapy/data/data_store.py
Expand Up @@ -6,6 +6,7 @@
from astropy.table import Table
from astropy.units import Quantity
from astropy.io import fits
from astropy.utils import lazyproperty
from .observation import ObservationTable
from ..utils.scripts import make_path
from ..extern.pathlib import Path
Expand Down Expand Up @@ -216,6 +217,26 @@ def load(self, obs_id, filetype):
else:
raise ValueError('Invalid filetype.')

def obs(self, obs_id):
"""Access a given `~gammapy.data.Observation`.
Accessing data via ``obs`` is an alternative to ``load_obs``
that allows dot-access and tab-completion on objects,
using lazy lookup.
Parameters
----------
obs_id : int
Observation ID.
Returns
-------
obs : `~gammapy.data.Observation`
Observation container
"""
raise NotImplementedError

def load_all(self, filetype):
"""Load a given file type for all observations
Expand Down Expand Up @@ -385,13 +406,20 @@ class Observation(object):
>>> obs.info()
TODO: prints summary output...
"""

def __init__(self, events=None, gti=None, aeff=None, edisp=None, psf=None):
self.events = events
self.__dict__['events'] = events
self.gti = gti
self.aeff = aeff
self.edisp = edisp
self.psf = psf

@lazyproperty
def events(self):
# access self._datastore_info
# load and return
pass

def peek(self):
"""Quick-look plots in a few panels."""

Expand Down
4 changes: 2 additions & 2 deletions gammapy/scripts/background_model.py
Expand Up @@ -153,8 +153,8 @@ def background_group():
obs_table = config.obs_table.copy()

# Define observation groups
# zenith_bins = np.array([0, 20, 30, 40, 50, 90])
zenith_bins = np.array([0, 49, 90])
zenith_bins = np.array([0, 20, 30, 40, 50, 90])
# zenith_bins = np.array([0, 49, 90])
# zenith_bins = np.array([0, 30, 90]) # for testing
axes = [ObservationGroupAxis('ZEN_PNT', zenith_bins, 'bin_edges')]
obs_groups = ObservationGroups(axes)
Expand Down

0 comments on commit 1a02721

Please sign in to comment.