Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
allow the name to be DataModel as well (#43)
Browse files Browse the repository at this point in the history
* allow the name to be DataModel as well

* add a test, to see if we can read all the files we have with File

* print a bit less, but show me that you are really running
  • Loading branch information
Dominik Neise authored May 15, 2018
1 parent 1a8e6f3 commit 8ef2d78
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions protozfits/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

pb2_modules = {
'L0': L0_pb2,
'DataModel': L0_pb2,
'R1': R1_pb2,
'R1_DigiCam': R1_DigiCam_pb2,
'R1_NectarCam': R1_NectarCam_pb2,
Expand Down
21 changes: 21 additions & 0 deletions protozfits/tests/test_R1_example_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import pkg_resources
import os
from glob import glob

from protozfits import File

Expand All @@ -27,3 +28,23 @@ def test_can_iterate_over_events_and_run_header():
assert event.pixel_status.shape == (14,)
assert event.lstcam.first_capacitor_id.shape == (16,)
assert event.lstcam.counters.shape == (44,)


glob_path = pkg_resources.resource_filename(
'protozfits',
os.path.join(
'tests',
'resources',
'*.fits.fz'
)
)

all_test_resources = sorted(glob(glob_path))


def test_can_open_and_get_an_event_from_all_test_resources():
print()
for path in all_test_resources:
with File(path) as f:
event = next(f.Events)
print(path, len(str(event)))

0 comments on commit 8ef2d78

Please sign in to comment.