Skip to content

nan_to_num in process.regression leaves inf as 1.8e308 #122

Open

Description

@celefthe

ridge_regression_fast calls np.nan_to_num(deltaf_series, nan=0.0) (regression.py:75), which maps NaN to 0
but leaves the default posinf/neginf handling in place, so ±inf becomes ±1.8e308 rather than 0. That value
overflows in the matmuls below it, giving inf coefficients.

∆F/F produces inf from the same zero-baseline division that produces its NaNs: (F - F0) / F0 with F0 == 0
and F != 0.

_pixel_ridge_regression (regression.py:221) has the same call.

Suggested fix

Pass posinf=0.0, neginf=0.0 at both sites.

Activity

  1. added
    bugSomething isn't working
    processingWhat we do with the delta Fs
    on Sep 10, 2026
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

    bugSomething isn't workingprocessingWhat we do with the delta Fs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions