Physical Aperture Demo
[1]:
import matplotlib.pyplot as plt
from optiland import physical_apertures
On file apertures:
The file should contain two columns representing the x and y coordinates, respectively. It supports various file formats (e.g. CSV, TXT) by allowing you to specify a delimiter and the number of header lines to skip via skip_header. Comments can be added to the file by starting a line with "//".
[2]:
a1 = physical_apertures.RadialAperture(r_max=10, r_min=3)
a2 = physical_apertures.RectangularAperture(x_min=-12, x_max=7, y_min=-5, y_max=10)
a3 = physical_apertures.EllipticalAperture(a=10, b=5)
a4 = physical_apertures.OffsetRadialAperture(r_max=8, r_min=0, offset_x=5, offset_y=-3)
a5 = physical_apertures.PolygonAperture(x=[-10, 0, 10, 15], y=[-10, 10, 5, -15])
a6 = physical_apertures.FileAperture("example_file.txt")
a7 = a1 | a2 # Union of a1 and a2, a1 + a2 also works
a8 = a1 & a2 # Intersection of a1 and a2
a9 = a1 - a2 # Difference of a1 and a2
apertures = [a1, a2, a3, a4, a5, a6, a7, a8, a9]
fig, ax = plt.subplots(3, 3, figsize=(12, 12))
ax = ax.flatten()
for i, a in enumerate(apertures):
a.view(ax=ax[i])
ax[i].set_title(f"{a.__class__.__name__}")
plt.tight_layout()
plt.show()