This package provides necessary classes and functions for tracing the propagation of Gaussian beams among mirrors and lenses.
gtrace.beam
A module to define GaussianBeam class.
Bases: traits.has_traits.HasTraits
This is a class to represent a Gaussian beam. A GaussianBeam object has its origin (pos) and a propagation direction (dirVect or dirAngle). A GaussianBeam is characterized by q-parameter(s) at its origin. The beam can be either circular or elliptic. In order to deal with elliptic beams, some parameters are stored in pairs like (q0x, q0y). x and y denote the axes of the cross section of the beam. x-axis is parallel to the paper and the y-axis is perpendicular to the paper.
A beam object can be propagated through a free space or made to interact with an optics.
As a beam propagate through optical system, optical distance and Gouy phase are accumerated.
=== Attributes ===
qx: q-parameter of the beam in the x-direction. [complex float]
qy: q-parameter of the beam in the y-direction. [complex float]
pos: Position of the beam origin. [(2,) float array]
dirVect: Propagation direction vector. [(2,) float array]
dirAngle: Propagation direction angle measured from the positive x-axis. [float]
length: Length of the beam (used for DXF export) [float]
layer: Layer name of the beam when exported to a DXF file.
name: Name of the beam
wl: Wavelength in vacuum. Not the wavelength in the medium. [float]
n: Index of refraction of the medium the beam is passing through. [float]
P: Power [float]
wx: Beamwidth in x-direction [float]
wy: Beamwidth in y-direction [float]
optDist: Accumulated optical distance.
Gouyx: Accumulated Gouy phase in x-direction.
Gouyy: Accumulated Gouy phase in y-direction.
My: ABCD matrix in y-direction. The meaning is the same as Mx.
Apply ABCD transformation to the beam.
ABCDx: ABCD matrix for x-direction
ABCDy: ABCD matrix for y-direction
Draw the beam into a DXF object.
Arguments
cv: draw.Canvas object.
fontSize: Size of the font used to show supplemental informations. [float]
drawWidth: Whether to draw width or not. [Boolean]
drawPower: Whether to show the beam power. [Boolean]
drawROC: Whether to show the ROC or not. [Boolean]
drawGouy: Whether to show the Gouy phase or not. [Boolean]
drawOptDist: Whether to show the accumulated optical distance or not. [Boolean]
drawName: Whether draw the name of the beam or not. [Boolean]
Change the propagation direction of the beam by 180 degrees. This is equivalent to the reflection of the beam by a spherical mirror with the same ROC as the beam.
If optional argument flipDirVect is set to False, the propagation direction of the beam is not changed.
Propagate the beam by a distance d from the current position. self.n is used as the index of refraction. During this process, the optical distance traveled is added to self.optDist. self.Goux and self.Gouyy are also updated to record the Gouy phase change.
Rotate the beam around ‘center’. If center is not given, the beam is rotated around self.pos.
Arguments
angle: Rotation angle in radians.
center: Center for rotation. [(2,) array of float]
A function to return the distance between the point on the spherical surface at an angle phi and the beam width at the same z.
A function to return the distance between the point on the spherical surface at an angle phi and the beam width at the same z.
gtrace.nonsequential
A module to perform non-sequential trace of a beam in an optical system.
Define optical components for gtrace.
Bases: gtrace.optcomp.Optics
Representing a partial reflective mirror.
=== Attributes ===
normVectHR: Normal vector of the HR surface.
normAngleHR: Angle of the HR normal vector.
normVectAR: Normal vector of the HR surface.
normAngleAR: Angle of the HR normal vector.
A function to hit the optics with a beam.
This function attempts to hit the optics with the source beam, beam.
Input parameters:
beam: A GaussianBeam object to be interacted by the optics.
order: An integer to specify how many times the internal reflections are computed.
threshold The power threshold for internal reflection calculation. If the power of an auxiliary beam falls below this threshold, further propagation of this beam will not be performed.
Return values (isHit, beamDict, face)
isHit This is a boolean to answer whether the beam hit the optics or not.
beamDict A dictionary containing resultant beams.
Compute the reflected and deflected beams when an input beam hit the AR surface.
The internal reflections are computed as long as the number of internal reflections are below the order and the power of the reflected beams is over the threshold.
Compute the reflected and deflected beams when an input beam hit the HR surface.
The internal reflections are computed as long as the number of internal reflections are below the order and the power of the reflected beams is over the threshold.
A function to see if a beam hits this optics or not.
Input parameters
beam: A GaussianBeam object to be interacted by the optics.
Returned value
The return value is a dictionary with the following keys: isHit, position, distance, face
isHit: This is a boolean to answer whether the beam hit the optics or not.
position: A numpy array containing the coordinate values of the intersection point between the beam and the optics. If isHit is False, this parameter does not mean anything.
distance The distance between the beam origin and the intersection point.
face: An optional string identifying which face of the optics was hit. For example, face can be either “HR” or “AR” for a mirror. face can also be “side”, meaning that the beam hits a side of the optics, which is not meant to be used, e.g. the side of a mirror. In this case, the beam have reached a dead end.
Bases: traits.has_traits.HasTraits
A general optics class from which other specific optics classes are derived.
=== Attributes === name: Name of the optics. [string] center: Center position of the optics. [(2,) float array] rotationAngle: This angle defines the orientation of the optics.
A function to hit the optics with a beam.
This function attempts to hit the optics with the source beam, beam.
Input parameters:
beam: A GaussianBeam object to be interacted by the optics.
order: An integer to specify how many times the internal reflections are computed.
threshold The power threshold for internal reflection calculation. If the power of an auxiliary beam falls below this threshold, further propagation of this beam will not be performed.
Return values (isHit, beamDict, face)
isHit This is a boolean to answer whether the beam hit the optics or not.
beamDict A dictionary containing resultant beams.
A function to see if a beam hits this optics or not.
Input parameters
beam: A GaussianBeam object to be interacted by the optics.
Returned value
The return value is a dictionary with the following keys: isHit, position, distance, face
isHit: This is a boolean to answer whether the beam hit the optics or not.
position: A numpy array containing the coordinate values of the intersection point between the beam and the optics. If isHit is False, this parameter does not mean anything.
distance The distance between the beam origin and the intersection point.
face: An optional string identifying which face of the optics was hit. For example, face can be either “HR” or “AR” for a mirror. face can also be “side”, meaning that the beam hits a side of the optics, which is not meant to be used, e.g. the side of a mirror. In this case, the beam have reached a dead end.