glass-dev / glass

Generator for Large Scale Structure
https://glass.readthedocs.io
MIT License
32 stars 8 forks source link

Remove legacy random number generation #208

Open paddyroddy opened 1 week ago

paddyroddy commented 1 week ago

Is Your Feature Request Related to a Problem? Please Describe

See explanation here https://docs.astral.sh/ruff/rules/numpy-legacy-random, have verified on the codebase with ruff check --select NPY002 ., there are 12 errors at the moment. These had support dropped from numpy==1.16

Describe the Solution You'd Like

Use syntax like this instead

rng = np.random.default_rng(1337)
rng.normal()

Describe Alternatives You've Considered

No response

Additional Context

No response

ntessore commented 6 days ago

We generally have rng support for all user functions, so these should be "safe" to update in examples and tests only.

Random number generation more widely will be one of the issues to solve for generic array support, so might be good to keep that in mind as well.