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


Copy link

@cdeil cdeil 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, kbruegge and registerrier May 24, 2019
@cdeil cdeil self-assigned this May 24, 2019
Copy link

@adonath adonath 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants