-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
======================= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters