Skip to content
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 default of "all" for DataStore.get_observations #2160

merged 1 commit into from May 25, 2019


None yet
3 participants
Copy link

commented May 24, 2019

This PR adds a default of "all" to DataStore.get_observations.

It resolves #1255 .

I've changed my mind on this, especially now that we've added from_events_files I feel that always having to put obs_id = data_store.obs_table["OBS_ID"].data in each analysis script is annoying.

This is how you can access a single event list::
from import DataStore
path = "$GAMMAPY_DATA/cta-1dc/data/baseline/gps/gps_baseline_110380.fits"
data_store = DataStore.from_events_files([path])
observations = data_store.get_observations()
You can now analyse this data as usual (see any Gammapy tutorial).
If you have multiple event files, you have to make the list. Here's an example
using ``Path.glob`` to get a list of all events files in a given folder::
import os
from pathlib import Path
path = Path(os.environ["GAMMAPY_DATA"]) / "cta-1dc/data"
paths = list(path.rglob("*.fits"))
data_store = DataStore.from_events_files(paths)
observations = data_store.get_observations()

@cdeil cdeil added the feature label May 24, 2019

@cdeil cdeil added this to the 0.12 milestone May 24, 2019

@cdeil cdeil requested review from adonath, mackaiver and registerrier May 24, 2019

@cdeil cdeil self-assigned this May 24, 2019

Copy link

left a comment

I think that‘s a good default behaviour. No comments from my side...

@cdeil cdeil merged commit de21eee into gammapy:master May 25, 2019

6 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
gammapy.gammapy Build #20190524.14 had test failures
gammapy.gammapy (Test Python35) Test Python35 failed
Codacy/PR Quality Review Up to standards. A positive pull request.
Scrutinizer Analysis: 1 updated code elements – Tests: passed
gammapy.gammapy (DevDocs) DevDocs succeeded
gammapy.gammapy (Lint) Lint succeeded
gammapy.gammapy (Test Windows35) Test Windows35 succeeded
gammapy.gammapy (Test Windows37) Test Windows37 succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.