Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy 2.0 fixes:poly1d and NaN #585

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions poppy/accel_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def benchmark_fft(npix=2048, iterations=20, double_precision=True):
time_fftw = timer.timeit(number=iterations) / iterations
print(" {:.3f} s".format(time_fftw))
else:
time_fftw = np.NaN
time_fftw = np.nan

if poppy.accel_math._NUMEXPR_AVAILABLE:
print("Timing performance with Numexpr + FFTW:")
Expand All @@ -396,7 +396,7 @@ def benchmark_fft(npix=2048, iterations=20, double_precision=True):
time_numexpr = timer.timeit(number=iterations) / iterations
print(" {:.3f} s".format(time_numexpr))
else:
time_numexpr = np.NaN
time_numexpr = np.nan

if poppy.accel_math._MKLFFT_AVAILABLE:
print("Timing performance with Numexpr + MKL:")
Expand All @@ -407,7 +407,7 @@ def benchmark_fft(npix=2048, iterations=20, double_precision=True):
time_mkl = timer.timeit(number=iterations) / iterations
print(" {:.3f} s".format(time_mkl))
else:
time_mkl = np.NaN
time_mkl = np.nan

if poppy.accel_math._OPENCL_AVAILABLE:
print("Timing performance with OpenCL:")
Expand All @@ -416,7 +416,7 @@ def benchmark_fft(npix=2048, iterations=20, double_precision=True):
time_opencl = timer.timeit(number=iterations) / iterations
print(" {:.3f} s".format(time_opencl))
else:
time_opencl = np.NaN
time_opencl = np.nan


poppy.conf.use_mkl, poppy.conf.use_fftw, poppy.conf.use_numexpr, poppy.conf.use_cupy,\
Expand Down
2 changes: 1 addition & 1 deletion poppy/optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
else:
raise NotImplemented("No defined NIRCam wedge BLC mask for that wavelength? ")

sigmas = scipy.poly1d(polyfitcoeffs)(scalefact)
sigmas = numpy.poly1d(polyfitcoeffs)(scalefact)

Check warning on line 569 in poppy/optics.py

View check run for this annotation

Codecov / codecov/patch

poppy/optics.py#L569

Added line #L569 was not covered by tests

sigmar = sigmas * np.abs(y)
sigmar.clip(np.finfo(sigmar.dtype).tiny, out=sigmar) # avoid divide by zero -> NaNs
Expand Down