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

Commit

Permalink
remove one boring test, add test for event_ids into can_iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Neise committed May 11, 2018
1 parent d6d26aa commit 341b431
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions protozfits/tests/test_R1_example_file.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

import numpy as np
import pkg_resources
import os

from protozfits import SimpleFile

example_file_path = pkg_resources.resource_filename(
'protozfits',
os.path.join(
Expand All @@ -13,29 +14,16 @@
)


def test_can_open_file():
from protozfits import SimpleFile
f = SimpleFile(example_file_path)
f.close()


def test_can_iterate_over_events_and_run_header():
from protozfits import SimpleFile
f = SimpleFile(example_file_path)

camera_config = next(f.CameraConfig)
assert (camera_config.expected_pixels_id == np.arange(14)).all()

for event in f.Events:
assert event.waveform.shape == (1120,)
assert event.pixel_status.shape == (14,)
assert event.lstcam.first_capacitor_id.shape == (16,)
assert event.lstcam.counters.shape == (44,)
f.close()

def test_event_ids():
from protozfits import SimpleFile
with SimpleFile(example_file_path) as f:
event_ids = [e.event_id for e in f.Events]

assert (np.array(event_ids) == 1 + np.arange(len(event_ids))).all()
camera_config = next(f.CameraConfig)
assert (camera_config.expected_pixels_id == np.arange(14)).all()

for i, event in enumerate(f.Events):
assert event.event_id == i + 1
assert event.waveform.shape == (1120,)
assert event.pixel_status.shape == (14,)
assert event.lstcam.first_capacitor_id.shape == (16,)
assert event.lstcam.counters.shape == (44,)

0 comments on commit 341b431

Please sign in to comment.