Skip to content

Commit

Permalink
patch fix for ext raw_records
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuselli committed Dec 14, 2023
1 parent 9ca6598 commit 6d75635
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions amstrax/plugins/raw_records/daqreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 6d75635

Please sign in to comment.