PyPO User Manual
Ray Trace Methods

This section contains a list of public PyPO methods which are used for performing ray trace related tasks. More...

Functions

def PyPO.System.System.removeFrame (self, str frameName)
 Remove a ray-trace frame from system. More...
 
def PyPO.System.System.createTubeFrame (self, dict argDict)
 Create a tube of rays from a TubeRTDict. More...
 
def PyPO.System.System.createGRTFrame (self, dict argDict)
 Create a Gaussian beam distribution of rays from a GRTDict. More...
 
list[np.ndarray] PyPO.System.System.calcRayLen (self, *str frames, np.ndarray start=None)
 Calculate total length of a ray-trace beam. More...
 
def PyPO.System.System.runRayTracer (self, dict runRTDict)
 Run a ray-trace propagation from a frame to a surface. More...
 
np.ndarray PyPO.System.System.calcRTcenter (self, str name_frame)
 Calculate the geometric center of a ray-trace frame. More...
 
np.ndarray PyPO.System.System.calcRTtilt (self, str name_frame)
 Calculate the mean direction normal of a ray-trace frame. More...
 
float PyPO.System.System.calcSpotRMS (self, str name_frame)
 Calculate the RMS spot size of a ray-trace frame. More...
 
np.ndarray PyPO.System.System.findRTfocus (self, str name_frame, float f0=None, float tol=1e-12)
 Find the focus of a ray-trace frame. More...
 

Detailed Description

This section contains a list of public PyPO methods which are used for performing ray trace related tasks.

Function Documentation

◆ calcRayLen()

list[np.ndarray] PyPO.System.System.calcRayLen (   self,
*str  frames,
np.ndarray   start = None 
)

Calculate total length of a ray-trace beam.

Takes multiple frames and calculates the distance for each ray between frames. If the "start" parameter is set to a len-3 Numpy array, the ray length will also include the distance between the position of the ray in the first frame and the given starting point. This is useful in case the rays emanate from a single point which is not included as a frame in the internal dictionary.

Parameters
framesFrames between which to calculate total pathlength.
startPoint from which to start the calculation, len-3 Numpy array. If given, also calculates distance between point and the first frame. Defaults to None.
Returns
out List containing the distances between frames. Can be summed over to obtain total distance.

◆ calcRTcenter()

np.ndarray PyPO.System.System.calcRTcenter (   self,
str  name_frame 
)

Calculate the geometric center of a ray-trace frame.

The center is calculated by finding the centroid of the given frame.

Parameters
name_frameName of frame to calculate center of.
Returns
c_f Len-3 Numpy array containing x, y and z co-ordinates of frame center.

◆ calcRTtilt()

np.ndarray PyPO.System.System.calcRTtilt (   self,
str  name_frame 
)

Calculate the mean direction normal of a ray-trace frame.

The mean direction is calculated by taking the mean tilt of every ray in the frame.

Parameters
name_frameName of frame to calculate tilt of.
Returns
t_f Len-3 Numpy array containing x, y and z components of frame tilt direction.

◆ calcSpotRMS()

float PyPO.System.System.calcSpotRMS (   self,
str  name_frame 
)

Calculate the RMS spot size of a ray-trace frame.

The RMS spotsize is calculated by taking the root-mean-square of the positions of the rays in the frame.

Parameters
name_frameName of frame to calculate RMS of.
Returns
rms RMS spot size of frame in mm.

◆ createGRTFrame()

def PyPO.System.System.createGRTFrame (   self,
dict  argDict 
)

Create a Gaussian beam distribution of rays from a GRTDict.

The Gaussian frame will be placed in the internal frame dictionary. The frame is generated by rejection-sampling a Gaussian distribution in position and direction on an xy-grid. Position and orientation trackers for the frame are initialised to the origin and z-axis, respectively.

Parameters
argDictA GRTDict, filled. If not filled properly, will raise an exception.
See also
GRTDict

◆ createTubeFrame()

def PyPO.System.System.createTubeFrame (   self,
dict  argDict 
)

Create a tube of rays from a TubeRTDict.

The tube of rays will be placed in the internal frame dictionary. Position and orientation trackers for the frame are initialised to the origin and z-axis, respectively.

Parameters
argDictA TubeRTDict, filled. If not filled properly, will raise an exception.
See also
TubeRTDict

◆ findRTfocus()

np.ndarray PyPO.System.System.findRTfocus (   self,
str  name_frame,
float   f0 = None,
float   tol = 1e-12 
)

Find the focus of a ray-trace frame.

Adds a new plane to the System, perpendicular to the mean ray-trace tilt of the input frame. The new plane is called focal_plane_<name_frame> and stored in the internal system dictionary. After completion, the new plane is centered at the ray-trace focus. The focus frame is stored as focus_<name_frame> in the internal frames dictionary.

Parameters
name_frameName of the input frame.
f0Initial try for focal distance.
verboseAllow verbose System logging.
Returns
out The focus co-ordinate.

◆ removeFrame()

def PyPO.System.System.removeFrame (   self,
str  frameName 
)

Remove a ray-trace frame from system.

This method takes the name of an internally stored frame object and removes it from the internal dictionary.

Parameters
frameNameName of frame to be removed.

◆ runRayTracer()

def PyPO.System.System.runRayTracer (   self,
dict  runRTDict 
)

Run a ray-trace propagation from a frame to a surface.

The resulting frame is placed in the internal frames dictionary.

Parameters
runRTDictA runRTDict object specifying the ray-trace.