femto.trench module#

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

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.

floor_length: float#

Length of the floor path.

wall_length: float#

Length of the wall path.

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)

toolpath()#

Toolpath generator.

The function takes a polygon.

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.

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, u=None, speed_wall=4.0, speed_floor=1.0, speed_closed=5.0, speed_pos=0.5, 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].

u: list[float] | None = None#
speed_wall: float = 4.0#

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

speed_floor: float = 1.0#

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

speed_closed: float = 5.0#

Translation speed with closed shutter [mm/s].

speed_pos: float = 0.5#

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 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

static normalize(poly)#

Normalize polygon.

The function standardize the input polygon. It set a given orientation and set a definite starting point for the inner and outer rings of the polygon.

Parameters:

poly (geometry.Polygon) – Input Polygon object.

Returns:

New Polygon object constructed with the new ordered sequence of points.

Return type:

geometry.Polygon

See also

This stackoverflow answer.