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
Change endtime - time >= 0 to endtime >= time #756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it is working. Just to give an example of what @JYangQi00 was talking about:
np.all(strax.endtime(things) >= things['time'])
False
np.all(strax.endtime(things) - things['time']>=0)
True
Unless @dachengx has objection, I would recommend merging. I don't think this will affect anything in regular data pipeline at all, but only affect those deep bugs (like wfsim) who would really have negative length. No worry for data. |
What are values in |
You can see the negative endtime because of issues Jianyang described. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks both!
What is the problem / what does the code in this PR do
strax._check_objects_non_negative_length
checks to see if there are any data entries such that endtime-time >=0. However, when there is an error in the endtime such that endtime is very negative, endtime - time sees an overflow error, and native python would have endtime - time >0. Such an example can be seen in pema (see PR: #333) As such, native python would not detect such cases using _check_objects_non_negative_length. In actuality, it seems that numba has a check which somehow bypasses this overflow error, and detects such cases anyway but this is an instance of unexpected behavior.Can you briefly describe how it works?
Simply change the statement
np.all(strax.endtime(things) - things['time'] >=0)
tonp.all(strax.endtime(things) >= things['time'])
.Can you give a minimal working example (or illustrate with a figure)?
Please include the following if applicable:
Please make sure that all automated tests have passed before asking for a review (you can save the PR as a draft otherwise).