Skip to content

Fixed #1112 Migrate to New NumPy Random Number Generator (RNG) API#1131

Open
seanlaw wants to merge 6 commits intostumpy-dev:mainfrom
seanlaw:migrate_new_numpy_rng
Open

Fixed #1112 Migrate to New NumPy Random Number Generator (RNG) API#1131
seanlaw wants to merge 6 commits intostumpy-dev:mainfrom
seanlaw:migrate_new_numpy_rng

Conversation

@seanlaw
Copy link
Contributor

@seanlaw seanlaw commented Feb 14, 2026

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Fork, clone, and checkout the newest version of the code
  • Create a new branch
  • Make necessary code changes
  • Install black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Install flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Install pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Run black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./ in the root stumpy directory
  • Run flake8 --extend-exclude=.venv ./ in the root stumpy directory
  • Run ./setup.sh dev && ./test.sh in the root stumpy directory
  • Reference a Github issue (and create one if one doesn't already exist)

@gitnotebooks
Copy link

gitnotebooks bot commented Feb 14, 2026

Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1131

@seanlaw
Copy link
Contributor Author

seanlaw commented Feb 14, 2026

@NimaSarajpoor I've tested the migration on test_core.py as an initial trial run. Would you mind taking a look and providing any feedback before I do the same thing on the other tests?

Copy link
Collaborator

@NimaSarajpoor NimaSarajpoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlaw
I've left just one comment for your consideration.

@seanlaw
Copy link
Contributor Author

seanlaw commented Feb 15, 2026

@NimaSarajpoor If it's okay with you, I'm going to add ~5 files at a time for you to incrementally review (there are 46 test files in total and I'll need to work on tutorials and other docs too).

@seanlaw
Copy link
Contributor Author

seanlaw commented Feb 16, 2026

Things are starting to get tricky. Previously, np.random.seed(seed) would set the seed for the global random number generator. However, with the new approach, we'll need to synchronize things across to naive.py (i.e., pass the RNG state). Extra care must be taken. Otherwise, things will fall out of sync and cause assertions to fail!

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.

2 participants