Optics¶
Instrumental’s Optics package is useful for exploring and scripting basic gaussian optics using the ABCD matrix approach. The package is split up into three main categories: optical elements, beam tools, and beam plotting tools.
Optical Elements¶
Instrumental’s optical elements are based on simple numerical ABCD matrix representations and include Mirrors, Lenses, Spaces, and Interfaces. Each provides a useful constructor to create them in a way that’s conceptually simple and clear.
-
class
instrumental.optics.optical_elements.
ABCD
(A, B, C, D)¶ A simple ABCD (ray transfer) matrix class.
ABCD objects support mutiplication with scalar numbers and other ABCD objects.
Methods
elems
()Get the matrix elements. -
__init__
(A, B, C, D)¶ Create an ABCD matrix from its elements.
The matrix is a 2x2 of the form:
[A B] [C D]
Parameters: A,B,C,D : Quantity objects
A
andD
are dimensionless.B
has units of [length] (e.g. ‘mm’ or ‘rad/mm’), andC
has units of 1/[length].
-
elems
()¶ Get the matrix elements.
Returns: A, B, C, D : tuple of Quantity objects
The matrix elements
-
-
class
instrumental.optics.optical_elements.
Interface
(n1, n2, R=None, aoi=None, aot=None)¶ An interface between media with different refractive indices
-
__init__
(n1, n2, R=None, aoi=None, aot=None)¶ Parameters: n1 : number
The refractive index of the initial material
n2 : number
The refractive index of the final material
R : Quantity or str, optional
The radius of curvature of the interface’s spherical surface, in units of length. Defaults to
None
, indicating a flat interface.aoi : Quantity or str or number, optional
The angle of incidence of the beam relative to the interface, defined as the angle between the interface’s surface normal and the _incident_ beam’s axis. If not specified but
aot
is given, aot will be used. Otherwise,aoi
is assumed to be 0, indicating normal incidence. A raw number is assumed to be in units of degrees.aot : Quantity or str or number, optional
The angle of transmission of the beam relative to the interface, defined as the angle between the interface’s surface normal and the transmitted beam’s axis. See
aoi
for more details.
-
-
class
instrumental.optics.optical_elements.
Lens
(f)¶ A thin lens
-
__init__
(f)¶ Parameters: f : Quantity or str
The focal length of the lens
-
-
class
instrumental.optics.optical_elements.
Mirror
(R=None, aoi=0)¶ A mirror, possibly curved
-
__init__
(R=None, aoi=0)¶ Parameters: R : Quantity or str, optional
The radius of curvature of the mirror’s spherical surface. Defaults to
None
, indicating a flat mirror.aoi : Quantity or str or number, optional
The angle of incidence of the beam on the mirror, defined as the angle between the mirror’s surface normal and the beam’s axis. Defaults to 0, indicating normal incidence.
-
Beam Tools¶
-
instrumental.optics.beam_tools.
find_cavity_modes
(elems)¶ Find the eigenmodes of an optical cavity.
Parameters: elems : list of OpticalElements
ordered list of the cavity elements
Returns: qt_r, qs_r : complex Quantity objects
1/q for the tangential and sagittal modes, respectively. Has units of 1/[length].
-
instrumental.optics.beam_tools.
get_w0
(q_r, lambda_med)¶ Get waist size w0 of light with in-medium wavelength lambda_med and reciprocal beam parameter q_r
-
instrumental.optics.beam_tools.
get_z0
(q_r)¶ Get z-location z0 of the focus from reciprocal beam parameter q_r
-
instrumental.optics.beam_tools.
get_zR
(q_r)¶ Get Rayleigh range zR from reciprocal beam parameter q_r
Beam Plotting¶
-
instrumental.optics.beam_plotting.
plot_profile
(q_start_t_r, q_start_s_r, lambda0, elems, cyclical=False, names=(), clipping=None, show_axis=False, show_waists=False, zeroat=0, zunits='mm', runits='um')¶ Plot tangential and sagittal beam profiles.
Parameters: q_start_t_r, q_start_s_r : complex Quantity objects
Reciprocal beam parameters for the tangential and sagittal components. They have units of 1/[length].
lambda0 : Quantity
Vacuum wavelength of the beam in units of [length].
elems : list of OpticalElements
Ordered list of optical elements through which the beams pass and are plotted.
Other Parameters: cyclical : bool
Whether
elems
loops back on itself, i.e. it forms a cavity where the last element is immediately before the first element. Used for labelling the elements correctly ifnames
is used.names : list or tuple of str
Strings used to label the non-
Space
elements on the plot. Vertical lines will be used to denote the element’s position.clipping : float
Clipping loss level to plot. Normally, the beam profile plotted is the usual spot size. However, if
clipping
is given, the profile indicates the distance from the beam axis at which knife-edge clipping power losses are equal toclipping
.show_axis : bool
If
show_axis
isTrue
, sets the ylim to include the beam axis, i.e. y=0. Otherwise, y limits are automatically set by matplotlib.show_waists : bool
If
True
, marks beam waists on the plot and labels their size.zeroat : int
The index of the element in
elems
that we should consider as z=0. Useful for looking at distances from some element that’s in the middle of the plot.zunits : str or Quantity or UnitsContainer
Units to use for the z-axis. Must have units of [length]. Defaults to ‘mm’.
runits : str or Quantity or UnitsContainer
Units to use for the radial axis. Must have units of [length]. Defaults to ‘um’.