femto.trench module#

class Trench(block, delta_floor=0.001, height=0.3, safe_inner_turns=5)#

Bases: object

Class that represents a trench block and provides methods to compute the toolpath of the block.

block: Polygon#

Polygon shape of the trench.

delta_floor: float#

Offset distance between buffered polygons in the trench toolpath.

height: float#

Depth of the trench box.

safe_inner_turns: int#

Number of spiral turns befor zig-zag filling

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

Border of the trench.

It returns the border of the block as a tuple of two numpy arrays, one for the x coordinates and one for the y coordinates.

Returns:

x and y-coordinates arrays of the trench border.

Return type:

tuple(numpy.ndarray, numpy.ndarray)

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

x-coordinates of the trench border.

Returns:

x-coordinates arrays of the trench border.

Return type:

numpy.ndarray

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

y-coordinates of the trench border.

Returns:

y-coordinates arrays of the trench border.

Return type:

numpy.ndarray

property xmin: float#

Minimum x value of the trench boundary.

Returns:

Minimum x value of the block border.

Return type:

float

property ymin: float#

Minimum y value of the trench boundary.

Returns:

Minimum y value of the block border.

Return type:

float

property xmax: float#

Maximum x value of the trench boundary.

Returns:

Maximum x value of the block border.

Return type:

float

property ymax: float#

Maximum y value of the trench boundary.

Returns:

Maximum y value of the block border.

Return type:

float

property center: tuple[float, float]#

Baricenter of the trench block.

Returns:

x and y coordinates of the centroid of the block.

Return type:

tuple(float, float)

property floor_length: float#

Total length of the floor path.

property wall_length: float#

Length of a single layer of the wall path.

property orientation: str#

Orientation of the trench block.

property num_insets: int#

Number of spiral turns.

zigzag_mask()#

Zig-zag mask. The function returns a Shapely geometry (MultiLineString, or more rarely, GeometryCollection) for a simple hatched rectangle. The spacing between the lines is given by self.delta_floor while the rectangle is the minimum rotated rectangle containing the trench block.

The lines of the zig-zag pattern are along the longest dimension of the rectangular envelope of the trench block.

Returns:

Collection of hatch lines (in case a hatch line intersects with the corner of the clipping rectangle, which produces a point along with the usual lines).

Return type:

shapely.MultiLineString | shapely.GeometryCollection

See also

shapely.minimum_rotated_rectangle

oriented rectangular envelope that encloses an input geometry.

zigzag(poly)#

Zig-zag filling pattern. The function zigzag takes a polygon as input, applies a zig-zag filling pattern to it, and returns the coordinates of the resulting zigzag pattern.

Parameters:

poly (geometry.Polygon) – The parameter poly is of type geometry.Polygon. It represents a polygon object that you want to apply the zig-zag filling pattern to.

Returns:

Coordinates array of the zig-zag filling pattern.

Return type:

numpy.ndarray

toolpath()#

Toolpath generator.

The function takes a polygon and computes the filling toolpath. Such path is obtained with two strategy: - First, the outer border is added to the polygon_list. The functions pops polygon objects from this list,

buffers it, and yields the exterior coordinates of the buffered polygon. Before yielding, the new polygon is added to the list as the buffered inset will be computed in the next iteration. If the buffering operation returns polygons composed of different non-touching parts (i.e. MultiPolygon), each part is added to the list as a single Polygon object. If no inset can be computed from the starting polygon, no object is added to the list. The generator terminates when no more buffered polygons can be computed.

  • Second, after a number of insets the center of the trench floor is filled with a zig-zag pattern to avoid harsh acceleration and small displacements. The zig-zag hatching pattern is computed for each polygon in the polygon_list.

Yields:

numpy.ndarray – (x, y) coordinates of each of the buffered polygons.

Return type:

Generator[ndarray[Any, dtype[float32]], None, None]

See also

geometry.Polygon

shapely polygon object.

geometry.Multipolygon

collections of shapely polygon objects.

static buffer_polygon(shape, offset)#

Buffer a polygon.

It takes a polygon and returns a list of polygons that are offset by a given distance.

Parameters:
  • shape (geometry.Polygon) – Shape of the trench block to buffer.

  • offset (float) – The offset to buffer the polygon by [mm].

Returns:

List of buffered polygons. If the buffered polygon is still a Polyon object the list contains just a single polygon. If the buffered polygon is MultiPolygon, the list contais all the single Polygon objects that compose the multipolygon. Finally, if the buffered polygon cannot be computed the list contains just the empty polygon Polygon().

Return type:

list(geometry.Polygon)

Notes

The buffer operation returns a polygonal result. The new polygon is checked for validity using obj.is_valid in the sense of [1].

For a reference, read the buffer operations here

See also

geometry.Polygon.buffer

buffer operations on Polygon objects.

geometry.Polygon

shapely polygon object.

geometry.Multipolygon

collections of shapely polygon objects.

class TrenchColumn(x_center, y_min, y_max, bridge=0.026, length=1, h_box=0.075, nboxz=4, z_off=-0.02, deltaz=0.0015, delta_floor=0.001, safe_inner_turns=5, u=None, speed_wall=4.0, speed_floor=2.0, speed_closed=5.0, speed_pos=2.0, base_folder='', beam_waist=0.004, round_corner=0.01, _trench_list=<factory>)#

Bases: object

Class representing a column of isolation trenches.

x_center: float#

Center of the trench blocks [mm].

