File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 18
18
from .i3pisaextractor import I3PISAExtractor
19
19
from .i3ntmuonlabelsextractor import I3NTMuonLabelExtractor
20
20
from .i3quesoextractor import I3QUESOExtractor
21
+ from .i3filtermapextractor import I3FilterMapExtractor
Original file line number Diff line number Diff line change
1
+ """I3Extractor for extracting the boolean condition of the I3FilterMask."""
2
+
3
+ from typing import TYPE_CHECKING , Dict
4
+
5
+ from graphnet .data .extractors .icecube import I3Extractor
6
+
7
+ if TYPE_CHECKING :
8
+ from icecube import icetray # pyright: reportMissingImports=false
9
+
10
+
11
+ class I3FilterMapExtractor (I3Extractor ):
12
+ """Class for extracting I3FilterMap properties.
13
+
14
+ This class extracts the boolean condition of the I3FilterMask from the
15
+ I3FilterMap in the frame.
16
+ """
17
+
18
+ def __init__ (
19
+ self ,
20
+ key : str = "FilterMask" ,
21
+ extractor_name : str = "I3FilterMap" ,
22
+ exclude : list = [None ],
23
+ ) -> None :
24
+ """Construct I3FilterMapExtractor."""
25
+ # Base class constructor
26
+ super ().__init__ (extractor_name = extractor_name , exclude = exclude )
27
+ self ._key = key
28
+
29
+ def __call__ (self , frame : "icetray.I3Frame" ) -> Dict [str , bool ]:
30
+ """Extract I3FilterMap properties from I3FilterMap in frame."""
31
+ output = {}
32
+ if self ._key not in frame :
33
+ raise KeyError (f"Key { self ._key } not found in frame." )
34
+ items = frame [self ._key ].items ()
35
+ for item in items :
36
+ output [item [0 ]] = item [1 ].condition_passed
37
+ return output
You can’t perform that action at this time.
0 commit comments