Skip to content

Commit

Permalink
Merge branch 'dev/v0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
andykee committed Nov 18, 2023
2 parents 735c822 + 8967dc4 commit 1ef06d2
Show file tree
Hide file tree
Showing 18 changed files with 605 additions and 731 deletions.
20 changes: 0 additions & 20 deletions docs/_img/python/propagate_copy.py

This file was deleted.

4 changes: 2 additions & 2 deletions docs/patterns/radiometry/propagation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ and multiply the source irradiance by the collecting area to get photons/second.
>>> psf = np.zeros((64, 64))
>>> for wl, wt in zip(source.wave, source.value):
... w = lentil.Wavefront(wl*1e-9)
... w *= pupil
... w = w * pupil
... w = w.propagate_image(pixelscale=5e-6, npix=32, oversample=2)
... psf += (w.intensity * (np.pi*(pupil_diameter/2)**2))
>>> plt.imshow(psf, origin='lower')
Expand All @@ -56,7 +56,7 @@ fine features present in the source's spectral response.
>>> psf = np.zeros((64, 64))
>>> for wl, wt in zip(binned_wave, binned_flux):
... w = lentil.Wavefront(wl*1e-9)
... w *= pupil
... w = w * pupil
... w = w.propagate_image(pixelscale=5e-6, npix=32, oversample=2)
... psf += (w.intensity * (np.pi*(pupil_diameter/2)**2))
>>> plt.imshow(psf, origin='lower')
Expand Down
40 changes: 2 additions & 38 deletions docs/user_guide/diffraction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ follows the same basic flow:
>>> w2.focal_length
10
It is also possible to perform the multiplication in-place, reducing the memory footprint
of the propagation:

.. code-block:: pycon
>>> w1 *= pupil
.. note::

Additional details on the plane-wavefront interaction can be found in
Expand Down Expand Up @@ -138,35 +131,6 @@ follows the same basic flow:
are required to model the desired optical system, steps 2 and 3 should be
repeated until the |Wavefront| has been propagated through all of the planes.

Performing propagations in-place vs. on copies
----------------------------------------------
By default, all propagation operations operate on a |Wavefront| in-place. If desired,
a copy can be returned instead by providing the argument ``inplace=False``:

.. code-block:: python
:emphasize-lines: 9
import matplotlib.pyplot as plt
import lentil
pupil = lentil.Pupil(amplitude=lentil.circle((256, 256), 120),
pixelscale=1/240, focal_length=10)
w1 = lentil.Wavefront(650e-9)
w2 = w1 * pupil
w3 = w2.propagate_image(pixelscale=5e-6, npix=64, oversample=5, inplace=False)
plt.subplot(121)
plt.imshow(w2.intensity, origin='lower')
plt.title('w2 intensity')
plt.subplot(122)
plt.imshow(w3.intensity**0.1, origin='lower')
plt.title('w3 intensity')
.. plot:: _img/python/propagate_copy.py
:scale: 50

Broadband (multi-wavelength) propagations
-----------------------------------------
The steps outlined above propagate a single monochromatic |Wavefront| through an
Expand All @@ -190,7 +154,7 @@ different wavelengths and accumulates the resulting image plane intensity:

for wl in wavelengths:
w = lentil.Wavefront(wl)
w *= pupil
w = w * pupil
w.propagate_image(pixelscale=5e-6, npix=64, oversample=5)
img += w.intensity

Expand All @@ -213,7 +177,7 @@ wavefront intensity given by ``npix`` * ``oversample``.
for wl in wavelengths:
w = lentil.Wavefront(wl)
w *= pupil
w = w * pupil
w.propagate_image(pixelscale=5e-6, npix=64, oversample=5)
img = w.insert(img)
Expand Down
15 changes: 0 additions & 15 deletions docs/user_guide/optical_systems.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ the wavefront's complex data array:
\mathbf{W_1} = \mathbf{A} \exp\left(\frac{2\pi j}{\lambda} \mathbf{\theta}\right) \circ \mathbf{W_0}
The plane's :func:`~lentil.Plane.multiply` method also accepts an ``inplace`` argument
that governs whether the multiplication operation is performed on the wavefront in-place
or using a copy:

.. code:: pycon
>>> w1 = plane.multiply(w0, inplace=True)
>>> w1 is w0
True
The in-place multiplication operator can also be used:

.. code:: pycon
>>> w *= plane
.. If the |Plane| :attr:`~lentil.Plane.tilt` attribute is not empty, its contents are appended
.. to the |Wavefront|. See :ref:`user_guide.planes.fit_tilt` and :ref:`user_guide.diffraction.tilt`
Expand Down
9 changes: 9 additions & 0 deletions lentil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
# Government sponsorship acknowledged.
__version__ = '0.7.0'

from lentil.ptype import ptype

none = ptype('none')
pupil = ptype('pupil')
image = ptype('image')
transform = ptype('transform')

from lentil.convolvable import jitter, smear

from lentil import detector
Expand All @@ -24,6 +31,8 @@
Flip
)

from lentil.propagate import propagate_dft

from lentil import radiometry

from lentil import util
Expand Down
Loading

0 comments on commit 1ef06d2

Please sign in to comment.