Skip to content

Commit

Permalink
Merge pull request #490 from spacetelescope/develop
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
shanosborne authored Jan 28, 2022
2 parents 374f13b + bd13c76 commit c193301
Show file tree
Hide file tree
Showing 44 changed files with 125 additions and 111 deletions.
4 changes: 2 additions & 2 deletions docs/_themes/theme_webbpsf/static/bootstrap-astropy.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt, pre, code, tt {
background-color: #f8f8f8;
}

/* override box for links & other sphinx-specifc stuff */
/* override box for links & other sphinx-specific stuff */
tt.xref, a tt, tt.descname, tt.descclassname {
padding: 0 1px 0 1px;
border: none;
Expand Down Expand Up @@ -485,7 +485,7 @@ a.headerlink {
a.headerlink:hover {
background-color: #0069d6;
color: white;
text-docoration: none;
text-decoration: none;
}


Expand Down
4 changes: 2 additions & 2 deletions docs/_themes/theme_webbpsf/static/bootstrap-webbpsf.css
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt, pre, code, tt {
background-color: #f8f8f8;
}

/* override box for links & other sphinx-specifc stuff */
/* override box for links & other sphinx-specific stuff */
tt.xref, a tt, tt.descname, tt.descclassname {
padding: 0 1px 0 1px;
border: none;
Expand Down Expand Up @@ -488,7 +488,7 @@ a.headerlink {
a.headerlink:hover {
background-color: #0069d6;
color: white;
text-docoration: none;
text-decoration: none;
}


Expand Down
2 changes: 1 addition & 1 deletion docs/_themes/theme_webbpsf/static/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This script makes the Sphinx sidebar collapsible.
*
* .sphinxsidebar contains .sphinxsidebarwrapper. This script adds
* in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
* in .sphinxsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
* used to collapse and expand the sidebar.
*
* When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
Expand Down
2 changes: 1 addition & 1 deletion docs/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The Team
-----------------

POPPY is developed primarily by a team of astronomers at the `Space Telescope
Science Insitute <http://www.stsci.edu/>`_, but is open to contributions from
Science Institute <http://www.stsci.edu/>`_, but is open to contributions from
scientists and software developers around the world. Development takes place
on Github at http://github.com/spacetelescope/poppy. See that page for the most up-to-date
list of contributors.
Expand Down
18 changes: 9 additions & 9 deletions docs/coronagraphs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Efficient Lyot coronagraph propagation
=============================================


Poppy has extensive functionality to faciliate the modeling of coronagraph point spread functions. In addition to the general summary of those capabilities here, see the examples in the notebooks subdirectory:
Poppy has extensive functionality to facilitate the modeling of coronagraph point spread functions. In addition to the general summary of those capabilities here, see the examples in the notebooks subdirectory:
`POPPY Examples <https://github.com/spacetelescope/poppy/blob/stable/notebooks/POPPY%20Examples.ipynb>`_
and
`MatrixFTCoronagraph_demo <https://github.com/spacetelescope/poppy/blob/stable/notebooks/MatrixFTCoronagraph_demo.ipynb>`_.
Expand All @@ -20,11 +20,11 @@ By default, an optical system defined in Poppy uses the Fast Fourier Transform (
:alt: Schematics of two Lyot coronagraph design variants
:align: right

The upper design in the figure represents the classical Lyot coronagraph and its widely implemented, optimized descendent, the `apodized pupil Lyot coronagraph (APLC) <http://dx.doi.org/10.1051/0004-6361:20021573>`_. In this case an intermediate focal plane (labeled B) is occulted by a round, opaque mask. By applying the principle of electromagnetic field superposition, combined with knowledge of how FFT complexity scales with array size, `Soummer et al. (2007) <http://dx.doi.org/10.1364/OE.15.015935>`_ showed that the number of operations needed to compute the PSF is greatly reduced by replacing the FFT with discrete Fourier transfoms, implemented in a vectorized fashion and spatially restricted to the *occulted* region of the intermediate focal plane. This is the now widely-used **semi-analytical** computational method for numerically modeling Lyot coronagraphs.
The upper design in the figure represents the classical Lyot coronagraph and its widely implemented, optimized descendent, the `apodized pupil Lyot coronagraph (APLC) <http://dx.doi.org/10.1051/0004-6361:20021573>`_. In this case an intermediate focal plane (labeled B) is occulted by a round, opaque mask. By applying the principle of electromagnetic field superposition, combined with knowledge of how FFT complexity scales with array size, `Soummer et al. (2007) <http://dx.doi.org/10.1364/OE.15.015935>`_ showed that the number of operations needed to compute the PSF is greatly reduced by replacing the FFT with discrete Fourier transforms, implemented in a vectorized fashion and spatially restricted to the *occulted* region of the intermediate focal plane. This is the now widely-used **semi-analytical** computational method for numerically modeling Lyot coronagraphs.

The lower design in the above figure shows a slightly different Lyot coronagraph design case. Here the focal plane mask (FPM) is a diaphragm that restricts the outer edge of the transmitted field. `Zimmerman et al. (2016) <http://dx.doi.org/10.1117/1.JATIS.2.1.011012>`_ showed how this design variant can solve the same starlight cancellation problem, in particular for the baseline design of WFIRST. With this FPM geometry, the superposition simplification of `Soummer et al. (2007) <http://dx.doi.org/10.1364/OE.15.015935>`_ is not valid. However, again the execution time is greatly reduced by using discrete, vectorized Fourier transforms, now spatially restricted to the *transmitted* region of the intermediate focal plane.

In Poppy, two subclasses of OpticalSystem exploit the computational methods described above: SemiAnalyticCoronagraph and MatrixFTCoronagraph. Let's see how to make use of these subclasses to speed up Lyot corongraph PSF calculations.
In Poppy, two subclasses of OpticalSystem exploit the computational methods described above: SemiAnalyticCoronagraph and MatrixFTCoronagraph. Let's see how to make use of these subclasses to speed up Lyot coronagraph PSF calculations.

Lyot coronagraph using the SemiAnalytic subclass
---------------------------------------------------
Expand Down Expand Up @@ -108,13 +108,13 @@ Again we will compare the execution time with the FFT case.::
# Re-cast as MFT coronagraph with annular diaphragm FPM
matrixFTcoron_annFPM_osys = poppy.MatrixFTCoronagraph( fftcoron_annFPM_osys, occulter_box=diaphragm.uninverted_optic.radius_inner )
t0_fft = time.time()
annFPM_fft_psf, annFPM_fft_interm = fftcoron_annFPM_osys.calc_psf(wavelen, display_intermediates=True,\
annFPM_fft_psf, annFPM_fft_interim = fftcoron_annFPM_osys.calc_psf(wavelen, display_intermediates=True,\
return_intermediates=True)
t1_fft = time.time()
plt.figure()
t0_mft = time.time()
annFPM_mft_psf, annFPM_mft_interm = matrixFTcoron_annFPM_osys.calc_psf(wavelen, display_intermediates=True,\
annFPM_mft_psf, annFPM_mft_interim = matrixFTcoron_annFPM_osys.calc_psf(wavelen, display_intermediates=True,\
return_intermediates=True)
t1_mft = time.time()

Expand Down Expand Up @@ -142,10 +142,10 @@ Print some of the propagation parameters::

lamoD_asec = wavelen/fftcoron_annFPM_osys.planes[0].pupil_diam * 180/np.pi * 3600
print("System diffraction resolution element scale (lambda/D) in arcsec: %.3f" % lamoD_asec)
print("Array width in first focal plane, FFT: %d" % annFPM_fft_interm[1].amplitude.shape[0])
print("Array width in first focal plane, MatrixFT: %d" % annFPM_mft_interm[1].amplitude.shape[0])
print("Array width in Lyot plane, FFT: %d" % annFPM_fft_interm[2].amplitude.shape[0])
print("Array width in Lyot plane, MatrixFT: %d" % annFPM_mft_interm[2].amplitude.shape[0])
print("Array width in first focal plane, FFT: %d" % annFPM_fft_interim[1].amplitude.shape[0])
print("Array width in first focal plane, MatrixFT: %d" % annFPM_mft_interim[1].amplitude.shape[0])
print("Array width in Lyot plane, FFT: %d" % annFPM_fft_interim[2].amplitude.shape[0])
print("Array width in Lyot plane, MatrixFT: %d" % annFPM_mft_interim[2].amplitude.shape[0])

System diffraction resolution element scale (lambda/D) in arcsec: 0.103
Array width in first focal plane, FFT: 8192
Expand Down
4 changes: 2 additions & 2 deletions docs/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Example skeleton code::

class myCustomOptic(poppy.AnalyticOpticalElement):
def __init__(self, *args, **kwargs):
""" If your optic has adjustible parameters, then save them as attributes here """
""" If your optic has adjustable parameters, then save them as attributes here """
super().__init__(**kwargs)

def get_opd(self,wave):
Expand All @@ -51,7 +51,7 @@ Example skeleton code::


Note the use of the `self.get_coordinates()` helper function, which returns `y` and
`x` arrays giving the coordinates as appopriate for the sampling of the supplied
`x` arrays giving the coordinates as appropriate for the sampling of the supplied
`wave` object (by default in units of meters for most optics such as pupil planes,
in arcseconds for image plane optics). You can use these coordinates to
calculate the transmission and path delay appropriate for your optic. If
Expand Down
2 changes: 1 addition & 1 deletion docs/fft_optimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Caching of plans means that irunning the same script a second time is much faste
-----------------------------------------------------------------------------------
Immediately after executing the above, I ran the same script again. Now the planning times all become essentially negligible.

Oddly, the exection time for the largest array gets longer. I suspect this has something to do with memory or system load. ::
Oddly, the execution time for the largest array gets longer. I suspect this has something to do with memory or system load. ::

For arrays of size 1024x1024
Building input circular aperture
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ improvements if you are spending substantial time running calculations. See
* `psutil <https://pypi.python.org/pypi/psutil>`__ enables slightly better
automatic selection of numbers of processes for multiprocess calculations.
* `pyFFTW <https://pypi.python.org/pypi/pyFFTW>`__. The FFTW library can speed
up the FFTs used in multi-plane optical simulations such as coronagraphiy or
up the FFTs used in multi-plane optical simulations such as coronagraphy or
slit spectroscopy. Since direct imaging simulations use a discrete matrix FFT
instead, direct imaging simulation speed is unchanged. pyFFTW is recommended
if you expect to perform many coronagraphic calculations, particularly for
Expand Down
2 changes: 1 addition & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sampling becomes wavelength dependent. To avoid these constraints, for
transforms onto the final `~poppy.Detector` plane, instead a Matrix Fourier Transform
(MFT) algorithm is used (See `Soummer et al. 2007 Optics Express <http://adsabs.harvard.edu/abs/2007OExpr..1515935S>`_). This allows
computation of the PSF directly on the desired detector pixel scale or an
arbitrarily finely subsampled version therof. For equivalent array sizes *N*,
arbitrarily finely subsampled version thereof. For equivalent array sizes *N*,
the MFT is slower than the FFT(*O(N^3)*), but in practice the ability to freely
choose a more appropriate *N* (and to avoid the need for post-FFT interpolation
onto a common pixel scale) more than makes up for this and the MFT is faster.
Expand Down
2 changes: 1 addition & 1 deletion docs/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The configuration options to enable multiprocessing live under :py:obj:`poppy.co
>>> poppy.conf.use_multiprocessing = True
>>> poppy.conf.use_fftw = False

One caveat with running multiple processes is that the memory demands can become substantial for large oversampling factors. For instance, a 1024-pixel-across pupil with ``oversampling=4`` results in arrays that are 256 MB each. Several such arrays are needed in memory per calculation, with peak memory utilization reaching ~ 1 GB per process for ``oversampling=4`` and over 4 GB per process for ``oversamping=8``.
One caveat with running multiple processes is that the memory demands can become substantial for large oversampling factors. For instance, a 1024-pixel-across pupil with ``oversampling=4`` results in arrays that are 256 MB each. Several such arrays are needed in memory per calculation, with peak memory utilization reaching ~ 1 GB per process for ``oversampling=4`` and over 4 GB per process for ``oversampling=8``.

Thus, if running on a 16-core computer, ensure at least 32 GB of RAM are available before using one process per core. If you are constrained by the amount of RAM available, you may experience better performance using fewer processes than the number of processor cores in your computer.

Expand Down
27 changes: 21 additions & 6 deletions docs/relnotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ Release Notes

For a list of contributors, see :ref:`about`.

1.0.2
-----

.. _rel1.0.2:

*2022 January 28*

This is a minor release, mostly to accomodate upstream changes in recent numpy and astropy versions.

**Software Infrastructure Updates and Internals:**
* Update code due to changes in Astropy API (:pr:`482` by :user:`WilliamJamieson`)
* Update one test for numerical robustness with numpy's use of Intel avx512 instructions on some platforms (:pr:`487` by :user:`shanosborne`)
* Fix spelling mistakes across code base (:pr:`479` by :user:`jsoref`)
* Updates to recommended (not minimum) dependency versions to track latest numpy, matplotlib, etc (various PRs by :user:`shanosborne`)

1.0.1
-----

Expand Down Expand Up @@ -125,7 +140,7 @@ This is a minor release primarily for updates in packaging infrastructure, plus
* `calc_datacube` function now allows `nwavelengths>100`, removing a prior limitation of this function. (:pr:`351` by :user:`ojustino`)
* `radial_profile` function can now be applied to datacubes, with a `slice` keyword to specify which slice of the cube should be examined. (:pr:`352` by :user:`mperrin`)
* Improved the Zernike basis expansion function for segmented apertures, `opd_expand_segments`, to allow optional masking out of pixels at the segment borders. This can be useful in some circumstances for avoiding edge effects from partially illuminated pixels or interpolation artifacts when evaluating Zernike or hexike coefficients per segment. (:pr:`353` by :user:`mperrin`)
* Allows `Segmented_PTT_Basis` to pass through keyword arguments to parent class `MultiHexagonAperture`, in particular for selecting/excluding particular segments from the apreture geometry. (:pr:`357` by :user:`kjbrooks`)
* Allows `Segmented_PTT_Basis` to pass through keyword arguments to parent class `MultiHexagonAperture`, in particular for selecting/excluding particular segments from the aperture geometry. (:pr:`357` by :user:`kjbrooks`)
* Fix a log string formatting bug encountered in MFT propagation under certain conditions (:pr:`360` by :user:`mperrin`)

**Software Infrastructure Updates and Internals:**
Expand Down Expand Up @@ -389,7 +404,7 @@ improved upon in a future release.

* Fix ConfigParser import (see `astropy/package-template#172 <https://github.com/astropy/package-template/pull/172>`_)
* Fixes to formatting of ``astropy.units.Quantity`` values (`#171 <https://github.com/spacetelescope/poppy/issues/171>`_, `#174 <https://github.com/mperrin/poppy/pull/174>`_, `#179 <https://github.com/mperrin/poppy/pull/174>`_; @josephoenix, @neilzim)
* Fixes to ``fftw_save_wisdom`` and ``fftw_load_wisdom`` (`#177 <https://github.com/spacetelescope/poppy/issues/177>`_, `#178 <https://github.com/mperrin/poppy/pull/178>`_; @mmecthley)
* Fixes to ``fftw_save_wisdom`` and ``fftw_load_wisdom`` (`#177 <https://github.com/spacetelescope/poppy/issues/177>`_, `#178 <https://github.com/mperrin/poppy/pull/178>`_; @mmechtley)
* Add ``calc_datacube`` method to ``poppy.Instrument`` (`#182 <https://github.com/spacetelescope/poppy/issues/182>`_; @mperrin)
* Test for Apple Accelerate more narrowly (`#176 <https://github.com/spacetelescope/poppy/issues/176>`_; @mperrin)
* ``Wavefront.display()`` correctly handles ``vmin`` and ``vmax`` args (`#183 <https://github.com/spacetelescope/poppy/pull/183>`_; @neilzim)
Expand Down Expand Up @@ -420,7 +435,7 @@ some lingering bugs. As always, please let us know of any issues encountered via
(`#145 <https://github.com/spacetelescope/poppy/issues/145>`_, `#165 <https://github.com/mperrin/poppy/pull/165>`_; @mperrin, douglase)
* The ``getPhasor`` function for all OpticalElements has been refactored to split it into 3
functions: ``get_transmission`` (for electric field amplitude transmission), ``get_opd``
(for the optical path difference affectig the phase), and ``get_phasor`` (which combines transmission
(for the optical path difference affecting the phase), and ``get_phasor`` (which combines transmission
and OPD into the complex phasor). This division simplifies and makes more flexible the subclassing
of optics, since in many cases (such as aperture stops) one only cares about setting either the
transmission or the OPD. Again, there are back compatibility hooks to allow existing code calling
Expand All @@ -439,7 +454,7 @@ some lingering bugs. As always, please let us know of any issues encountered via
* Update many function names for `PEP8 style guide compliance <https://www.python.org/dev/peps/pep-0008/>`_.
For instance `calc_psf` replaces `calcPSF`. This was done with back compatible aliases to ensure
that existing code continues to run with no changes required at this time, but *at some
future point* (but not soon!) the older names will go away, so users are encouranged to migrate to the new names.
future point* (but not soon!) the older names will go away, so users are encouraged to migrate to the new names.
(@mperrin, josephoenix)

And some smaller enhancements and fixes:
Expand Down Expand Up @@ -659,7 +674,7 @@ Released April 7, 2014
* Added support for pyFFTW in addition to PyFFTW3.
* pyFFTW will auto save wisdom to disk for more rapid execution on subsequent invocations
* InverseTransmission of an AnalyticElement is now allowed inside a CompoundAnalyticOptic
* Added SecondaryObscuration optic to conveniently model an opaque secondary mirror and adjustible support spiders.
* Added SecondaryObscuration optic to conveniently model an opaque secondary mirror and adjustable support spiders.
* Added RectangleAperture. Added rotation keywords for RectangleAperture and SquareAperture.
* Added AnalyticOpticalElement.sample() function to sample analytic functions onto a user defined grid. Refactored
the display() and toFITS() functions. Improved functionality of display for CompoundAnalyticOptics.
Expand All @@ -669,7 +684,7 @@ Released April 7, 2014
0.2.8
-----

* First release as a standalone package (previously was integrated as part of webbpsf). See the release notes for WebbPSF for prior verions.
* First release as a standalone package (previously was integrated as part of webbpsf). See the release notes for WebbPSF for prior versions.
* switched package building to use `setuptools` instead of `distutils`/`stsci_distutils_hack`
* new `Instrument` class in poppy provides much of the functionality previously in JWInstrument, to make it
easier to model generic non-JWST instruments using this code.
Loading

0 comments on commit c193301

Please sign in to comment.