gundam-organization / gundam

GUNDAM, for Generalized and Unified Neutrino Data Analysis Methods, is a suite of applications which aims at performing various statistical analysis with different purposes and setups.
GNU Lesser General Public License v2.1
13 stars 11 forks source link

LightGraph extrapolation from the positive side #702

Closed nadrino closed 4 days ago

nadrino commented 4 days ago

While monitoring some parameter scans for the cross-section analysis "CC0$\pi$+CC1$\pi$ 4$\pi$", we've found some strange extrapolation of simple graphs (cf. attached image).

I found a similar problem while running p-values with some toys: some LightGraph would return a NaN response when extrapolating to the positive side.

The issue actually comes from CalculateGraph while looking for the appropriate knot index. For a given x value, a binary search is performed to find the index of the first graph point in which x is greater. For a "normal" case, the graph would find the points x1 and x2 for which: x1 < x < x2. However, when the binary search finds the last point of the graph (which will be labeled as x1), x2 does not exist so the function is seaking for an out of bound value!

For positive extrapolation, one have to make sure the binary search never return x1 as the last point of the graph.

I'll make a PR to propose a fix for this issue.

screenshot_2024-11-18_at_15 28 25

nadrino commented 4 days ago

Solved on https://github.com/gundam-organization/gundam/pull/703