astropy / astropy

Astronomy and astrophysics core library
https://www.astropy.org
BSD 3-Clause "New" or "Revised" License
4.41k stars 1.76k forks source link

Replace `np.rollaxis()` with `np.moveaxis()` but it is not drop-in replacement #15721

Open eerovaher opened 10 months ago

eerovaher commented 10 months ago

NumPy documentation recommends using np.moveaxis() instead of np.rollaxis(). Currently astropy uses np.rollaxis() more than np.moveaxis(), but there is no reason we should not follow NumPy's recommendation. The lines of code that call np.rollaxis() can be found with git grep 'rollaxis('. The following sub-packages need to be updated:

Pull requests can replace np.rollaxis() with np.moveaxis() in one or more sub-packages.

TanviPooranmal commented 10 months ago

I would like to work on time.

neutrinoceros commented 10 months ago

@TanviPooranmal by all means, feel free to ! Thank you !

Juan-789 commented 10 months ago

I've addressed the feedback provided in astropy/astropy#15727.

dhomeier commented 10 months ago

Maybe need some recommendations how to correctly translate the functions' signatures, as with a variable input to np.rollaxis(arr, axis, start) the effect of a given start is not always straightforward to infer.

dhomeier commented 10 months ago

Given that in the remaining subpackage to be worked on, modeling, from a quick glance refactoring does not look trivial in at least some cases, I'd rather remove the good-first-issue and package-novice labels now.

pllim commented 9 months ago

We have two PRs now trying to do simple search and replace. I updated the title to explain it is not that easy.

vagish-yadav commented 9 months ago

Hi ! Is this issue still open to work upon ??

dhomeier commented 9 months ago

Hi @vagish-yadav , two subpackages have already been addressed, and some work on modeling has been done, but that one definitely needs further review and debugging. Please note that some of the refactoring for modeling is non-trivial and would best be tackled by someone with a bit of coding experience.

NathanMuniz18 commented 1 week ago

hello guys, can i try to help on this?