Skip to content

Commit

Permalink
Merge pull request #237 from cta-observatory/eventtype_75
Browse files Browse the repository at this point in the history
Fix reading type 75, had wrong number of items
  • Loading branch information
maxnoe authored Mar 9, 2022
2 parents 1b3ea2a + d95cf07 commit 3fc3406
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion eventio/simtel/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class HistoryMeta(EventIOObject):
eventio_type = 75

def parse(self):
n_items = read_varint(self)
n_items = read_unsigned_varint(self)

data = {}
for _ in range(n_items):
k = read_var_string(self)
Expand Down
5 changes: 4 additions & 1 deletion tests/simtel/test_simtel_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ def test_75():

if n_found == 0:
assert 'global' in str(o)
assert len(data) == 0
assert len(data) == 11
assert b'CONFIG_RELEASE' in data
assert data[b'SIMTEL_RELEASE'] == b'2021-12-16 (development beyond prod-5)'
assert data[b'SIMTEL_BASE_RELEASE'] == b'2021-12-16 (development beyond prod-5)'
else:
assert f'telescope_id={n_found}' in str(o)
assert b'OPTICS_CONFIG_NAME' in data
Expand Down
5 changes: 3 additions & 2 deletions tests/simtel/test_simtelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def test_photons():

def test_history_meta():
with SimTelFile(history_meta_path) as f:
assert isinstance(f.global_meta, dict)
assert isinstance(f.telescope_meta, dict)
assert isinstance(f.global_meta, dict)
assert isinstance(f.telescope_meta, dict)
assert len(f.global_meta) == 11
assert len(f.telescope_meta) == 19

0 comments on commit 3fc3406

Please sign in to comment.