pyoptools.raytrace.ray.ray module

Ray class definition module

class pyoptools.raytrace.ray.ray.Ray

Bases: object

Class to define a ray

ARGUMENTS

pos Tuple (x,y,z) containing the origin of the Ray
dir Tuple (x,y,z) containing the direction vector of the Ray
intensity Floating point number representing the Intensity of the Ray. Warning: Check how can a physically correct definition can be made
wavelength Wavelength (in vacuum) of the ray in micrometers (.58929 by default)
n Refraction index of the point originating the ray. If the value is None, the ray was emitted from the media and its Refraction index is taken (not from inside a component)
label String used to follow the rays through the system.
draw_color Color used to render this ray. If None, the wavelength will be used to determine the color. Otherwise, can be any valid matplotlib color identifier.
parent Ray where this ray comes from (used to follow ray trajectory).
childs List of rays originated by the interaction of this ray with an optical surface.
add_child()

Add childs to the current ray, and create the appropriate links

cr
Ray to include in the child list
static almost_equal()

Test if two rays are equal up to desired precision.

ARGUMENTS

other Ray other ray to be compared against.
decimal int, optional, Desired precision, default is 7.
RETURN VALUE
bool True if two rays are equal to the desired precision. i.e.
if abs(self - other) < 1.5 * 10**(-decimal) for attributes pos, dir, wavelength and n.
ch_coord_sys()

Transform the coordinate system of the Ray

Parameters no Tuple (X,Y,Z) containing the coordinates of the origin of the new coordinate system in the old coordinate system ae Tuple (RX,RY,RZ) containing the rotation angles to be applied to the old coordinate system. The rotations are applied RZ first, then RY and last RX

Note this has to be checked

ch_coord_sys_inv()

Transform the coordinate system of the Ray

Parameters

no
Tuple (X,Y,Z) containing the coordinates of the origin of the old coordinate system in the new coordinate system
ae
Tuple (RX,RY,RZ) containing the rotation angles to be applied to the old coordinate system. The rotations are applied RZ first, then RY and last RX
childs
Transform also the coordinate system of the childs. By default (False) don’t do it.

The rotation is made first, and then the translation is made. Note, this has to be checked

ch_coord_sys_inv_f()

Transform the coordinate system of the Ray

Fast version

Parameters

no
Tuple (X,Y,Z) containing the coordinates of the origin of the old coordinate system in the new coordinate system
ae
Tuple (RX,RY,RZ) containing the rotation angles to be applied to the old coordinate system. The rotations are applied RZ first, then RY and last RX
childs
Transform also the coordinate system of the childs. By default (False) don’t do it.

The rotation is made first, and then the translation is made. Note, this has to be checked

childs
copy()

Return a copy ray leaving the parent=None, and childs=[], and order=0

dir
draw_color
get_final_rays()

Find the final rays of the raytrace

inc_zeros
If inc_zeros == True, all the child rays are included. If set to false, the rays with intensity==0 are not included
intensity
label
n
optical_path()

Return the optical path of the beam propagation from the origin of the origin ray, to the end of this ray (intersection with a surface)

optical_path_parent()

Return the optical path from the origin of the origin ray to the end of this ray parent (this ray origin)

order
orig_surf
parent
pop
pos
reverse()

Return a copy ray leaving the parent=None, and childs=[], and order=0, and inverting the ray direction.

wavelength