From 3a21a8505a772c2afaf2c1004d7f34a4d1cd58e2 Mon Sep 17 00:00:00 2001 From: Artur Glavic Date: Mon, 6 Oct 2025 10:10:41 +0200 Subject: [PATCH] Performance evaluation add TODOs --- libeos/event_analysis.py | 1 + libeos/event_handling.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libeos/event_analysis.py b/libeos/event_analysis.py index 14d1817..250434e 100644 --- a/libeos/event_analysis.py +++ b/libeos/event_analysis.py @@ -62,6 +62,7 @@ class CalculateWavelength(EventDataAction): #lamdaMax = const.lamdaCut+1.e13*dataset.timing.tau*const.hdm/(dataset.geometry.chopperDetectorDistance+124.) # lambda + # TODO: one of the most time consuming actions, could be implemented in numba, instead? lamda = (1.e13*const.hdm)*d.events.tof/(dataset.geometry.chopperDetectorDistance+d.events.detXdist) final_events = append_fields(d.events, [('lamda', np.float64)]) diff --git a/libeos/event_handling.py b/libeos/event_handling.py index 267b61f..4669f38 100644 --- a/libeos/event_handling.py +++ b/libeos/event_handling.py @@ -157,9 +157,9 @@ class ApplyMask(EventDataAction): self.bitmask_filter = bitmask_filter def perform_action(self, dataset: EventDatasetProtocol) ->None: + # TODO: why is this action time consuming? d = dataset.data - logging.info(f' number of events: total = {d.events.shape[0]:7d}, ' - f'filtered = {(d.events.mask!=0).sum():7d}') + pre_filter = d.events.shape[0] if logging.getLogger().level == logging.DEBUG: # only run this calculation if debug level is actually active filtered_by_mask = {} @@ -173,3 +173,5 @@ class ApplyMask(EventDataAction): # this means that all bits that are set in bitmask_filter will NOT be used to filter events fltr = (d.events.mask & (~self.bitmask_filter)) == 0 d.events = d.events[fltr] + post_filter = d.events.shape[0] + logging.info(f' number of events: total = {pre_filter:7d}, filtered = {pre_filter-post_filter:7d}')