Skip to content

Incorrect calculation method for "∑(y)" in CurveStatsTool #44

@PierreRaybaut

Description

@PierreRaybaut

Summary

In the CurveStatsTool class, the summation of y-values "∑(y)" was incorrectly implemented using scipy.integrate.trapezoid instead of the appropriate numpy.sum function. This resulted in incorrect statistical values being displayed when using the curve statistics tool.

Problem Description

The CurveStatsTool provides various statistical calculations for curves, including sum of y-values, denoted as "∑(y)". However, the implementation was using the trapezoidal integration method (spt.trapezoid) which calculates the area under a curve. This is mathematically incorrect for a simple summation operation, which should simply add all y-values without any weighting or integration.

Incorrect Implementation (before fix)

("∑(y)=%g", lambda *args: spt.trapezoid(args[1], args[0])),

Correct Implementation (after fix)

("∑(y)=%g", lambda *args: np.sum(args[1])),

Impact

Users relying on the "∑(y)" calculation from the curve statistics tool were receiving incorrect values that represented an approximation of the integral rather than the actual sum of y-values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions