From 45f885df5fb3604def376ea5863d218dbc5589fb Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Tue, 30 May 2023 12:52:00 +0900 Subject: [PATCH 01/12] optional check of I3Filters in dataconverter --- src/graphnet/data/dataconverter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index dc0deabd0..3d9304f9f 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -107,6 +107,7 @@ def __init__( workers: int = 1, index_column: str = "event_no", icetray_verbose: int = 0, + I3filters: List[str] = [], ): """Construct DataConverter. @@ -166,6 +167,7 @@ def __init__( self._sequential_batch_pattern = sequential_batch_pattern self._input_file_batch_pattern = input_file_batch_pattern self._workers = workers + self._I3filters = I3filters # Create I3Extractors self._extractors = I3ExtractorCollection(*extractors) @@ -435,6 +437,8 @@ def _extract_data(self, fileset: FileSet) -> List[OrderedDict]: continue if self._skip_frame(frame): continue + if self._filter_mask(frame, self._I3filters): + continue # Try to extract data from I3Frame results = self._extractors(frame) @@ -566,3 +570,17 @@ def _skip_frame(self, frame: "icetray.I3Frame") -> bool: if frame["I3EventHeader"].sub_event_stream == "NullSplit": return True return False + + def _filter_mask( + self, frame: "icetray.I3Frame", I3filters: List[str] + ) -> bool: + """Check if specified condition(s) are met. + + Args: + frame: I3Frame to check. + I3filters: List of I3Filters to check for pass. + """ + for filter in I3filters: + if frame["FilterMask"][filter].condition_passed is False: + return True + return False From faf38bd05dfe3edc94b6db9ecb6c99e2b5a13af1 Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Mon, 25 Sep 2023 09:19:01 +0900 Subject: [PATCH 02/12] checks existence of filters --- src/graphnet/data/dataconverter.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 3d9304f9f..616030ae1 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -580,7 +580,17 @@ def _filter_mask( frame: I3Frame to check. I3filters: List of I3Filters to check for pass. """ + if "FilterMask" not in frame: + self.warning_once( + "FilterMask not found in frame. Skipping filter checks." + ) + return False for filter in I3filters: + if filter not in frame["FilterMask"]: + self.warning_once( + f"Filter {filter} not found in frame. Skipping." + ) + continue if frame["FilterMask"][filter].condition_passed is False: return True return False From 4e3e391057148b4022221b151db8fbee532f3bee Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Mon, 25 Sep 2023 09:38:45 +0900 Subject: [PATCH 03/12] refactoring --- src/graphnet/data/dataconverter.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 616030ae1..54cbbf418 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -580,17 +580,19 @@ def _filter_mask( frame: I3Frame to check. I3filters: List of I3Filters to check for pass. """ - if "FilterMask" not in frame: + if "FilterMask" in frame: + for filter in I3filters: + if filter in frame["FilterMask"]: + if frame["FilterMask"][filter].condition_passed is False: + return True + else: + self.warning_once( + f"Filter {filter} not found in frame. Skipping filter check." + ) + continue + else: self.warning_once( "FilterMask not found in frame. Skipping filter checks." ) return False - for filter in I3filters: - if filter not in frame["FilterMask"]: - self.warning_once( - f"Filter {filter} not found in frame. Skipping." - ) - continue - if frame["FilterMask"][filter].condition_passed is False: - return True return False From 5d57ff623e32a53d3118b1d4bd88c4db9b49b6b1 Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Mon, 25 Sep 2023 12:44:00 +0900 Subject: [PATCH 04/12] revert --- src/graphnet/data/dataconverter.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 54cbbf418..616030ae1 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -580,19 +580,17 @@ def _filter_mask( frame: I3Frame to check. I3filters: List of I3Filters to check for pass. """ - if "FilterMask" in frame: - for filter in I3filters: - if filter in frame["FilterMask"]: - if frame["FilterMask"][filter].condition_passed is False: - return True - else: - self.warning_once( - f"Filter {filter} not found in frame. Skipping filter check." - ) - continue - else: + if "FilterMask" not in frame: self.warning_once( "FilterMask not found in frame. Skipping filter checks." ) return False + for filter in I3filters: + if filter not in frame["FilterMask"]: + self.warning_once( + f"Filter {filter} not found in frame. Skipping." + ) + continue + if frame["FilterMask"][filter].condition_passed is False: + return True return False From 3f3451fb9c6b15a09b95bd190dbc9b62b4ada6b3 Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Tue, 26 Sep 2023 10:37:22 +0900 Subject: [PATCH 05/12] refactoring --- src/graphnet/data/dataconverter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 616030ae1..92d7ae59b 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -437,7 +437,7 @@ def _extract_data(self, fileset: FileSet) -> List[OrderedDict]: continue if self._skip_frame(frame): continue - if self._filter_mask(frame, self._I3filters): + if self._filter_mask(frame): continue # Try to extract data from I3Frame @@ -571,11 +571,11 @@ def _skip_frame(self, frame: "icetray.I3Frame") -> bool: return True return False - def _filter_mask( - self, frame: "icetray.I3Frame", I3filters: List[str] - ) -> bool: + def _filter_mask(self, frame: "icetray.I3Frame") -> bool: """Check if specified condition(s) are met. + A 'True' return will skip the frame. + Args: frame: I3Frame to check. I3filters: List of I3Filters to check for pass. @@ -585,7 +585,7 @@ def _filter_mask( "FilterMask not found in frame. Skipping filter checks." ) return False - for filter in I3filters: + for filter in self._I3filters: if filter not in frame["FilterMask"]: self.warning_once( f"Filter {filter} not found in frame. Skipping." From 96264d7187fe77b067936dced05d6d818cdcfbc1 Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Tue, 26 Sep 2023 15:53:22 +0900 Subject: [PATCH 06/12] create filter class --- src/graphnet/data/dataconverter.py | 52 +++++------- src/graphnet/data/filters.py | 124 +++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 34 deletions(-) create mode 100644 src/graphnet/data/filters.py diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 92d7ae59b..51a69d36a 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -21,6 +21,7 @@ TypeVar, Union, cast, + Sequence, ) import numpy as np @@ -39,6 +40,7 @@ from graphnet.utilities.filesys import find_i3_files from graphnet.utilities.imports import has_icecube_package from graphnet.utilities.logging import Logger +from graphnet.data.filters import I3Filter, NullSplitI3Filter if has_icecube_package(): from icecube import icetray, dataio # pyright: reportMissingImports=false @@ -107,7 +109,7 @@ def __init__( workers: int = 1, index_column: str = "event_no", icetray_verbose: int = 0, - I3filters: List[str] = [], + i3_Filters: Union[I3Filter, List[Callable]] = [NullSplitI3Filter], ): """Construct DataConverter. @@ -167,7 +169,13 @@ def __init__( self._sequential_batch_pattern = sequential_batch_pattern self._input_file_batch_pattern = input_file_batch_pattern self._workers = workers - self._I3filters = I3filters + if isinstance(i3_Filters, I3Filter): + I3_Filters = [i3_Filters] + self._I3filters = I3_Filters + for filter in self._I3filters: + assert isinstance( + filter, I3Filter + ), f"{type(filter)} is not a subclass of I3Filter" # Create I3Extractors self._extractors = I3ExtractorCollection(*extractors) @@ -435,10 +443,9 @@ def _extract_data(self, fileset: FileSet) -> List[OrderedDict]: except Exception as e: if "I3" in str(e): continue + # check if frame should be skipped if self._skip_frame(frame): continue - if self._filter_mask(frame): - continue # Try to extract data from I3Frame results = self._extractors(frame) @@ -559,38 +566,15 @@ def _get_output_file(self, input_file: str) -> str: return output_file def _skip_frame(self, frame: "icetray.I3Frame") -> bool: - """Check if frame should be skipped. - - Args: - frame: I3Frame to check. + """Check the user defined filters. Returns: - True if frame is a null split frame, else False. + bool: True if frame should be skipped, False otherwise. """ - if frame["I3EventHeader"].sub_event_stream == "NullSplit": - return True - return False - - def _filter_mask(self, frame: "icetray.I3Frame") -> bool: - """Check if specified condition(s) are met. + if self._I3filters is None: + return False # No filters defined, so we keep the frame - A 'True' return will skip the frame. - - Args: - frame: I3Frame to check. - I3filters: List of I3Filters to check for pass. - """ - if "FilterMask" not in frame: - self.warning_once( - "FilterMask not found in frame. Skipping filter checks." - ) - return False for filter in self._I3filters: - if filter not in frame["FilterMask"]: - self.warning_once( - f"Filter {filter} not found in frame. Skipping." - ) - continue - if frame["FilterMask"][filter].condition_passed is False: - return True - return False + if not filter(frame): + return True # A filter keep_frame call has returned false, so we skip the frame + return False # All filter keep_frame calls have returned true, so we keep the frame diff --git a/src/graphnet/data/filters.py b/src/graphnet/data/filters.py new file mode 100644 index 000000000..2697e0a53 --- /dev/null +++ b/src/graphnet/data/filters.py @@ -0,0 +1,124 @@ +"""Filter classes for filtering I3-frames when converting I3-files.""" +from abc import abstractmethod +from graphnet.utilities.logging import Logger +from typing import List +from icecube import icetray + + +class I3Filter(Logger): + """A generic filter for I3-frames.""" + + @abstractmethod + def _pass_frame(self, frame: icetray.I3Frame) -> bool: + """Return True if the frame passes the filter, False otherwise. + + Args: + frame: I3-frame + The I3-frame to check. + + Returns: + bool: True if the frame passes the filter, False otherwise. + """ + raise NotImplementedError + + def __call__(self, frame: icetray.I3Frame) -> bool: + """Return True if the frame passes the filter, False otherwise. + + Args: + frame: I3-frame + The I3-frame to check. + + Returns: + bool: True if the frame passes the filter, False otherwise. + """ + pass_flag = self._pass_frame(frame) + try: + assert isinstance(pass_flag, bool) + except AssertionError: + raise TypeError( + f"Expected _pass_frame to return a bool, got {type(pass_flag)}." + ) + return pass_flag + + +class NullSplitI3Filter(I3Filter): + """A filter that skips all null-split frames.""" + + def _keep_frame(self, frame: icetray.I3Frame) -> bool: + """Check that frame is not a null-split frame. + + returns False if the frame is a null-split frame, True otherwise. + + Args: + frame: I3-frame + The I3-frame to check. + """ + if frame.Has("I3EventHeader"): + if frame["I3EventHeader"].sub_event_stream == "NullSplit": + return False + return True + + +class I3FilterMask(I3Filter): + """checks list of filters from the FilterMask in I3 frames.""" + + def __init__(self, filter_names: List[str], filter_any: bool = True): + """Initialize I3FilterMask. + + Args: + filter_names: List[str] + A list of filter names to check for. + filter_any: bool + standard: True + If True, the frame is kept if any of the filter names are present. + If False, the frame is kept if all of the filter names are present. + """ + self._filter_names = filter_names + self._filter_any = filter_any + + def _keep_frame(self, frame: icetray.I3Frame) -> bool: + """Check if current frame should be kept. + + Args: + frame: I3-frame + The I3-frame to check. + """ + if "FilterMask" in frame: + if ( + self._filter_any is True + ): # Require any of the filters to pass to keep the frame + bool_list = [] + for filter_name in self._filter_names: + if filter_name not in frame["FilterMask"]: + self.warning_once( + f"FilterMask {filter_name} not found in frame.skipping filter." + ) + continue + elif frame["FilterMask"][filter].condition_passed is True: + bool_list.append(True) + else: + bool_list.append(False) + if len(bool_list) == 0: + self.warning_once( + "None of the FilterMask filters found in frame, FilterMask filters will not be applied." + ) + return any(bool_list) or len(bool_list) == 0 + else: # Require all filters to pass in order to keep the frame. + for filter_name in self._filter_names: + if filter_name not in frame["FilterMask"]: + self.warning_once( + f"FilterMask {filter_name} not found in frame, skipping filter." + ) + continue + elif frame["FilterMask"][filter].condition_passed is True: + continue # current filter is passed, continue to next filter + else: + return ( + False # current filter failed so frame is skipped. + ) + return True + else: + self.warning_once( + "FilterMask not found in frame, FilterMask filters will not be applied." + ) + return True From 53d4a09abb3d48108316ebf20f88c4d282c2d0af Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Tue, 26 Sep 2023 16:02:12 +0900 Subject: [PATCH 07/12] code_climate_fixes --- src/graphnet/data/dataconverter.py | 4 ++-- src/graphnet/data/filters.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 51a69d36a..1e8b64271 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -576,5 +576,5 @@ def _skip_frame(self, frame: "icetray.I3Frame") -> bool: for filter in self._I3filters: if not filter(frame): - return True # A filter keep_frame call has returned false, so we skip the frame - return False # All filter keep_frame calls have returned true, so we keep the frame + return True # keep_frame call false, skip the frame. + return False # All filter keep_frame calls true, keep the frame. diff --git a/src/graphnet/data/filters.py b/src/graphnet/data/filters.py index 2697e0a53..f862ea197 100644 --- a/src/graphnet/data/filters.py +++ b/src/graphnet/data/filters.py @@ -36,7 +36,7 @@ def __call__(self, frame: icetray.I3Frame) -> bool: assert isinstance(pass_flag, bool) except AssertionError: raise TypeError( - f"Expected _pass_frame to return a bool, got {type(pass_flag)}." + f"Expected _pass_frame to return bool, got {type(pass_flag)}." ) return pass_flag @@ -91,7 +91,7 @@ def _keep_frame(self, frame: icetray.I3Frame) -> bool: for filter_name in self._filter_names: if filter_name not in frame["FilterMask"]: self.warning_once( - f"FilterMask {filter_name} not found in frame.skipping filter." + f"FilterMask {filter_name} not found in frame. skipping filter." ) continue elif frame["FilterMask"][filter].condition_passed is True: @@ -111,7 +111,7 @@ def _keep_frame(self, frame: icetray.I3Frame) -> bool: ) continue elif frame["FilterMask"][filter].condition_passed is True: - continue # current filter is passed, continue to next filter + continue # current filter passed, continue to next filter else: return ( False # current filter failed so frame is skipped. From 5c4260f8fd3569b8d96506084afc4975a0d759da Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Wed, 27 Sep 2023 09:56:05 +0900 Subject: [PATCH 08/12] add to init --- src/graphnet/data/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/graphnet/data/__init__.py b/src/graphnet/data/__init__.py index 1eca4f6cd..fbb1ee095 100644 --- a/src/graphnet/data/__init__.py +++ b/src/graphnet/data/__init__.py @@ -3,3 +3,4 @@ `graphnet.data` enables converting domain-specific data to industry-standard, intermediate file formats and reading this data. """ +from .filters import I3Filter, I3FilterMask From 83cce2a1de1ecd4312ade1d6a24a8e265728818b Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Wed, 27 Sep 2023 10:11:59 +0900 Subject: [PATCH 09/12] optional icetray dependency --- src/graphnet/data/filters.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/graphnet/data/filters.py b/src/graphnet/data/filters.py index f862ea197..21a31e429 100644 --- a/src/graphnet/data/filters.py +++ b/src/graphnet/data/filters.py @@ -2,14 +2,18 @@ from abc import abstractmethod from graphnet.utilities.logging import Logger from typing import List -from icecube import icetray + +from graphnet.utilities.imports import has_icecube_package + +if has_icecube_package(): + from icecube import icetray class I3Filter(Logger): """A generic filter for I3-frames.""" @abstractmethod - def _pass_frame(self, frame: icetray.I3Frame) -> bool: + def _pass_frame(self, frame: "icetray.I3Frame") -> bool: """Return True if the frame passes the filter, False otherwise. Args: @@ -21,7 +25,7 @@ def _pass_frame(self, frame: icetray.I3Frame) -> bool: """ raise NotImplementedError - def __call__(self, frame: icetray.I3Frame) -> bool: + def __call__(self, frame: "icetray.I3Frame") -> bool: """Return True if the frame passes the filter, False otherwise. Args: @@ -44,7 +48,7 @@ def __call__(self, frame: icetray.I3Frame) -> bool: class NullSplitI3Filter(I3Filter): """A filter that skips all null-split frames.""" - def _keep_frame(self, frame: icetray.I3Frame) -> bool: + def _keep_frame(self, frame: "icetray.I3Frame") -> bool: """Check that frame is not a null-split frame. returns False if the frame is a null-split frame, True otherwise. @@ -76,7 +80,7 @@ def __init__(self, filter_names: List[str], filter_any: bool = True): self._filter_names = filter_names self._filter_any = filter_any - def _keep_frame(self, frame: icetray.I3Frame) -> bool: + def _keep_frame(self, frame: "icetray.I3Frame") -> bool: """Check if current frame should be kept. Args: From b091cbc84978c965d811a3f55c682ebd805e4d73 Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Thu, 28 Sep 2023 09:58:31 +0900 Subject: [PATCH 10/12] typo-fix --- src/graphnet/data/dataconverter.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 1e8b64271..eb42dc7a1 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -109,7 +109,7 @@ def __init__( workers: int = 1, index_column: str = "event_no", icetray_verbose: int = 0, - i3_Filters: Union[I3Filter, List[Callable]] = [NullSplitI3Filter], + I3_Filters: Union[I3Filter, List[Callable]] = [NullSplitI3Filter], ): """Construct DataConverter. @@ -169,10 +169,10 @@ def __init__( self._sequential_batch_pattern = sequential_batch_pattern self._input_file_batch_pattern = input_file_batch_pattern self._workers = workers - if isinstance(i3_Filters, I3Filter): - I3_Filters = [i3_Filters] - self._I3filters = I3_Filters - for filter in self._I3filters: + if isinstance(I3_Filters, I3Filter): + I3_Filters = [I3_Filters] + self._I3Filters = I3_Filters + for filter in self._I3Filters: assert isinstance( filter, I3Filter ), f"{type(filter)} is not a subclass of I3Filter" @@ -571,10 +571,10 @@ def _skip_frame(self, frame: "icetray.I3Frame") -> bool: Returns: bool: True if frame should be skipped, False otherwise. """ - if self._I3filters is None: + if self._I3Filters is None: return False # No filters defined, so we keep the frame - for filter in self._I3filters: + for filter in self._I3Filters: if not filter(frame): return True # keep_frame call false, skip the frame. return False # All filter keep_frame calls true, keep the frame. From 12aec80e01acb2dd88362f8391b85de653d7b98d Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Thu, 28 Sep 2023 11:22:12 +0900 Subject: [PATCH 11/12] refactoring/bugfixing --- src/graphnet/data/dataconverter.py | 10 +++++----- src/graphnet/data/filters.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index eb42dc7a1..0f12e7ab5 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -21,7 +21,6 @@ TypeVar, Union, cast, - Sequence, ) import numpy as np @@ -109,7 +108,7 @@ def __init__( workers: int = 1, index_column: str = "event_no", icetray_verbose: int = 0, - I3_Filters: Union[I3Filter, List[Callable]] = [NullSplitI3Filter], + I3_Filters: List[I3Filter] = [], ): """Construct DataConverter. @@ -169,9 +168,10 @@ def __init__( self._sequential_batch_pattern = sequential_batch_pattern self._input_file_batch_pattern = input_file_batch_pattern self._workers = workers - if isinstance(I3_Filters, I3Filter): - I3_Filters = [I3_Filters] - self._I3Filters = I3_Filters + + # I3Filters (NullSplitI3Filter is always included) + self._I3Filters = [NullSplitI3Filter()] + I3_Filters + for filter in self._I3Filters: assert isinstance( filter, I3Filter diff --git a/src/graphnet/data/filters.py b/src/graphnet/data/filters.py index 21a31e429..ca83f4217 100644 --- a/src/graphnet/data/filters.py +++ b/src/graphnet/data/filters.py @@ -13,15 +13,15 @@ class I3Filter(Logger): """A generic filter for I3-frames.""" @abstractmethod - def _pass_frame(self, frame: "icetray.I3Frame") -> bool: - """Return True if the frame passes the filter, False otherwise. + def _keep_frame(self, frame: "icetray.I3Frame") -> bool: + """Return True if the frame is kept, False otherwise. Args: frame: I3-frame The I3-frame to check. Returns: - bool: True if the frame passes the filter, False otherwise. + bool: True if the frame is kept, False otherwise. """ raise NotImplementedError @@ -35,7 +35,7 @@ def __call__(self, frame: "icetray.I3Frame") -> bool: Returns: bool: True if the frame passes the filter, False otherwise. """ - pass_flag = self._pass_frame(frame) + pass_flag = self._keep_frame(frame) try: assert isinstance(pass_flag, bool) except AssertionError: From 8c21d2e57738d12c75d19eb2c159b2d43ab429cd Mon Sep 17 00:00:00 2001 From: Aske-Rosted Date: Thu, 28 Sep 2023 16:44:29 +0900 Subject: [PATCH 12/12] snake-case --- src/graphnet/data/dataconverter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 0f12e7ab5..41cec5eec 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -108,7 +108,7 @@ def __init__( workers: int = 1, index_column: str = "event_no", icetray_verbose: int = 0, - I3_Filters: List[I3Filter] = [], + i3_filters: List[I3Filter] = [], ): """Construct DataConverter. @@ -170,9 +170,9 @@ def __init__( self._workers = workers # I3Filters (NullSplitI3Filter is always included) - self._I3Filters = [NullSplitI3Filter()] + I3_Filters + self._i3filters = [NullSplitI3Filter()] + i3_filters - for filter in self._I3Filters: + for filter in self._i3filters: assert isinstance( filter, I3Filter ), f"{type(filter)} is not a subclass of I3Filter" @@ -571,10 +571,10 @@ def _skip_frame(self, frame: "icetray.I3Frame") -> bool: Returns: bool: True if frame should be skipped, False otherwise. """ - if self._I3Filters is None: + if self._i3filters is None: return False # No filters defined, so we keep the frame - for filter in self._I3Filters: + for filter in self._i3filters: if not filter(frame): return True # keep_frame call false, skip the frame. return False # All filter keep_frame calls true, keep the frame.