Skip to content

Commit

Permalink
Patch fix for ext raw_records (#297)
Browse files Browse the repository at this point in the history
* patch fix for ext raw_records

* patch fix for ext raw_records
  • Loading branch information
cfuselli committed Dec 14, 2023
1 parent d9c0e44 commit fbea20c
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("Bad data from DAQ: data in unknown channel")


# Allocate memory
results = numba.typed.List()
Expand Down

0 comments on commit fbea20c

Please sign in to comment.