Surface#
- class optika.surfaces.Surface(name=None, sag=None, material=None, aperture=None, aperture_mechanical=None, rulings=None, is_field_stop=False, is_pupil_stop=False, transformation=None, kwargs_plot=None)[source]#
Bases:
AbstractSurface[SagT,MaterialT,ApertureT,ApertureMechanicalT,RulingsT]Representation of a single optical interface.
Composition of a sag profile, material type, aperture, and ruling specification (all optional).
Examples
Define a spherical mirror, with a rectangular aperture, \(z=50 \; \text{mm}\) from the origin.
Reflect a grid of collimated rays off of this mirror and measure their position at the origin.
import matplotlib.pyplot as plt import astropy.units as u import astropy.visualization import named_arrays as na import optika # define a spherical reflective surface 50 mm from the origin mirror = optika.surfaces.Surface( sag=optika.sags.SphericalSag(radius=-100 * u.mm), material=optika.materials.Mirror(), aperture=optika.apertures.RectangularAperture(30 * u.mm), transformation=na.transformations.Cartesian3dTranslation(z=50 * u.mm), ) # define a detector surface at the origin to capture the reflected rays detector=optika.surfaces.Surface() # define a grid of collimated input rays rays_input = optika.rays.RayVectorArray( position=na.Cartesian3dVectorArray( x=na.linspace(-25, 25, axis="pupil_x", num=5) * u.mm, y=na.linspace(-25, 25, axis="pupil_y", num=5) * u.mm, z=0 * u.mm, ), direction=na.Cartesian3dVectorArray(0, 0, 1), ) # propagate the rays through the mirror and detector surfaces rays_mirror = mirror.propagate_rays(rays_input) rays_detector = detector.propagate_rays(rays_mirror) # stack the 3 sets of rays into a single object # for easier plotting rays = [ rays_input, rays_mirror, rays_detector, ] rays = na.stack(rays, axis="surface") # plot the rays and surface with astropy.visualization.quantity_support(): fig, ax = plt.subplots() ax.set_aspect("equal") components_plot = ("z", "y") na.plt.plot(rays.position, axis="surface", components=components_plot, color="tab:blue"); mirror.plot(ax=ax, components=components_plot, color="black");
Attributes
The region of this surface which allows light to propagate.
The shape of the physical substrate containing this optical surface.
Whether this surface is the field stop of an optical system.
Whether this surface is the pupil stop of an optical system.
If this surface is pupil stop or the field stop, return
True.Additional keyword arguments to pass to the
plot()function.The optical material type of this surface.
The human-readable name of the surface.
The optional ruling profile of this surface.
The sag profile of this surface.
The array shape of this object.
The transformation between system coordinates and this surface.
Methods
__init__([name, sag, material, aperture, ...])plot([ax, transformation, components])Plot the selected components onto the given axes.
propagate_rays(rays)Refract, reflect, and/or diffract the given rays off of this surface
to_dxf(file, unit[, transformation])to_string([prefix])Public-facing version of the
__repr__method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.Inheritance Diagram

- Parameters:
name (None | str)
sag (SagT)
material (MaterialT)
aperture (ApertureT)
aperture_mechanical (ApertureMechanicalT)
rulings (RulingsT)
is_field_stop (bool)
is_pupil_stop (bool)
transformation (None | AbstractTransformation)
kwargs_plot (None | dict)
- plot(ax=None, transformation=None, components=None, **kwargs)#
Plot the selected components onto the given axes.
- Parameters:
ax (None | Axes | ScalarArray[ndarray[tuple[Any, ...], dtype[_ScalarT]]]) – The matplotlib axes to plot onto
transformation (None | AbstractTransformation) – Any extra transformations to apply to the coordinate system before plotting
components (None | tuple[str, ...]) – Which 3d components to plot, helpful if plotting in 2d.
kwargs – Additional keyword arguments that will be passed along to
named_arrays.plt.plot()
- Return type:
- propagate_rays(rays)#
Refract, reflect, and/or diffract the given rays off of this surface
- Parameters:
rays (RayVectorArray) – a set of input rays that will interact with this surface
- Return type:
- to_dxf(file, unit, transformation=None)#
- Parameters:
file (Path)
unit (Unit)
transformation (None | AbstractTransformation)
- to_string(prefix=None)#
Public-facing version of the
__repr__method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.
- aperture: ApertureT = None#
The region of this surface which allows light to propagate.
- aperture_mechanical: ApertureMechanicalT = None#
The shape of the physical substrate containing this optical surface.
- material: MaterialT = None#
The optical material type of this surface.
- rulings: RulingsT = None#
The optional ruling profile of this surface.
- sag: SagT = None#
The sag profile of this surface.
- transformation: None | AbstractTransformation = None#
The transformation between system coordinates and this surface.