gtrace.optcomp
¶
Define optical components for gtrace.
Module Contents¶
Classes¶
A general optics class from which other specific |
|
Representing a partial reflective mirror. |
|
Representing a partial reflective cylindrical mirror. Note that both HR and AR surfaces are treated as cylindrical if you specify non-zero ROC for them. The curve directions of the two surfaces must be the same. |
Attributes¶
-
gtrace.optcomp.
pi
¶
-
gtrace.optcomp.
array
¶
-
gtrace.optcomp.
sqrt
¶
-
gtrace.optcomp.
__copyright__
= Copyright 2011-2021, Yoichi Aso¶
-
gtrace.optcomp.
__credits__
= ['Yoichi Aso']¶
-
gtrace.optcomp.
__license__
= BSD¶
-
gtrace.optcomp.
__version__
= 0.2.1¶
-
gtrace.optcomp.
__maintainer__
= Yoichi Aso¶
-
gtrace.optcomp.
__email__
= yoichi.aso@nao.ac.jp¶
-
gtrace.optcomp.
__status__
= Beta¶
-
class
gtrace.optcomp.
Optics
¶ Bases:
traits.api.HasTraits
A general optics class from which other specific optics classes are derived.
-
name
¶ Name of the optics.
- Type
str
-
center
¶ Center position of the optics. array of shape(2,).
- Type
array
-
rotationAngle
¶ This angle defines the orientation of the optics.
- Type
float
-
name
¶
-
center
¶
-
rotationAngle
¶
-
isHit
(beam)¶ A function to see if a beam hits this optics or not.
- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
- Returns
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.- Return type
Dict
-
hit
(beam, order=0, threshold=0.0)¶ A function to hit the optics with a beam.
This function attempts to hit the optics with the source beam,
beam
.- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
order (int, optional) – An integer to specify how many times the internal reflections are computed. Defaults 0.
threshold (float, optional) – 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. Defaults 0.0.
- Returns
(isHit, beamDict, face)
isHit
This is a boolean to answer whether the beam hit the optics or not.beamDict
A dictionary containing resultant beams.face
:An optional string identifying which face of the optics was hit. For a mirror,
face
is any of “HR”, “AR” or “side”.
- Return type
{boolean, dict, str}
-
_isHitSurface_
(self, beam, surface_center, normal_vector, surface_size=1.0, inv_ROC=0.0)¶ Determine if a beam hit a surface
- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
- Returns
ans – A dictionary with the following keys: “isHit”: A boolean value whether the beam hit the surface or not. “Intersection Point”: numpy array of the coordinates of the intersection point. “distance”: Distance between the origin of the beam and the intersection point. “localNormVect”: A numpy array representing the normal vector of the surface
at the intersection point.
”localNormAngle”: The angle of the localNormVect.
- Return type
dict
-
-
class
gtrace.optcomp.
Mirror
(HRcenter=[0.0, 0.0], normAngleHR=0.0, normVectHR=None, diameter=25.0 * cm, thickness=15.0 * cm, wedgeAngle=0.25 * pi / 180.0, inv_ROC_HR=1.0 / 7000.0, inv_ROC_AR=0.0, Refl_HR=0.99, Trans_HR=0.01, Refl_AR=0.01, Trans_AR=0.99, n=1.45, name='Mirror', HRtransmissive=False, term_on_HR=False)¶ Bases:
Optics
Representing a partial reflective mirror.
-
curve_direction
¶ Either ‘h’ or ‘v’. If it is ‘h’ the mirror is curved in horizontal plane. If ‘v’, it is vertical.
- Type
str
-
HRcenter
¶ The position of the center of the arc of the HR surface. shape(2,).
- Type
array
-
HRcenterC
¶ The position of the center of the chord of the HR surface. shape(2,).
- Type
array
-
normVectHR
¶ Normal vector of the HR surface. shape(2,)
- Type
array
-
normAngleHR
¶ Angle of the HR normal vector. In radians.
- Type
float
-
ARcenter
¶ The position of the center of the AR surface. shape(2,)
- Type
array
-
normVectAR
¶ Normal vector of the HR surface. shape(2,)
- Type
array
-
normAngleAR
¶ Angle of the HR normal vector. In radians.
- Type
float
-
HRtransmissive
¶ A boolean value defaults to False. If True, this mirror is supposed to transmit beams on the HR surface. Therefore, for the first encounter of a beam on the HR surface of this mirror will not increase the stray_order. This flag should be set to True for beam splitters and input test masses.
- Type
boolean
-
term_on_HR
¶ If this is True, a beam with stray_order <= self.term_on_HR_order will be terminated when it hits on HR. This is to avoid the inifinite loop of non-sequencial trace by forming a cavity.
- Type
boolean
-
term_on_HR_order
¶ Integer to specify the upper limit of the stray order used to judge whether to terminate the non sequential trace or not on HR reflection.
- Type
int
-
HRcenter
¶
-
HRcenterC
¶
-
sagHR
¶
-
normVectHR
¶
-
normAngleHR
¶
-
ARcenter
¶
-
ARcenterC
¶
-
sagAR
¶
-
normVectAR
¶
-
normAngleAR
¶
-
diameter
¶
-
ARdiameter
¶
-
thickness
¶
-
wedgeAngle
¶
-
n
¶
-
inv_ROC_HR
¶
-
inv_ROC_AR
¶
-
Refl_HR
¶
-
Trans_HR
¶
-
Refl_AR
¶
-
Trans_AR
¶
-
copy
(self)¶
-
get_side_info
(self)¶ Return information on the sides of the mirror. Returned value is a list of two tuples like [(center1, normVect1, length1), (center2, normVect2, length2)] Each tuple corresponds to a side. center1 is the coordinates of the center of the side line. normVect1 is the normal vector of the side line. length1 is the length of the side line.
- Returns
- Return type
[(float, float, float), (float, float, float)]
-
rotate
(self, angle, center=False)¶ Rotate the mirror. If center is not specified, the center of rotation is HRcenter. If center is given (as a vector), the center of rotation is center. center is a position vector in the global coordinates.
- Parameters
angle (float) – Angle of rotation.
center (array or boolean, optional) – Center of rotation, or False.
-
translate
(self, trVect)¶
-
draw
(self, cv, drawName=False)¶ Draw itself
-
isHit
(self, beam)¶ A function to see if a beam hits this optics or not.
- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
- Returns
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.- Return type
Dict
-
hit
(self, beam, order=0, threshold=0.0, face=False)¶ A function to hit the optics with a beam.
This function attempts to hit the optics with the source beam,
beam
.- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
order (int, optional) – An integer to specify how many times the internal reflections are computed. Defaults 0.
threshold (float, optional) – 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. Defaults 0.0.
- Returns
(isHit, beamDict, face)
isHit
This is a boolean to answer whether the beam hit the optics or not.beamDict
A dictionary containing resultant beams.face
:An optional string identifying which face of the optics was hit. For a mirror,
face
is any of “HR”, “AR” or “side”.
- Return type
{boolean, dict, str}
-
hitFromHR
(self, beam, order=0, threshold=0.0, verbose=False)¶ 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.- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
order (int, optional) – An integer to specify how many times the internal reflections are computed. Defaults 0.
threshold (float, optional) – 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. Defaults 0.0.
verbose (boolean, optional) – Print useful information.
- Returns
beams – Dictionary of reflected and deflected beams.
- Return type
dict
-
hitFromAR
(self, beam, order=0, threshold=0.0, verbose=False)¶ 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.- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
order (int, optional) – An integer to specify how many times the internal reflections are computed. Defaults 0.
threshold (float, optional) – 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. Defaults 0.0.
verbose (boolean, optional) – Print useful information.
- Returns
beams – Dictionary of reflected and deflected beams.
- Return type
dict
-
_normAngleHR_changed
(self, old, new)¶
-
_normVectHR_changed
(self, old, new)¶
-
_HRcenterC_changed
(self, old, new)¶
-
_HRcenter_changed
(self, old, new)¶
-
_center_changed
(self, old, new)¶
-
_wedgeAngle_changed
(self, old, new)¶
-
_inv_ROC_HR_changed
(self, old, new)¶
-
_inv_ROC_AR_changed
(self, old, new)¶
-
-
class
gtrace.optcomp.
CyMirror
(HRcenter=[0.0, 0.0], normAngleHR=0.0, normVectHR=None, diameter=25.0 * cm, thickness=15.0 * cm, wedgeAngle=0.25 * pi / 180.0, inv_ROC_HR=1.0 / 7000.0, inv_ROC_AR=0.0, Refl_HR=0.99, Trans_HR=0.01, Refl_AR=0.01, Trans_AR=0.99, n=1.45, name='Mirror', HRtransmissive=False, term_on_HR=False, curve_direction='h')¶ Bases:
Mirror
Representing a partial reflective cylindrical mirror. Note that both HR and AR surfaces are treated as cylindrical if you specify non-zero ROC for them. The curve directions of the two surfaces must be the same.
-
curve_direction
¶ Either ‘h’ or ‘v’. If it is ‘h’ the mirror is curved in horizontal plane. If ‘v’, it is vertical.
- Type
str
-
HRcenter
¶ The position of the center of the arc of the HR surface. shape(2,).
- Type
array
-
HRcenterC
¶ The position of the center of the chord of the HR surface. shape(2,).
- Type
array
-
normVectHR
¶ Normal vector of the HR surface. shape(2,)
- Type
array
-
normAngleHR
¶ Angle of the HR normal vector. In radians.
- Type
float
-
ARcenter
¶ The position of the center of the AR surface. shape(2,)
- Type
array
-
normVectAR
¶ Normal vector of the HR surface. shape(2,)
- Type
array
-
normAngleAR
¶ Angle of the HR normal vector. In radians.
- Type
float
-
HRtransmissive
¶ A boolean value defaults to False. If True, this mirror is supposed to transmit beams on the HR surface. Therefore, for the first encounter of a beam on the HR surface of this mirror will not increase the stray_order. This flag should be set to True for beam splitters and input test masses.
- Type
boolean
-
term_on_HR
¶ If this is True, a beam with stray_order <= self.term_on_HR_order will be terminated when it hits on HR. This is to avoid the inifinite loop of non-sequencial trace by forming a cavity.
- Type
boolean
-
term_on_HR_order
¶ Integer to specify the upper limit of the stray order used to judge whether to terminate the non sequential trace or not on HR reflection.
- Type
int
-
copy
(self)¶
-
get_side_info
(self)¶ Return information on the sides of the mirror. Returned value is a list of two tuples like [(center1, normVect1, length1), (center2, normVect2, length2)] Each tuple corresponds to a side. center1 is the coordinates of the center of the side line. normVect1 is the normal vector of the side line. length1 is the length of the side line.
- Returns
- Return type
[(float, float, float), (float, float, float)]
-
isHit
(self, beam)¶ A function to see if a beam hits this optics or not.
- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
- Returns
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.- Return type
Dict
-
draw
(self, cv, drawName=False)¶ Draw itself
-
hitFromHR
(self, beam, order=0, threshold=0.0, verbose=False)¶ 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.- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
order (int, optional) – An integer to specify how many times the internal reflections are computed. Defaults 0.
threshold (float, optional) – 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. Defaults 0.0.
verbose (boolean, optional) – Print useful information.
- Returns
beams – Dictionary of reflected and deflected beams.
- Return type
dict
-
hitFromAR
(self, beam, order=0, threshold=0.0, verbose=False)¶ 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.- Parameters
beam (gtrace.beam.GaussianBeam) – A GaussianBeam object to be interacted by the optics.
order (int, optional) – An integer to specify how many times the internal reflections are computed. Defaults 0.
threshold (float, optional) – 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. Defaults 0.0.
verbose (boolean, optional) – Print useful information.
- Returns
beams – Dictionary of reflected and deflected beams.
- Return type
dict
-