Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #236.
Only initialize the ATR seed when the input contains a complete window. Previously, an empty or short input indexed past the end of the output array and raised
IndexError.This retains the existing zero-valued warm-up convention: a series shorter than the window returns zeros on its original index. It does not change the warm-up policy to NaNs, alter the ATR recurrence, or change results once the window is complete.
Tests
fillnasettings, and both class/function APIs.IndexError.python -m unittest test.test_atr_short_input test.unit.volatility: 56 tests passed.requirements-test.txt) on both changed files andgit diff --check: passed.The full
python -m unittest discoverrun completed 136 tests with two unrelated errors inTestTSIIndicator.test_tsiandtest_tsi2: pandas removed thecheck_less_preciseassertion argument. A pristine upstream worktree reproduces the same two errors among its 134 tests. No TSI code or tests were changed.Environment: Python 3.12, pandas 2.3.3, NumPy 1.26.4. All tests use local data.
Upstream CI status
The CircleCI Python 3.6 job fails during Install dependencies, before lint or tests run:
No matching distribution found for numpy==1.21.5. The existing configuration uses Python 3.6 with that NumPy pin. This PR does not modify the CI image or dependency requirements.