gtrace.beam
¶
gtrace.beam
A module to define GaussianBeam class.
Module Contents¶
Classes¶
This is a class to represent a Gaussian beam. |
Functions¶
|
A function to return the distance between the point on |
|
Caltulate optimal starting point. |
|
A function to return the distance between the point on |
|
Caltulate optimal end point. |
|
A function to return the distance between the point on |
|
Caltulate optimal cross point. |
Attributes¶
-
gtrace.beam.
pi
¶
-
gtrace.beam.
array
¶
-
gtrace.beam.
sqrt
¶
-
gtrace.beam.
__copyright__
= Copyright 2011-2021, Yoichi Aso¶
-
gtrace.beam.
__credits__
= ['Yoichi Aso']¶
-
gtrace.beam.
__license__
= BSD¶
-
gtrace.beam.
__version__
= 0.2.1¶
-
gtrace.beam.
__maintainer__
= Yoichi Aso¶
-
gtrace.beam.
__email__
= yoichi.aso@nao.ac.jp¶
-
gtrace.beam.
__status__
= Beta¶
-
class
gtrace.beam.
GaussianBeam
(q0=1j * 2 * pi / 1064 * nm * 1e-06 / 2, q0x=False, q0y=False, pos=[0.0, 0.0], length=1.0, dirAngle=0.0, dirVect=None, wl=1064 * nm, P=1 * W, n=1.0, name='Beam', layer='main_beam')¶ Bases:
traits.api.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.
-
q
¶ q-parameter of the beam. If the beam is eliptic, q is the q-parameter of the best matching circular mode.
- Type
complex
-
qx
¶ q-parameter of the beam in the x-direction.
- Type
complex
-
qy
¶ q-parameter of the beam in the y-direction.
- Type
complex
-
pos
¶ Position of the beam origin (x, y).
- Type
array
-
dirVect
¶ Propagation direction vector.
- Type
array
-
dirAngle
¶ Propagation direction angle measured from the positive x-axis.
- Type
float
-
length
¶ Length of the beam (used for DXF export)
- Type
float
-
layer
¶ Layer name of the beam when exported to a DXF file.
- Type
str
-
name
¶ Name of the beam
- Type
str
-
wl
¶ Wavelength in vacuum. Not the wavelength in the medium.
- Type
float
-
n
¶ Index of refraction of the medium the beam is passing through.
- Type
float
-
P
¶ Power.
- Type
float
-
wx
¶ Beamwidth in x-direction.
- Type
float
-
wy
¶ Beamwidth in y-direction.
- Type
float
-
optDist
¶ Accumulated optical distance.
- Type
float
-
Gouyx
¶ Accumulated Gouy phase in x-direction.
- Type
float
-
Gouyy
¶ Accumulated Gouy phase in y-direction.
- Type
float
-
Mx
¶ ABCD matrix in x-direction. This is a 2x2 matrix representing the product of ABCD transformations applied to this beam. It defaults to an identity matrix. Whenever a beam experience an ABCD matrix transformation, such as propagation in the space or reflection by a curved mirror, the applied ABCD matrix is multiplied to this matrix, so that we can keep track of what kind of transformations were made during beam propagation.
- Type
array
-
My
¶ ABCD matrix in y-direction. The meaning is the same as Mx.
- Type
array
-
departSurfAngle
¶ The angle formed by x-axis and the normal vector of the surface from which the beam is departing. Default is None. Used by the drawing routine.
- Type
None
-
departSurfInvROC
¶ Inverse of the ROC of the surface from which the beam is departing. The ROC is positive for a concave surface seen from the beam side. Default is None. Used by the drawing routine.
- Type
None
-
incSurfAngle
¶ The angle formed by the x-arm and the normal vector of the surface to which the beam is incident. Default is None. Used by the drawing routine.
- Type
None
-
incSurfInvROC
¶ Inverse of the ROC of the surface to which the beam is incident. The ROC is positive for a concave surface seen from the beam side. Default is None. Used by the drawing routine.
- Type
None
-
stray_order
¶ An integer indicating if this beam is a stray light or not. The default value is 0. Every time a beam is reflected by an AR surface or transmits an HR surface, this couter is increased by 1.
- Type
int
-
name
¶
-
wl
¶
-
P
¶
-
q
¶
-
qx
¶
-
qy
¶
-
qrx
¶
-
qry
¶
-
Gouyx
¶
-
Gouyy
¶
-
wx
¶
-
wy
¶
-
n
¶
-
pos
¶
-
length
¶
-
layer
¶
-
dirVect
¶
-
dirAngle
¶
-
optDist
¶
-
Mx
¶
-
My
¶
-
copy
(self)¶ Make a deep copy.
-
propagate
(self, d)¶ 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.
- Parameters
d (float) – Distance.
-
ABCDTrans
(self, ABCDx, ABCDy=None)¶ Apply ABCD transformation to the beam.
- Parameters
ABCDx (array) – ABCD matrix for x-direction.
ABCDy (array or None, optional.) – ABCD matrix for y-direction. Defaults None. If None, set to ABCDx.
-
rotate
(self, angle, center=False)¶ Rotate the beam around ‘center’. If center is not given, the beam is rotated around self.pos.
- Parameters
angle (float) – Rotation angle in radians.
center (array or boolean.) – Center of rotation. Should be an array of shape(2,). Defaults False.
-
translate
(self, trVect)¶ Translate the beam by the direction and the distance specified by a vector.
- Parameters
trVect (array) – A vector to specify the translation direction and distance. Should be an array of shape(2,)
-
flip
(self, flipDirVect=True)¶ 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.
- Parameters
flipDirVect (boolean, optional) – Flip propagation direction. Defaults True.
-
width
(self, dist)¶ Returns the beam width at a distance dist from the origin of the beam. The width is the radius where the light power becomes 1/e^2.
- Parameters
dist (float) – Distance.
- Returns
The width of the beam in x and y direction.
- Return type
(float, float)
-
R
(self, dist=0.0)¶ Returns the beam ROC at a distance dist from the origin of the beam.
- Parameters
dist (float, optional) – Distance.
- Returns
Beam ROC.
- Return type
(float, float)
-
waist
(self)¶ Return the tuples of waist size and distance
- Returns
{“Waist Size”: (float, float), “Waist Position”: (float, float)}
- Return type
dict
-
draw
(self, cv, sigma=3.0, mode='x', drawWidth=True, fontSize=False, drawPower=False, drawROC=False, drawGouy=False, drawOptDist=False, drawName=False, debug=False)¶ Draw the beam into a DXF object.
- Parameters
cv (gtrace.draw.draw.Canvas) – gtrace canvas.
sigma (float, optional) – The width of the beam drawn is sigma * (1/e^2 radius of the beam). The default is sigma = 3. sigma = 2.7 gives 1ppm diffraction loss. Defaults 3.
mode (str, optional) – ‘avg’, ‘x’, or ‘y’. A beam can have different widths for x- and y- directions. If ‘avg’ is specified, the average of them are drawn. ‘x’ and ‘y’ specifies to show the width of the respective directions. Defaults ‘x’.
fontSize (float, optional) – Size of the font used to show supplemental informations. Defaults False.
drawWidth (boolean, optional) – Whether to draw width or not. Defaults True.
drawPower (boolean, optional) – Whether to show the beam power. Defaults False.
drawROC (boolean, optional) – Whether to show the ROC or not. Defaults False.
drawGouy (boolean, optional) – Whether to show the Gouy phase or not. Defaults False.
drawOptDist (boolean, optional) – Whether to show the accumulated optical distance or not. Defaults False.
drawName (boolean, optional) – Whether draw the name of the beam or not. Defaults False.
debug (boolean, optional) – Debug.
-
drawWidth
(self, cv, sigma, mode)¶ Draw width on canvas.
- Parameters
cv (gtrace.draw.draw.Canvas) – The canvas.
sigma (float) – The width of the beam drawn is sigma * (1/e^2 radius of the beam). The default is sigma = 3. sigma = 2.7 gives 1ppm diffraction loss.
mode (str) – ‘avg’, ‘x’, or ‘y’. A beam can have different widths for x- and y- directions. If ‘avg’ is specified, the average of them are drawn. ‘x’ and ‘y’ specifies to show the width of the respective directions.
-
_dirAngle_changed
(self, old, new)¶
-
_dirVect_changed
(self, old, new)¶
-
_qx_changed
(self, old, new)¶
-
_qy_changed
(self, old, new)¶
-
_qrx_changed
(self, old, new)¶
-
_qry_changed
(self, old, new)¶
-
_n_changed
(self, old, new)¶
-
-
gtrace.beam.
optFunForStartPointR
(phi, Mrot, R, q0, k, sigma, side)¶ 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.
- Parameters
phi (float) – phi
Mrot (array) – Rotational transformation.
R (float) – R
q0 (complex) – Beam parameter.
k (float) – k
sigma (float) – Beam width
side – side
- Returns
Distance between the point on the spherical surface at an angle phi and the beam width at the same z.
- Return type
float
-
gtrace.beam.
optimStartPointR
(theta, R, q0, k, sigma)¶ Caltulate optimal starting point.
- thetafloat
theta
- Rfloat
R
- q0complex
Beam parameter.
- kfloat
k
- sigmafloat
Beam width.
- Returns
Optimal starting point.
- Return type
(float, float)
-
gtrace.beam.
optFunForEndPointR
(phi, Mrot, R, q0, k, sigma, side)¶ 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.
- Parameters
phi (float) – phi
Mrot (array) – Rotational transformation.
R (float) – R
q0 (complex) – Beam parameter.
k (float) – k
sigma (float) – Beam width
side – side
- Returns
Distance between the point on the spherical surface at an angle phi and the beam width at the same z.
- Return type
float
-
gtrace.beam.
optimEndPointR
(theta, R, q0, k, sigma)¶ Caltulate optimal end point.
- thetafloat
theta
- Rfloat
R
- q0complex
Beam parameter.
- kfloat
k
- sigmafloat
Beam width.
- Returns
Optimal end point.
- Return type
(float, float)
-
gtrace.beam.
optFunForFlat
(a, Mrot, q0, k, sigma, side)¶ A function to return the distance between the point on the spherical surface (flat?) at an angle phi and the beam width at the same z.
- Parameters
a (float) – a
Mrot (array) – Rotational transformation.
q0 (complex) – Beam parameter.
k (float) – k
sigma (float) – Beam width
side – side
- Returns
Distance between the point on the spherical surface at an angle phi and the beam width at the same z.
- Return type
float
-
gtrace.beam.
optimCrossPointFlat
(theta, q0, k, sigma)¶ Caltulate optimal cross point.
- thetafloat
theta
- Rfloat
R
- q0complex
Beam parameter.
- kfloat
k
- sigmafloat
Beam width.
- Returns
Optimal end point.
- Return type
(float, float)