y_min: float#

Minimum y coordinates of the trench blocks [mm].

y_max: float#

Maximum y coordinates of the trench blocks [mm].

bridge: float = 0.026#

Separation length between nearby trench blocks [mm].

length: float = 1#

Lenght of the trench along the x axis [mm].

h_box: float = 0.075#

Height of the single trench box [mm].

nboxz: int = 4#

Number of stacked box along the z axis.

z_off: float = -0.02#

Starting offset in z with respect to the sample’s surface [mm].

deltaz: float = 0.0015#

Offset distance between countors paths of the trench wall [mm].

delta_floor: float = 0.001#

Offset distance between buffered polygons in the trench toolpath [mm].

safe_inner_turns: int = 5#

Number of spiral turns befor zig-zag filling

u: list[float] | None = None#

List of U coordinate to change irradiation power automatically [deg].

speed_wall: float = 4.0#

Translation speed of the wall section [mm/s].

speed_floor: float = 2.0#

Translation speed of the floor section [mm/s].

speed_closed: float = 5.0#

Translation speed with closed shutter [mm/s].

speed_pos: float = 2.0#

Positioning speed with closed shutter [mm/s].

base_folder: str = ''#

Location where PGM files are stored in lab PC. If empty, load files with relative path.

beam_waist: float = 0.004#

Diameter of the laser beam-waist [mm].

round_corner: float = 0.01#

Radius of the blocks round corners [mm].

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 adj_bridge: float#

Bridge length adjusted for the laser beam waist.

Returns:

Adjustted bridge size considering the size of the laser focus [mm].

Return type:

float

property n_repeat: int#

Number of laser passes required to cover the vertical height of the trench box.

Returns:

The number of times the border path is repeated in the z direction.

Return type:

int

property fabrication_time: float#

Total fabrication time.

The fabrication time is the sum of the lengths of all the walls and floors of all the trenches, divided by the translation speed.

Returns:

Total fabrication time [s].

Return type:

float

property total_height: float#

Total trench height.

Returns:

Total trench height [um].

Return type:

float

property rect: Polygon#

Area of the trench column.

The rectangular box is centered in x_c along the x axis, while the y-borders are y_min and y_max.

┌─────┐  ► y_max
│     │
│     │
│     │
└─────┘  ► y_min
   ▲
   x_c
Returns:

Rectangular box polygon.

Return type:

geometry.box

dig_from_waveguide(waveguides, remove=None)#

Dig trenches from waveguide input.

The function uses a list of Waveguide objects as a mold to define the trench shapes. It populates self.trech_list with Trench objects. If some of the generated trenches are not needed they can be removed from the list is a remove list of indeces is given as input. Trenches are numbered such that the one with lowest y coordinate has index 0, the one with second-lowest y coordinate has index 1 and so on. If remove is empty or None all the generated trenches are added to the self.trench_list.

Parameters:
  • waveguides (list(Waveguide)) – List of Waveguide objects that will be used as a mold to define trench shapes.

  • remove (list[int], optional) – List of indides of trench to be removed from the TrenchColumn.

Return type:

None

dig_from_array(waveguides, remove=None)#

Dig trenches from array-like input.

The function uses a list of array-like objects as a mold to define the trench shapes. It populates self.trech_list with Trench objects. If some of the generated trenches are not needed they can be removed from the list is a remove list of indeces is given as input. Trenches are numbered such that the one with lowest y coordinate has index 0, the one with second-lowest y coordinate has index 1 and so on. If remove is empty or None all the generated trenches are added to the self.trench_list.

Parameters:
  • waveguides (list(numpy.ndarray)) – List of numpy.ndarray objects that will be used as a mold to define trench shapes.

  • remove (list[int], optional) – List of indides of trench to be removed from the TrenchColumn.

Return type:

None

class UTrenchColumn(x_center, y_min, y_max, bridge=0.026, length=1, h_box=0.075, nboxz=4, z_off=-0.02, deltaz=0.0015, delta_floor=0.001, safe_inner_turns=5, u=None, speed_wall=4.0, speed_floor=2.0, speed_closed=5.0, speed_pos=2.0, base_folder='', beam_waist=0.004, round_corner=0.01, _trench_list=<factory>, n_pillars=0, pillar_width=0.04, trenchbed=<factory>)#

Bases: TrenchColumn

Class representing a column of isolation U-trenches.

n_pillars: int = 0#

number of sustaining pillars

pillar_width: float = 0.04#

width of the pillars

trenchbed: list[Trench]#

List of beds blocks

property adj_pillar_width: float#

Pillar length adjusted for the laser beam waist.

Returns:

Adjustted pillar size considering the size of the laser focus [mm].

Return type:

float

property fabrication_time: float#

Total fabrication time.

The fabrication time is the sum of the lengths of all the walls, floors and bedfloors of all the trenches, divided by the translation speed.

Returns:

Total fabrication time [s].

Return type:

float

trenchbed_shape()#

Trenchbed shape. This method is used to calculate the shape of the plane beneath the column of trenches based on a list of trenches.

The trench bed is defined as a rectangular-ish shape with the top and bottom part with the same shape of the top and bottom trench (respectively) of the column of trenches. This trench bed can be divided into several beds divided by structural pillars of a given x-width. The width and the number of the pillars can be defined by the user when the UTrenchColumn object is created.

This method populated the self.trenchbed attribute of the UTrenchColumn object.

Return type:

None