Skip to content

Commit

Permalink
Shape docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andykee committed Jan 4, 2024
1 parent 72f8df2 commit aac2efb
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/user/fundamentals/apertures.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. _user.fundamentals.apertures:

*******************
Apertures and masks
*******************

Lentil expects apertures and masks to be described in a discretely sampled
array-like format - most commonly in the form of a NumPy array. Portions of
the array with values greater than one are assued to be transmissive while
portions of the array that are zero are assumed to be blocking.

Aperture or mask shapes can be loaded from a file, created manually, or
constructed using one or more of Lentil's functions that draw common shapes
in an array.

Core shapes
===========
Lentil provides a number of functions for drawing basic shapes in arrays.
Multiple arrays can be combined to create more complicated shapes.

The core shape functions support shifting the center of the shape arbitrarily
relative to the center of the array. The shift is defined in terms of
(row, col).

.. plot:: user/fundamentals/plots/shape_shift.py
:scale: 50


Basic antialiasing is also supported (and is enabled by default):

.. plot:: user/fundamentals/plots/shape_antialias.py
:scale: 50

Circle
------


Rectangle
---------

Hexagon
-------


Hex segmented apertures
=======================


13 changes: 13 additions & 0 deletions docs/user/fundamentals/plots/shape_antialias.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import matplotlib.pyplot as plt
import lentil

fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(4.5, 4.5))
ax[0].imshow(lentil.circle(shape=(64,64), radius=128, shift=(85,-85), antialias=True),
cmap='gray')
ax[0].set_title('antialias = True')

ax[1].imshow(lentil.circle(shape=(64,64), radius=128, shift=(85, -85), antialias=False),
cmap='gray')
ax[1].set_title('antialias = False')

fig.tight_layout()
14 changes: 14 additions & 0 deletions docs/user/fundamentals/plots/shape_shift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import matplotlib.pyplot as plt
import lentil

fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(4.5, 4.5))
ax[0].imshow(lentil.circle(shape=(256,256), radius=32), cmap='gray')
ax[0].plot(128,128, '+', markersize=6, color='#bf616a')
ax[0].set_title('shift = (0, 0)')

ax[1].imshow(lentil.circle(shape=(256,256), radius=32, shift=(-80,50)), cmap='gray')
ax[1].plot(128,128, '+', markersize=6, color='#bf616a')
ax[1].arrow(128, 128, 50, -80, color='#bf616a', linewidth=0.5, head_width=8, length_includes_head=True)
ax[1].set_title('shift = (-80, 50)')

fig.tight_layout()
1 change: 1 addition & 0 deletions docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The User Guide provides documentation for all of Lentil's features and capabilit
:maxdepth: 1

fundamentals/coordinates
fundamentals/apertures
fundamentals/planes
fundamentals/wavefront_error
fundamentals/wavefront
Expand Down

0 comments on commit aac2efb

Please sign in to comment.