@@ -83,11 +83,37 @@ def make_detection_bin(
8383 [expanded_detection_bin ])[0 ]
8484
8585
86+ @typing .overload
8687def get_detection_efficiency (scanner : petsird .ScannerInformation ,
8788 type_of_module_pair : petsird .TypeOfModulePair ,
8889 detection_bin_1 : petsird .DetectionBin ,
8990 detection_bin_2 : petsird .DetectionBin ) -> float :
9091 """Compute the detection efficiency for a pair of detectors"""
92+ ...
93+
94+
95+ @typing .overload
96+ def get_detection_efficiency (scanner : petsird .ScannerInformation ,
97+ type_of_module_pair : petsird .TypeOfModulePair ,
98+ event : petsird .CoincidenceEvent ) -> float :
99+ """Compute the detection efficiency for a coincidence event"""
100+ ...
101+
102+
103+ def get_detection_efficiency (
104+ scanner : petsird .ScannerInformation ,
105+ type_of_module_pair : petsird .TypeOfModulePair ,
106+ event_or_detection_bin_1 : typing .Union [petsird .CoincidenceEvent ,
107+ petsird .DetectionBin ],
108+ detection_bin_2 : petsird .DetectionBin = None ) -> float :
109+ """Compute the detection efficiency"""
110+ if isinstance (event_or_detection_bin_1 , petsird .DetectionBin ):
111+ detection_bin_1 = event_or_detection_bin_1
112+ assert detection_bin_2 is not None , "Second detection bin must be provided"
113+ else :
114+ detection_bin_1 , detection_bin_2 = event_or_detection_bin_1 .detection_bins [:
115+ 2 ]
116+
91117 if scanner .detection_efficiencies is None :
92118 # should never happen really, but this way, we don't crash.
93119 return 1.
@@ -139,13 +165,3 @@ def get_detection_efficiency(scanner: petsird.ScannerInformation,
139165 expanded_det_bin1 .energy_index ]
140166
141167 return eff
142-
143-
144- def get_event_detection_efficiency (
145- scanner : petsird .ScannerInformation ,
146- type_of_module_pair : petsird .TypeOfModulePair ,
147- event : petsird .CoincidenceEvent ) -> float :
148- """Compute the detection efficiency for a coincidence event"""
149- return get_detection_efficiency (scanner , type_of_module_pair ,
150- event .detection_bins [0 ],
151- event .detection_bins [1 ])
0 commit comments