Skip to content

Handle rolling std window<2 without runtime warnings#69

Open
shuofengzhang wants to merge 1 commit intomassive-com:masterfrom
shuofengzhang:fix-rolling-std-window-one
Open

Handle rolling std window<2 without runtime warnings#69
shuofengzhang wants to merge 1 commit intomassive-com:masterfrom
shuofengzhang:fix-rolling-std-window-one

Conversation

@shuofengzhang
Copy link

What changed

  • Added an explicit window < 2 guard in _rolling_std to return an all-NaN result immediately.
  • Expanded the _rolling_std docstring to clarify the sample-std (ddof=1) behavior for undersized windows.
  • Tightened test_window_1_returns_nan to assert the undefined window=1 case returns all NaN values.

Why

  • Sample standard deviation with ddof=1 is undefined for window sizes below 2.
  • The previous implementation still called np.std(..., ddof=1) for window=1, which emitted runtime warnings during tests.
  • Returning early keeps behavior mathematically correct and removes avoidable warning noise.

Testing

  • scripts/clone_and_test.sh massive-com/mcp_massive (583 passed)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant