Fixed #1175 Migrate tests/test_aamp_motifs.py to npt.assert_allclose - #1181
Merged
seanlaw merged 2 commits intoAug 14, 2026
Merged
Conversation
|
Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1181 |
Contributor
Author
seanlaw
requested changes
Aug 13, 2026
Rename left/right to ref/cmp for consistency, and flip assert_array_equal argument order to match the actual, desired convention.
seanlaw
reviewed
Aug 13, 2026
seanlaw
left a comment
Contributor
There was a problem hiding this comment.
@viknesh-ai Looks good to me. Ready to merge?
Contributor
Author
Yeah It’s Ready to merge! |
22 tasks
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.
Fixed #1175
Continuing the file-by-file split from #1178 — this one covers
tests/test_aamp_motifs.py. Will open the next file's PR once this one merges.assert_almost_equalonly checks a fixed absolute tolerance and NumPy's docs recommendassert_allcloseinstead. Eight call sites in this file, three different wrinkles:left/rightargument order backwards relative to theactual, desiredconvention (right/outis always the stumpy-computed value in this file,leftis either a hand-derived expected value or the naive helper's output) — flipped both.aamp_match/naive_aamp_matchoutput, which mixes a float distance with an int index and so comes backdtype=object— same issue astest_aamp.py, same fix: cast both sides tofloat64before comparing, since the values are always numeric.decimal=values weren't all the same (4,6, and the implicit default of7), so I kept each site's original tolerance rather than flattening everything to1.5e-07— translateddecimal=4/decimal=6toatol=1.5e-04/atol=1.5e-06respectively, and the two unlabeled ones toatol=1.5e-07per the usual convention.Also ran the file across five random seeds (JIT disabled, CUDA simulated, matching
test.sh coverage) sincetest_datain this file draws from unseededrng.RNG— wanted to make sure the tolerances hold up beyond just the one seed I happened to run with.Update: per review, also renamed every
left/rightvariable toref_/cmp_(naive output =ref, stumpy-computed output =cmp), and flipped thenpt.assert_array_equalargument order to match the sameactual, desiredconvention asassert_allclose.To Do List
Standing checklist from @seanlaw for this migration, applies to every file in the split - status below is for
test_aamp_motifs.py:npt.assert_almost_equalwith its equivalentnpt.assert_allclosertol=0fornpt.assert_allclose, simply omit this parameter and value since this is the defaultnpt.assert_allclose(actual, desired)always has the stumpy computed value asactualand the naive computation asdesiredatol=1.5e-07rather thanatol=1.5*10**-071.5*10**-config.STUMPY_TEST_PRECISIONwithconfig.STUMPY_TEST_PRECISION = 1.5e-07(inconfig.py) - tracked as a follow-up, not part of this per-file migrationcmpinstead ofcomp- n/a for this file, it never usedcompnaming to begin withref_and stumpy-computed outputs tocmp_(applies tonpt.assert_array_equaltoo, not justnpt.assert_allclose) - this file originally usedleft/right, all renamedPull Request Checklist
Below is a simple checklist but please do not hesitate to ask for assistance!
black(i.e.,python -m pip install blackorconda install -c conda-forge black)flake8(i.e.,python -m pip install flake8orconda install -c conda-forge flake8)pytest-cov(i.e.,python -m pip install pytest-covorconda install -c conda-forge pytest-cov)black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./in the root stumpy directoryflake8 --extend-exclude=.venv ./in the root stumpy directory./setup.sh dev && ./test.shin the root stumpy directory and ensured that all tests are passing locallyPlease do not commit any code to avoid/circumvent a failing test and, instead, engage in a discussion (below) to determine the best course of action.
Only request a review after the checklist above is fully completed!