Skip to content

generate_percentiles test fails on improver_conda_forge env #2351

Open

Description

@benowen-bom

Running the acceptance tests using the conda-forge.yml environment is failing on acceptance/test_generate_percentiles.py, specifically the test_masked_percentiles test; the test output differs from the kgo at a selection of points.

I've tracked down the issue to the fact that fast_interp_same_y and slow_interp_same_y return slightly different results, with the fast variant the preferred option (which was used to generate the data), but the slow variant being used in the conda-forge environment as numba is not available.

A minimal example that highlights the issue is the following:

x = [[0.25, 0.5, 0.75],]
xp = [[0, 0.5, 0.5, 0.833333, 1],]
fp = [[-4000. 0 .152. 15000. 20000.],]

The slow variant returns: [-2000. 152. 11288.001] while the fast variant return [-2000. 0. 11288.001]. The issue comes down to how the values are interpolated on the interval with degenerate probability values.

Acceptance criteria:

  • fast_interp_same_y and slow_interp_same_y produce equivalent outputs

Activity

  1. btrotta-bom commented on Apr 2, 2026

    @btrotta-bom
    Contributor

    In general, interpolation is not well-defined when xp contains duplicate values, e.g. see the warning here: https://numpy.org/devdocs/reference/generated/numpy.interp.html

    A workaround could be to change the code (for both fast and slow methods) to remove duplicate xp values (and corresponding fp values) before interpolating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions