Closed dachengx closed 3 months ago
Before you submit this PR: make sure to put all operations-related information in a wiki-note, a PR should be about code and is publicly accessible
Try to fix https://github.com/XENONnT/straxen/issues/1354
The change is minor so I will not update the version of plugins.
Like the MWE in https://github.com/XENONnT/straxen/issues/1354 listed, when
aftobs, aft, s1tot = 1.0, 0.18243408203125003, 2.0
The j_min and j_max are too close (j_min is 0, and j_max is 2.8076670357142592e-05) and the difference between their corresponding y0 and y1 is smaller than err=1e-7. Then before this PR, this line https://github.com/XENONnT/straxen/blob/92bcf54cc236d3de1c86544fa0fd720cb8daf088/straxen/plugins/events/event_pattern_fit.py#L572 will directly return j_max. But in principle, it should return the x which will give the y closer to the target. And in the MWE of https://github.com/XENONnT/straxen/issues/1354, it should return j_min.
j_min
j_max
y0
y1
err=1e-7
x
y
target
The vertical lines are j_min and j_max which are very close.
Please include the following if applicable:
All italic comments can be removed from this template.
coverage: 91.37% (+0.02%) from 91.347% when pulling cf741001205023d9811007e20a4148c24605bf59 on fix_numeric_derivative into 915183eaf3432f8e133f214061e66cadef383f60 on master.
Before you submit this PR: make sure to put all operations-related information in a wiki-note, a PR should be about code and is publicly accessible
What does the code in this PR do / what does it improve?
Try to fix https://github.com/XENONnT/straxen/issues/1354
The change is minor so I will not update the version of plugins.
Can you briefly describe how it works?
Like the MWE in https://github.com/XENONnT/straxen/issues/1354 listed, when
The
j_min
andj_max
are too close (j_min
is 0, andj_max
is 2.8076670357142592e-05) and the difference between their correspondingy0
andy1
is smaller thanerr=1e-7
. Then before this PR, this line https://github.com/XENONnT/straxen/blob/92bcf54cc236d3de1c86544fa0fd720cb8daf088/straxen/plugins/events/event_pattern_fit.py#L572 will directly returnj_max
. But in principle, it should return thex
which will give they
closer to thetarget
. And in the MWE of https://github.com/XENONnT/straxen/issues/1354, it should returnj_min
.Can you give a minimal working example (or illustrate with a figure)?
j_min
andj_max
which are very close.Please include the following if applicable:
Notes on testing
All italic comments can be removed from this template.