femto.laserpath module#

class LaserPath(name=None, scan=1, speed=1.0, samplesize=(100, 50), x_init=-2.0, y_init=0.0, z_init=None, shrink_correction_factor=1.0, lsafe=2.0, speed_closed=5, speed_pos=0.5, cmd_rate_max=1200, acc_max=500, end_off_sample=True, _x=<factory>, _y=<factory>, _z=<factory>, _f=<factory>, _s=<factory>)#

Bases: object

Class that computes and stores the coordinates of a laser path.

name: str | None = None#
scan: int = 1#

Number of overlapped scans.

speed: float = 1.0#

Opened shutter translation speed [mm/s].

samplesize: tuple[float, float] = (100, 50)#

Dimensions of the sample (x [mm], y [mm]).

x_init: float = -2.0#

Initial x-coordinate for the laser path [mm].

y_init: float = 0.0#

Initial y-coordinate for the laser path [mm]

z_init: float | None = None#

Initial z-coordinate for the laser path [mm].

shrink_correction_factor: float = 1.0#

Correcting factor for glass shrinking.

lsafe: float = 2.0#

Safe margin length [mm].

speed_closed: float = 5#

Closed shutter translation speed [mm/s].

speed_pos: float = 0.5#

Positioning speed (shutter closed)`[mm/s]`.

cmd_rate_max: float = 1200#

Maximum command rate [cmd/s].

acc_max: float = 500#

Maximum acceleration/deceleration [m/s^2].

end_off_sample: bool = True#

Flag to end laserpath off of the sample. (See x_end).

classmethod from_dict(param)#

Create an instance of the class from a dictionary.

It takes a class and a dictionary, and returns an instance of the class with the dictionary’s keys as the instance’s attributes.

Parameters:
  • param (dict[str, Any]) – Dictionary mapping values to class attributes.

  • dict() – Dictionary mapping values to class attributes.

Return type:

Instance of class

property init_point: tuple[float, float, float]#

Initial point of the trajectory.

Returns:

[x0, y0, z0] coordinates.

Return type:

tuple(float, float, float)

property lvelo: float#

Compute the length needed to reach the translation speed.

The length needed to reach the writing speed is computed as 3 times the length needed to accelerate from 0 to the translation speed.

Returns:

Length needed to accelerate to translation speed [mm].

Return type:

float

property dl: float#

Compute the minimum spatial separation between two points.

The minimum spatial separation between two points is the speed divided by the maximum command rate.

Returns:

The minimum separation between two points [mm]

Return type:

float

property x_end: float | None#

Compute the x coordinate of the laserpth outside the sample, if the sample size is not None.

Returns:

The end of the laser path outside the sample [mm].

Return type:

float, optional

property points: ndarray[Any, dtype[float32]]#

Matrix of the unique points in the trajectory.

The matrix of points is parsed through a unique functions that removes all the subsequent identical points in the set.

See also

femto.helpers.unique_filter

Filter trajectory points to remove subsequent identical points.

Returns:

[X, Y, Z, F, S] points of the laser trajectory.

Return type:

numpy.ndarray

property x: ndarray[Any, dtype[float32]]#

x-coordinate vector as a numpy array.

The subsequent identical points in the vector are removed.

See also

femto.helpers.unique_filter

Filter trajectory points to remove subsequent identical points.

Returns:

The x-coordinates of the points in the laser path

Return type:

numpy.ndarray

property lastx: float | None#

Last x value in the trajectory points matrix, if any.

Returns:

The last value of the x array.

Return type:

float, optional

property y: ndarray[Any, dtype[float32]]#

y-coordinate vector as a numpy array.

The subsequent identical points in the vector are removed.

Returns:

The y-coordinates of the points in the laser path

Return type:

numpy.ndarray

See also

unique_filter

Filter trajectory points to remove subsequent identical points.

property lasty: float | None#

Last y value in the trajectory points matrix, if any.

Returns:

The last value of the y array.

Return type:

float, optional

property z: ndarray[Any, dtype[float32]]#

z-coordinate vector as a numpy array.

The subsequent identical points in the vector are removed.

Returns:

The z-coordinates of the points in the laser path

