Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch fix for ext raw_records #297

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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