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

Non-positive hits raises error for corner cases #1357

Open
dachengx opened this issue Apr 6, 2024 · 1 comment
Open

Non-positive hits raises error for corner cases #1357

dachengx opened this issue Apr 6, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@dachengx
Copy link
Collaborator

dachengx commented Apr 6, 2024

Describe the bug
After strax.find_hit_integration_bounds, the "right_integration" might be equal to "left_integration" for hits or lone_hits, so that later will raise error in the functions which require positive length.

There are two cases.

To Reproduce
The first one is for the 519th chunk of 048880

import cutax
st = cutax.xenonnt_offline(xedocs_version='global_v14')
run_id = '048880'
chunk_number = 519
st.make(run_id, 'peaklets', _chunk_number=chunk_number)

shows error

  File "/home/xudc/straxen/straxen/plugins/peaklets/peaklets.py", line 262, in compute
    strax.sum_waveform(
  File "/opt/miniconda3/envs/XENONnT_2024.03.1/lib/python3.9/site-packages/numba/np/arraymath.py", line 572, in impl_max 
    raise ValueError("zero-size array to reduction operation "
ValueError: zero-size array to reduction operation maximum which has no identity

because in https://github.com/AxFoundation/strax/blob/ebcb699fd85edb30b133fcb00e48dafa46faca4c/strax/processing/peak_building.py#L329-L331, if hit["length"] is 0, r_start and r_end are the same.

The second one is for 11th chunk of 044256

import cutax
st = cutax.xenonnt_offline(xedocs_version='global_v14')
run_id = '044256'
chunk_number = 11
st.make(run_id, 'merged_s2s', _chunk_number=chunk_number)

shows error

  File "/opt/XENONnT/anaconda/envs/XENONnT_2024.02.1/lib/python3.9/site-packages/strax/processing/general.py", line 150, in _fully_contained_in_sanity
    raise ValueError(f"{names} should have non-negative length!")
ValueError: things should have non-negative length!

also reported in slack thread. Because in

lh["length"] = lh["right_integration"] - lh["left_integration"]
, lh["length"] is 0.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions

module version path git
python 3.9.19 /opt/XENONnT/anaconda/envs/XENONnT_2024.03.1/bin/python None
strax 1.6.2 /home/xudc/strax/strax branch:master
straxen 2.2.1 /home/xudc/straxen/straxen branch:master
cutax 1.17.1 /home/xudc/cutax/cutax branch:master
@dachengx dachengx added the bug Something isn't working label Apr 6, 2024
@yuema137
Copy link
Collaborator

yuema137 commented Apr 8, 2024

Seems to be a very low-level bug. Let me try to look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants