From 6d75635a3586252da231faa60fbd12d49b43a73d Mon Sep 17 00:00:00 2001 From: cfuselli <cfuselli@nikhef.nl> Date: Thu, 14 Dec 2023 15:39:30 +0100 Subject: [PATCH 1/2] patch fix for ext raw_records --- amstrax/plugins/raw_records/daqreader.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/amstrax/plugins/raw_records/daqreader.py b/amstrax/plugins/raw_records/daqreader.py index 23ae3721..f0062f4d 100644 --- a/amstrax/plugins/raw_records/daqreader.py +++ b/amstrax/plugins/raw_records/daqreader.py @@ -398,16 +398,19 @@ def split_channel_ranges(records, channel_ranges): # First loop to count number of records per detector for r_i, r in enumerate(records): + found = False for d_i, (left, right) in enumerate(channel_ranges): if left <= r['channel'] <= right: which_detector[r_i] = d_i n_in_detector[d_i] += 1 + found = True break - else: - # channel_ranges should be sorted ascending. - channel_int = int(r['channel']) # Convert to int outside the f-string - print("Unknown channel found:", channel_int) # Add this line for debugging - raise ValueError(f"Bad data from DAQ: data in unknown channel") + if not found: + # channel_ranges should be sorted ascending. + channel_int = int(r['channel']) # Convert to int outside the f-string + print("Unknown channel found:", channel_int) # Add this line for debugging + raise ValueError(f"Bad data from DAQ: data in unknown channel {channel_int}") + # Allocate memory results = numba.typed.List() From 4d0084c9660b10de42e50bdb3753c442b3ee95f7 Mon Sep 17 00:00:00 2001 From: cfuselli <cfuselli@nikhef.nl> Date: Thu, 14 Dec 2023 15:46:37 +0100 Subject: [PATCH 2/2] patch fix for ext raw_records --- amstrax/plugins/raw_records/daqreader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amstrax/plugins/raw_records/daqreader.py b/amstrax/plugins/raw_records/daqreader.py index f0062f4d..b7b8ea50 100644 --- a/amstrax/plugins/raw_records/daqreader.py +++ b/amstrax/plugins/raw_records/daqreader.py @@ -409,7 +409,7 @@ def split_channel_ranges(records, channel_ranges): # channel_ranges should be sorted ascending. channel_int = int(r['channel']) # Convert to int outside the f-string print("Unknown channel found:", channel_int) # Add this line for debugging - raise ValueError(f"Bad data from DAQ: data in unknown channel {channel_int}") + raise ValueError("Bad data from DAQ: data in unknown channel") # Allocate memory