Return type:

numpy.ndarray

See also

unique_filter

Filter trajectory points to remove subsequent identical points.

property lastz: float | None#

Last z value in the trajectory points matrix, if any.

Returns:

The last value of the z array.

Return type:

float, optional

property lastpt: ndarray[Any, dtype[float32]]#

Last point of the laser path, if any.

Returns:

Final [x, y, z] pointof the laser path.

Return type:

numpy.ndarray

property path: tuple[npt.NDArray[np.float32], npt.NDArray[np.float32]]#

List of x and y-coordinates of the laser path written with open shutter.

Returns:

x, y coordinates arrays.

Return type:

tuple(numpy.ndarray, numpy.ndarray)

See also

path3d

List of x, y and z-coordinates of the laser path written with open shutter.

property path3d: tuple[npt.NDArray[np.float32], npt.NDArray[np.float32], npt.NDArray[np.float32]]#

List of x, y and z-coordinates of the laser path written with open shutter.

It takes the x, y and z, and shutter values s values from the path trajectory and filters out the points written at closed shutter (s = 0).

Returns:

x, y and z coordinates arrays.

Return type:

tuple(numpy.ndarray, numpy.ndarray, numpy.ndarray)

See also

path

List of x and y-coordinates of the laser path written with open shutter.

property length: float#

Length of the laser path trajectory.

Returns:

The length of the path [mm].

Return type:

float

property fabrication_time: float#

Total fabrication time in seconds.

It takes the x, y and z of the laser path and calculates the distance between each point and the next, computes the element-wise divison between that distance and the f values of the path to get the time it takes to travel that distance. Finally, it sums all the contribution to get the total fabrication time.

Returns:

Fabrication time [s].

Return type:

float

property curvature_radius: ndarray[Any, dtype[float32]]#

Point-to-point curvature radius of the trajectory.

The curvature radius is computed as the radius of the circle that best fits the curve at a given point.

Returns:

Array of curvature radii of the trajectory.

Return type:

numpy.ndarray

property cmd_rate: ndarray[Any, dtype[float32]]#

Point-to-point command rate of the laser path.

Returns:

Array of point-to-point command rate values of the trajectory.

Return type:

numpy.ndarray

start(init_pos=None, speed_pos=None)#

Start a laser path.

The function starts the laserpath in the optional initial position given as input. If the initial position is not given, the laser path starts in [self.x_init, self.y_init, self.z_init].

Parameters:
  • init_pos (list[float], optional) – [x, y, z] coordinates of the initial point [mm]. Default value is [self.x_init, self.y_init, self.z_init].

  • speed_pos (float, optional) – Translation speed [mm/s]. Default value is self.speed_pos.

Return type:

None

end()#

Ends a laser path.

The function automatically returns to the initial point of the laser path with a translation speed of self.speed_close.

Return type:

None

add_path(x, y, z, f, s)#

Appends the given arrays to the end of the existing coordinates.

Parameters:
  • x (numpy.ndarray) – Array of x-coordinate values.

  • y (numpy.ndarray) – Array of y-coordinate values.

  • z (numpy.ndarray) – Array of z-coordinate values.

  • f (numpy.ndarray) – Array of translation speed values.

  • s (numpy.ndarray) – Array of shutter state values.

Return type:

None

linear(increment, mode='INC', shutter=1, speed=None)#

Add a linear increment to the current laser path.

Parameters:
  • increment (list[float]) – List of increments [dx, dy, dz] in incremental (INC) mode [mm]. New position [x_f, y_f, `z_f] in absolute (ABS) mode [mm].

  • mode (str) – Mode selector. Default value is INC.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

num_subdivisions(l_curve=0, speed=None)#

Compute the number of points required to work at the maximum command rate.

Parameters:
  • l_curve (float, optional) – Length of the laser path segment [mm]. The default value is 0.0 mm.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Returns:

num – The number of subdivisions.

Return type:

int

export(filename, as_dict=False)#

Export the object as a pickle file.

Parameters:
  • filename (str) – Name of (or path to) the file to be saved.

  • as_dict (bool, optional) – Flag varibale to export the object as dictionary. The default value is False.

Return type:

None