Skip to main content

Helper module

Main usage​

SRTHelper contains the routines that would otherwise be repeated in every script. The helper library is installed into build/libs by the build, and it is imported like the raytracer itself:

# Installed tree, library on PYTHONPATH
import SRTHelper as SRTHelper

# Working directly in the build directory
import build.libs.SRTHelper as SRTHelper

Functions​

FunctionPurpose
create_circular_trajectory_from_rpm(...)Circle from turntable and carrier RPM, time resolution in seconds
create_linear_trajectory_from_speed(...)Straight pass from speed, time resolution in seconds
get_uniformity_of_substrate(s)RMS deviation from a uniform coating
get_manhattan_uniformity_of_substrate(s)Linear deviation from a uniform coating
get_total_intensity_of_substrate(s)Sum over all patches
get_max_intensity_of_substrate(s)Maximum patch intensity
load_mesh_from_file(filename)Triangle list from a GMSH mesh, for custom substrates

The uniformity and intensity functions read the accumulated intensities of a substrate, so they are meant to be called after the raytracer has finished — see Fitting with SciPy for how they are used as goal functions.

Loading custom geometries​

list_of_triangles = SRTHelper.load_mesh_from_file("custom.msh")

s.generate_geometry_from_mesh_triangles(list_of_triangles, invert_normal = False)

Details on the mesh orientation are on the Substrates page. The loader needs the Python package gmsh.

Trajectories from machine parameters​

Trajectories can be defined by more practical parameters than a list of points — the velocity of a carrier or the RPM of a turntable, for example. The helper functions produce the list that t.load_from_list(...) expects.

It is important to set the time resolution as small as the problem needs, but not smaller: the total number of samples grows with it, and the run time with the number of samples. For testing, the number of samples of a generated list can be obtained with len(traj_list). In general, do multiple test runs and either decrease the time resolution until the results stop changing significantly or increase it until they change too much.

Circular trajectory​

# Center of the circle
traj_center = SRT.PhysVector(0.0, 0.0, 100.0)

# Start and final angle in degrees
traj_angle_start = -30.0
traj_angle_final = 30.0

# Radius of the trajectory
traj_radius = 200.0

# Initial orientation of the substrate (here equal to the start angle)
traj_substrate_rotation = traj_angle_start

# RPM rate of the turntable
traj_rpm = 10.0

# RPM rate of the substrate relative to its carrier
traj_substrate_rpm = 0.0

# Time resolution in seconds
traj_time_resolution = 0.1

# Generate the trajectory
traj_list = SRTHelper.create_circular_trajectory_from_rpm(
traj_time_resolution, traj_center, traj_radius, traj_rpm,
traj_angle_start, traj_angle_final, traj_substrate_rpm,
traj_substrate_rotation, add_alignment_rotation = True
)

# Load it into the trajectory
t.load_from_list(traj_list)

Linear trajectory​

A straight pass along the y axis, driven by the speed of the carrier:

# Start and end point of the line
traj_point_start = SRT.PhysVector(0.0, -50.0, 100.0)
traj_point_end = SRT.PhysVector(540.0, 50.0, 100.0)

# Initial rotation of the substrate
traj_substrate_rotation = 0.0

# Speed of the substrate motion per second, in the unit used for all other coordinates
traj_speed = 1.0

# Substrate rotation RPM rate relative to its carrier
traj_substrate_rpm = 0.0

# Time resolution of the trajectory in seconds
traj_time_resolution = 0.5

# Generate the trajectory
traj_list = SRTHelper.create_linear_trajectory_from_speed(
traj_time_resolution, traj_speed, traj_point_start, traj_point_end,
traj_substrate_rpm, traj_substrate_rotation
)

# Load it into the trajectory
t.load_from_list(traj_list)