Skip to content

Commit

Permalink
check reference_location for prod2 files
Browse files Browse the repository at this point in the history
Should be Null Island
  • Loading branch information
kosack committed Sep 27, 2023
1 parent cfbde2f commit b71d64b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ctapipe/io/tests/test_simteleventsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,27 @@ def test_gamma_file_prod2():
with SimTelEventSource(
input_url=dataset,
focal_length_choice="EQUIVALENT",
) as reader:
assert reader.is_compatible(dataset)
assert reader.is_stream # using gzip subprocess makes it a stream
) as source:
assert source.is_compatible(dataset)
assert source.is_stream # using gzip subprocess makes it a stream

for event in reader:
for event in source:
if event.count == 0:
assert event.r0.tel.keys() == {38, 47}
elif event.count == 1:
assert event.r0.tel.keys() == {11, 21, 24, 26, 61, 63, 118, 119}
else:
break

# test that max_events works:
# check also that for old files with no reference_locatino that we get back
# Null Island at the right height:
assert source.subarray.reference_location.geodetic.height > 100 * u.m
assert np.isclose(
source.subarray.reference_location.geodetic.lat, 0 * u.deg
)
assert np.isclose(
source.subarray.reference_location.geodetic.lon, 0 * u.deg
)


def test_max_events():
Expand Down

0 comments on commit b71d64b

Please sign in to comment.