femto.trench module#
- class Trench(block, delta_floor=0.001)#
Bases:
objectClass 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.
- 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 singlePolygonobject. 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.Polygonshapely polygon object.
geometry.Multipolygoncollections 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
Polyonobject the list contains just a single polygon. If the buffered polygon isMultiPolygon, the list contais all the singlePolygonobjects that compose the multipolygon. Finally, if the buffered polygon cannot be computed the list contains just the empty polygonPolygon().- Return type
list(geometry.Polygon)
Notes
The buffer operation returns a polygonal result. The new polygon is checked for validity using
obj.is_validin the sense of 1.For a reference, read the buffer operations here
- 1
John R. Herring, Ed., “OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture,” Oct. 2006
See also
geometry.Polygon.bufferbuffer operations on
Polygonobjects.geometry.Polygonshapely polygon object.
geometry.Multipolygoncollections 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=4, speed_closed=5, speed_pos=0.5, base_folder='', beam_waist=0.004, round_corner=0.01)#
Bases:
objectClass 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: float = 4#
Translation speed [mm/s].
- speed_closed: float = 5#
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].
- 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 rect: Polygon#
Area of the trench column.
The rectangular box is centered in
x_calong the x axis, while the y-borders arey_minandy_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
Waveguideobjects as a mold to define the trench shapes. It populates self.trech_list withTrenchobjects. If some of the generated trenches are not needed they can be removed from the list is aremovelist 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. Ifremoveis empty orNoneall the generated trenches are added to the self.trench_list.- Parameters
waveguides (list(Waveguide)) – List of
Waveguideobjects 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
Trenchobjects. If some of the generated trenches are not needed they can be removed from the list is aremovelist 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. Ifremoveis empty orNoneall the generated trenches are added to the self.trench_list.- Parameters
waveguides (list(numpy.ndarray)) – List of
numpy.ndarrayobjects 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
Polygonobject.- Returns
New
Polygonobject constructed with the new ordered sequence of points.- Return type
geometry.Polygon
See also
This stackoverflow answer.