From b8114b61d153493bdc1e23b6c68f473f14bbc7d7 Mon Sep 17 00:00:00 2001 From: Marshall Perrin Date: Thu, 8 Jun 2023 12:54:30 -0400 Subject: [PATCH 01/12] remove comment text that mentions a deprecated astropy feature [ci skip] --- conftest.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/conftest.py b/conftest.py index 7466c480..ccaa1c55 100644 --- a/conftest.py +++ b/conftest.py @@ -19,7 +19,3 @@ TESTED_VERSIONS['poppy'] = __version__ -## Uncomment the following line to treat all DeprecationWarnings as -## exceptions -# from astropy.tests.helper import enable_deprecations_as_exceptions -# enable_deprecations_as_exceptions() From 0f169125b67a41a8fc5600e6fef260ad8541ef9b Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Mon, 14 Aug 2023 16:24:11 -0400 Subject: [PATCH 02/12] remove sphinx_rtd_theme --- pyproject.toml | 2 +- tox.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ba19ae5d..cbff99b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,9 +26,9 @@ test = [ ] docs = [ "nbsphinx", + "sphinx<7.0", "stsci_rtd_theme", "sphinx-astropy", - "sphinx_rtd_theme", "sphinx-automodapi", "sphinx-issues", "tomli; python_version <\"3.11\"", diff --git a/tox.ini b/tox.ini index fc92d9d2..a2f52fbe 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,6 @@ commands= basepython= python3.10 deps= sphinx - sphinx_rtd_theme stsci_rtd_theme sphinx-automodapi sphinx-issues From 8e2663d460016bba9f6ee63666bd59175f4615d8 Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Wed, 16 Aug 2023 13:19:34 -0400 Subject: [PATCH 03/12] update node version --- .github/workflows/ci_workflows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 97a695a9..1101410c 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -46,12 +46,12 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} From dff1570f658358e0f9857e8c51a94a578d56c4fd Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Wed, 16 Aug 2023 13:33:24 -0400 Subject: [PATCH 04/12] Temporary verbose tox --- .github/workflows/ci_workflows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 1101410c..68e3dcd5 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -65,11 +65,11 @@ jobs: if: ${{ contains(matrix.toxenv,'-latest') }} run: | cp $RUNNER_WORKSPACE/poppy/requirements.txt /tmp/ - tox -e ${{ matrix.toxenv }} + tox -vv -e ${{ matrix.toxenv }} - name: Run tests if: ${{ contains(matrix.toxenv,'-latest') != true }} - run: tox -e ${{ matrix.toxenv }} + run: tox -vv -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} From de013d4f198f47bcc74379245dc4c1d50dab94a7 Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Wed, 16 Aug 2023 16:15:41 -0400 Subject: [PATCH 05/12] Min version scipy version pin --- .github/workflows/ci_workflows.yml | 2 +- tox.ini | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 68e3dcd5..101e0c38 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -69,7 +69,7 @@ jobs: - name: Run tests if: ${{ contains(matrix.toxenv,'-latest') != true }} - run: tox -vv -e ${{ matrix.toxenv }} + run: tox -e ${{ matrix.toxenv }} - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} diff --git a/tox.ini b/tox.ini index a2f52fbe..e56858f2 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,7 @@ deps= syn: synphot legacy: numpy==1.20.0 legacy: astropy==4.3.0 + legacy: scipy==1.10.1 latest: -rrequirements.txt astropydev: git+https://github.com/astropy/astropy numexpr: numexpr>=2.6.0 From 87a63e7a4227d2ff5e062ab57f0a2b32123d3695 Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Thu, 17 Aug 2023 09:44:47 -0400 Subject: [PATCH 06/12] transition 1.j to 1j for failing numexpr parsing --- poppy/poppy_core.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/poppy/poppy_core.py b/poppy/poppy_core.py index 12631b78..41a59a56 100644 --- a/poppy/poppy_core.py +++ b/poppy/poppy_core.py @@ -797,7 +797,7 @@ def interpolator(arr): Bind arguments to scipy's RectBivariateSpline function. For data on a regular 2D grid, RectBivariateSpline is more efficient than interp2d. """ - return scipy.interpolate.RectBivariateSpline(x_in, y_in, arr, + return scipy.interpolate.RectBivariateSpline(x_in, y_in, arr, kx=detector.interp_order, ky=detector.interp_order) # Interpolate real and imaginary parts separately @@ -805,7 +805,7 @@ def interpolator(arr): imag_resampled = interpolator(cropped_wf.imag)(x_out, y_out) new_wf = xp.array(real_resampled + 1j * imag_resampled) else: - # cupyx does not have RectBivariateSpline or interp2d so wavefront resampling + # cupyx does not have RectBivariateSpline or interp2d so wavefront resampling # is implemented with map_coordinates #wf_xmin = pixscale * cropped_wf.shape[0]/2 # Note, carefully handle the offset-by-one to be consistent with @@ -916,7 +916,7 @@ def rotate(self, angle=0.0): # arbitrary free rotation with interpolation rot_real = _scipy.ndimage.rotate(self.wavefront.real, -angle, reshape=False) # negative = CCW rot_imag = _scipy.ndimage.rotate(self.wavefront.imag, -angle, reshape=False) - self.wavefront = rot_real + 1.j * rot_imag + self.wavefront = rot_real + 1j * rot_imag self.history.append('Rotated by {:.2f} degrees, CCW'.format(angle)) @@ -2471,11 +2471,11 @@ def get_transmission(self, wave): def get_opd(self, wave): """ Return the optical path difference, given a wavelength. - - In this base class instance, the wavefront parameter 'wave' is not used, + + In this base class instance, the wavefront parameter 'wave' is not used, and the .opd attribute of the optic is returned directly. Subclasses may change this behavior, for instance to evaluate - optical aberrations on the sampling defined for that wavefront, + optical aberrations on the sampling defined for that wavefront, or to compute the wavelength-dependent aberrations of a refractive optic. Parameters @@ -2519,7 +2519,7 @@ def get_phasor(self, wave): if hasattr(self, '_resampled_scale') and abs( self._resampled_scale - wave.pixelscale) / self._resampled_scale >= float_tolerance: # we already did this same resampling, so just re-use it! - self.phasor = self._resampled_amplitude * xp.exp(1.j * self._resampled_opd * scale) + self.phasor = self._resampled_amplitude * xp.exp(1j * self._resampled_opd * scale) else: # raise NotImplementedError("Need to implement resampling.") zoom = (self.pixelscale / wave.pixelscale).decompose().value @@ -2558,16 +2558,16 @@ def get_phasor(self, wave): _log.debug("trimmed a border of {:d} x {:d} pixels from " "optic to match the wavefront".format(border_x, border_y)) - self.phasor = self._resampled_amplitude * xp.exp(1.j * self._resampled_opd * scale) + self.phasor = self._resampled_amplitude * xp.exp(1j * self._resampled_opd * scale) else: # compute the phasor directly, without any need to rescale. if accel_math._USE_NUMEXPR: trans = self.get_transmission(wave) opd = self.get_opd(wave) - self.phasor = ne.evaluate("trans * exp(1.j * opd * scale)") + self.phasor = ne.evaluate("trans * exp(1j * opd * scale)") else: - self.phasor = self.get_transmission(wave) * xp.exp(1.j * self.get_opd(wave) * scale) + self.phasor = self.get_transmission(wave) * xp.exp(1j * self.get_opd(wave) * scale) # check whether we need to pad or crop the array before returning or not. # note: do not pad the phasor if it's just a scalar! From 9803ac09bb07cf0d8a42ffab3167772cb7851386 Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Thu, 17 Aug 2023 10:08:52 -0400 Subject: [PATCH 07/12] update fresnel with 1j --- poppy/fresnel.py | 56 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/poppy/fresnel.py b/poppy/fresnel.py index 63ce9e8b..a7a0d31d 100644 --- a/poppy/fresnel.py +++ b/poppy/fresnel.py @@ -17,7 +17,7 @@ _log = logging.getLogger('poppy') -__all__ = ['QuadPhase', 'QuadraticLens', 'FresnelWavefront', 'FresnelOpticalSystem', +__all__ = ['QuadPhase', 'QuadraticLens', 'FresnelWavefront', 'FresnelOpticalSystem', 'FixedSamplingImagePlaneElement'] @@ -169,41 +169,41 @@ def __init__(self, class FixedSamplingImagePlaneElement(FITSOpticalElement): ''' - This class allows the definition of focal plane masks using .fits files that will be applied to a + This class allows the definition of focal plane masks using .fits files that will be applied to a wavefront via an FFT/MFT sequence to achieve the correct sampling at the assumed focal plane. - + This element will only function as an intermediate planetype due to pixelscale and display functionality - when propagating to this plane. - Note: if an image planetype were to be used, the wavefront at this plane may have infinite pixelscales, + when propagating to this plane. + Note: if an image planetype were to be used, the wavefront at this plane may have infinite pixelscales, making it impossible to display the wavefront with extents. - The method used to apply this element requires additional information from the user that is not required - for FITSOpticalElements. These additional parameters are listed below. - + The method used to apply this element requires additional information from the user that is not required + for FITSOpticalElements. These additional parameters are listed below. + Parameters not in FITSOpticalElement ---------- - wavelength_c: astropy.quantity - Central wavelength of the user's system, required in order to - convert the pixelscale to units of lambda/D and scale the - pixelscale of the element based on the wavelength being propagated. If this parameter is left as None, + wavelength_c: astropy.quantity + Central wavelength of the user's system, required in order to + convert the pixelscale to units of lambda/D and scale the + pixelscale of the element based on the wavelength being propagated. If this parameter is left as None, the pixel scale can be read from the FITS header keyword PIXELSCL, if that keyword exists in the provided file. entrance_pupil_diam: astropy.quantity - Entrance pupil diameter of the system, required to convert the - pixelscale to units of lambda/D. If this parameter is left as None, the pixel scale can be - read from the FITS header keyword PIXELSCL, if that keyword exists in the provided file. + Entrance pupil diameter of the system, required to convert the + pixelscale to units of lambda/D. If this parameter is left as None, the pixel scale can be + read from the FITS header keyword PIXELSCL, if that keyword exists in the provided file. pixelscale: float - pixelscale value in units of arcsec/pix. If this parameter is left as None, the pixel scale can be + pixelscale value in units of arcsec/pix. If this parameter is left as None, the pixel scale can be read from the FITS header keyword PIXELSCL, if that keyword exists in the provided file. centering: str - What type of centering to use for the MFTs, see MFT documentation + What type of centering to use for the MFTs, see MFT documentation for more information. Default is 'ADJUSTABLE'. - + ''' def __init__(self, name="unnamed FPM element", transmission=None, opd=None, opdunits=None, planetype=PlaneType.intermediate, wavelength_c=None, entrance_pupil_diam=None, pixelscale=None, centering='ADJUSTABLE', **kwargs): - + FITSOpticalElement.__init__(self, name=name, transmission=transmission, opd=opd, opdunits=opdunits, planetype=planetype, **kwargs) @@ -909,7 +909,7 @@ def __imul__(self, optic): return self elif isinstance(optic, FixedSamplingImagePlaneElement): # Special case: if we have an FPM, call the routine for that, - # which will apply an amplitude transmission to the wavefront. + # which will apply an amplitude transmission to the wavefront. self.apply_image_plane_fftmft(optic) return self else: @@ -1045,16 +1045,16 @@ def apply_lens_power(self, optic, ignore_wavefront=False): def apply_image_plane_fftmft(self, optic): """ Apply a focal plane mask using fft and mft methods to highly sample at the focal plane. - + Parameters ---------- optic : FixedSamplingImagePlaneElement """ _log.debug("------ Applying FixedSamplingImagePlaneElement using FFT and MFT sequence ------") - + # readjust pixelscale to wavelength being propagated - fpm_pxscl_lamD = ( optic.pixelscale_lamD * optic.wavelength_c.to(u.meter) / self.wavelength.to(u.meter) ).value + fpm_pxscl_lamD = ( optic.pixelscale_lamD * optic.wavelength_c.to(u.meter) / self.wavelength.to(u.meter) ).value # get the fpm phasor either using numexpr or numpy scale = 2. * np.pi / self.wavelength.to(u.meter).value @@ -1062,14 +1062,14 @@ def apply_image_plane_fftmft(self, optic): _log.debug("Calculating FPM phasor from numexpr.") trans = optic.get_transmission(self) opd = optic.get_opd(self) - fpm_phasor = ne.evaluate("trans * exp(1.j * opd * scale)") + fpm_phasor = ne.evaluate("trans * exp(1j * opd * scale)") else: _log.debug("Calculating FPM phasor with Numpy/CuPy.") - fpm_phasor = optic.get_transmission(self) * xp.exp(1.j * optic.get_opd(self) * scale) - + fpm_phasor = optic.get_transmission(self) * xp.exp(1j * optic.get_opd(self) * scale) + nfpm = fpm_phasor.shape[0] n = self.wavefront.shape[0] - + nfpmlamD = nfpm*fpm_pxscl_lamD*self.oversample mft = poppy.matrixDFT.MatrixFourierTransform(centering=optic.centering) @@ -1081,7 +1081,7 @@ def apply_image_plane_fftmft(self, optic): self.wavefront = mft.inverse(self.wavefront, nfpmlamD, n) # MFT to virtual pupil self.wavefront = accel_math.fft_2d(self.wavefront, forward=True, fftshift=True) # FFT back to focal plane self.wavefront = accel_math._fftshift(self.wavefront) - + _log.debug("------ FixedSamplingImagePlaneElement: " + str(optic.name) + " applied ------") def _resample_wavefront_pixelscale(self, detector): From 47dd5b20b084b27357e6a5d14f733f031268ba1a Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Thu, 17 Aug 2023 10:42:49 -0400 Subject: [PATCH 08/12] update node version for codecov --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 101e0c38..2538ac15 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -73,6 +73,6 @@ jobs: - name: Upload coverage to codecov if: ${{ contains(matrix.toxenv,'-cov') }} - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: file: ./coverage.xml From 0e0a2ad465d91ae4150c06def34f141a726657f0 Mon Sep 17 00:00:00 2001 From: Bradley Sappington Date: Thu, 17 Aug 2023 11:19:49 -0400 Subject: [PATCH 09/12] remove verbose flag from tox call --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 2538ac15..6299407f 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -65,7 +65,7 @@ jobs: if: ${{ contains(matrix.toxenv,'-latest') }} run: | cp $RUNNER_WORKSPACE/poppy/requirements.txt /tmp/ - tox -vv -e ${{ matrix.toxenv }} + tox -e ${{ matrix.toxenv }} - name: Run tests if: ${{ contains(matrix.toxenv,'-latest') != true }} From 9d76ed993d39f2f9bdf3071b1b07d86ffd86e60b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:39:01 +0000 Subject: [PATCH 10/12] build(deps): bump astropy from 5.2.2 to 5.3.2 Bumps [astropy](https://github.com/astropy/astropy) from 5.2.2 to 5.3.2. - [Release notes](https://github.com/astropy/astropy/releases) - [Changelog](https://github.com/astropy/astropy/blob/main/docs/changelog.rst) - [Commits](https://github.com/astropy/astropy/compare/v5.2.2...v5.3.2) --- updated-dependencies: - dependency-name: astropy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4e861df6..4b254a94 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -astropy==5.2.2 +astropy==5.3.2 matplotlib==3.7.1 numpy==1.24.3 scipy==1.10.1 From 28bae2d8900a669a3adc91e6045b435e0fd63955 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:56:31 +0000 Subject: [PATCH 11/12] build(deps): bump matplotlib from 3.7.1 to 3.7.2 Bumps [matplotlib](https://github.com/matplotlib/matplotlib) from 3.7.1 to 3.7.2. - [Release notes](https://github.com/matplotlib/matplotlib/releases) - [Commits](https://github.com/matplotlib/matplotlib/compare/v3.7.1...v3.7.2) --- updated-dependencies: - dependency-name: matplotlib dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4b254a94..265945cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ astropy==5.3.2 -matplotlib==3.7.1 +matplotlib==3.7.2 numpy==1.24.3 scipy==1.10.1 From 39addbdaa0e9caf74cfb50703b5513227736f76b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 20:04:52 +0000 Subject: [PATCH 12/12] build(deps): bump numpy from 1.24.3 to 1.25.2 Bumps [numpy](https://github.com/numpy/numpy) from 1.24.3 to 1.25.2. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.24.3...v1.25.2) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 265945cb..65405d50 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ astropy==5.3.2 matplotlib==3.7.2 -numpy==1.24.3 +numpy==1.25.2 scipy==1.10.1