diff --git a/src/ctapipe_io_lst/multifiles.py b/src/ctapipe_io_lst/multifiles.py index b8165f01..c92a7134 100644 --- a/src/ctapipe_io_lst/multifiles.py +++ b/src/ctapipe_io_lst/multifiles.py @@ -146,7 +146,7 @@ def _load_next_subrun(self, stream): if stream is None: path = self.path - stream = self.file_info.stream + stream = self.file_info.stream if self.file_info is not None else None else: self.current_subrun[stream] += 1 diff --git a/src/ctapipe_io_lst/tests/test_lsteventsource.py b/src/ctapipe_io_lst/tests/test_lsteventsource.py index 90bea5f1..7112ce99 100644 --- a/src/ctapipe_io_lst/tests/test_lsteventsource.py +++ b/src/ctapipe_io_lst/tests/test_lsteventsource.py @@ -437,3 +437,17 @@ def test_evb_calibrated_data(): assert np.all(e.calibration.tel[1].dl1.time_shift != 0) assert read_events == 200 + + +def test_arbitrary_filename(tmp_path): + from ctapipe_io_lst import LSTEventSource + path = tmp_path / "some_name_not_matching_the_lst_pattern.fits.fz" + path.write_bytes(test_r0_path_all_streams.read_bytes()) + + assert LSTEventSource.is_compatible(path) + + with LSTEventSource(path, pointing_information=False, apply_drs4_corrections=False) as source: + n_read = 0 + for _ in source: + n_read += 1 + assert n_read == n_read