mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
210 stars 122 forks source link

Remove reference to deprecated numpy.distutils #37498

Closed jclarkeSTFC closed 3 months ago

jclarkeSTFC commented 3 months ago

As of NumPy 1.23.0, numpy.distutils is deprecated. It was used here to check if an argument is a sequence, so I just implemented an equivalent method and deleted the numpy.distutils import.

See here for what NumPy was doing.

Fixes #37421

To test:

Tests should pass, IntegratePeaks1DProfile should still work.


Reviewer

Please comment on the points listed below (full description). Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

Functional Tests

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

sf1919 commented 3 months ago

I think this also solves half the problems in #37277

jclarkeSTFC commented 3 months ago

Code changes look good - nice use of collections.abc.Sequence. The epsilon variable has been replaced because it didn't exist in the code and was a typo. Just wanted to check if this means a test in this area would be useful? Or is this area difficult to test?

Thanks, probably @RichardWaiteSTFC would have the best idea about testing.

robertapplin commented 3 months ago

Also another question, is this epsilon typo in release-next? And if so, is it important to be fixed for the release?

RichardWaiteSTFC commented 3 months ago

Also another question, is this epsilon typo in release-next? And if so, is it important to be fixed for the release?

The typo is in release-next but the bug isn't triggered in the code because the step size passed to calc_hessian is a sequence. It was just that the function might be useful in other places!