morphogen.laser.patterns

Laser paths: the patterns of tracks that architecture a sheet.

A LaserPath is a sequence of Track s, polylines (mm) that the beams follow in order, each with its beams (the upper one, and the lower one of a double-sided treatment) and the pause that follows it (the cooling before the next track, at least 30 s between neighbouring tracks in Wang’s experiments). Coordinates are those of the sheet: x along the tensile axis (the rolling direction), y across.

Generators (PATTERNS, make_pattern()), for a band [x0, x1] x [y0, y1] (the tracks overhang the band along x by margin, the specimen being cut afterwards, so that no track starts or stops in it):

straight

count parallel tracks at angle (degrees from x), at spacing (default: the band’s width over count), centred;

corrugated

count tracks y = y_i + A sin(2π x/P + φ_i) (amplitude A, the height of Wang et al., period P), phase the shift between neighbours (0: in phase, 180: mirrored), shape sine or triangle (zigzag);

fourier

the same with the waveform Σ a_k sin(2πkx/P) + b_k cos(2πkx/P) of coefficients [[a1, b1], [a2, b2], ...]: the free shapes of an optimization;

crossed

two families of straight tracks at ±angle (a rhombic or square grid), the second family after the first, at spacing or at its own spacing2 (a rectangular grid: more tracks one way than the other);

honeycomb

the edges of hexagons of side cell, drawn as zigzag rows and the rungs between them;

spiral

an Archimedean spiral r = radius + pitch θ/2π about center (the centre of the band by default), turns turns from the direction angle, counter-clockwise or clockwise: one track (the path of a crack to guide);

polylines

given tracks (lists of points).

Measures: length, time and energy of the path, the smallest radius of curvature (LaserPath.min_radius()) and the smallest gap between distinct tracks (LaserPath.min_gap()); LaserPath.to_gcode() writes it for a machine.

class morphogen.laser.patterns.Track(points: ndarray, beam: Beam, bottom: Beam | None = None, pause: float = 30.0)[source]

Bases: object

A polyline (n x 2, mm) followed by beam (upper face) and bottom (lower face, or None), then pause seconds lasers off.

property length: float
property time: float

Time with the lasers on (s).

property energy: float

Incident energy of both beams (J).

shifted(dx: float = 0.0, dy: float = 0.0) → Track[source]
reversed() → Track[source]
class morphogen.laser.patterns.LaserPath(tracks: list = <factory>)[source]

Bases: object

Tracks in the order of the treatment.

property length: float
property time: float

lasers on, and the pauses between tracks.

Type:

Treatment time (s)

property energy: float
segments()[source]

(points, beam, bottom, pause) of each track, for run().

bounds() → tuple[ndarray, ndarray][source]
clipped_length(lo, hi) → float[source]

Length of the tracks inside the box [lo, hi] (the specimen).

min_radius() → float[source]

Smallest radius of curvature of the tracks (the circumradius of consecutive triplets of points; inf for straight tracks).

min_gap(lo=None, hi=None) → float[source]

Smallest distance between two distinct tracks (within the box [lo, hi] if given): the tracks closer than their width overlap and temper each other.

to_gcode(*, laser_on: str = 'M3', laser_off: str = 'M5') → str[source]

The path as G-code (mm, mm/min): rapid moves to the starts of the tracks, the lasers on (S: the power of the upper beam, W; a comment gives the lower one), linear moves at the speed of the track, the lasers off, a dwell for the pause.

morphogen.laser.patterns.distance_to_polyline(points, polyline) → ndarray[source]

Distance (mm) of points (n x 2) to a polyline (m x 2).

morphogen.laser.patterns.straight(x0, x1, y0, y1, *, count=1, angle=0.0, spacing=None, offset=0.0, margin=5.0, alternate=True, beam, bottom=None, pause=30.0) → LaserPath[source]

Parallel straight tracks (see the module).

morphogen.laser.patterns.corrugated(x0, x1, y0, y1, *, count=1, amplitude=1.0, period=10.0, phase=0.0, shape='sine', spacing=None, offset=0.0, margin=5.0, resolution=24, alternate=True, beam, bottom=None, pause=30.0) → LaserPath[source]

Corrugated tracks (see the module).

morphogen.laser.patterns.fourier(x0, x1, y0, y1, *, count=1, period=10.0, coefficients=((1.0, 0.0),), phase=0.0, spacing=None, offset=0.0, margin=5.0, resolution=32, alternate=True, beam, bottom=None, pause=30.0) → LaserPath[source]

Tracks of a Fourier waveform (see the module).

morphogen.laser.patterns.crossed(x0, x1, y0, y1, *, angle=45.0, spacing=3.0, spacing2=None, offset=0.0, margin=5.0, alternate=True, beam, bottom=None, pause=30.0) → LaserPath[source]

Two families of straight tracks at ±angle, the second at spacing2 if given (see the module).

morphogen.laser.patterns.chain_edges(vertices, edges) → list[ndarray][source]

Polylines that cover the edges of a network once each: from an unused edge, a walk continues along the unused edge that turns the least, both ways, until none is left at its ends (few laser starts and stops).

morphogen.laser.patterns.honeycomb(x0, x1, y0, y1, *, cell=3.0, angle=0.0, offset=0.0, margin=5.0, alternate=True, beam, bottom=None, pause=30.0) → LaserPath[source]

The edges of regular hexagons of side cell, two of their sides along x (turned by angle degrees), chained into continuous tracks (chain_edges()).

morphogen.laser.patterns.spiral(x0, x1, y0, y1, *, center=None, radius=0.0, pitch=3.0, turns=2.0, angle=0.0, clockwise=False, resolution=0.2, margin=5.0, beam, bottom=None, pause=30.0) → LaserPath[source]

An Archimedean spiral track (see the module), its points about resolution mm apart along it.

morphogen.laser.patterns.polylines(tracks, *, beam, bottom=None, pause=30.0) → LaserPath[source]

Tracks given as lists of points (see the module).

morphogen.laser.patterns.PATTERNS = {'corrugated': <function corrugated>, 'crossed': <function crossed>, 'fourier': <function fourier>, 'honeycomb': <function honeycomb>, 'spiral': <function spiral>, 'straight': <function straight>}

Pattern generators of make_pattern().

morphogen.laser.patterns.clip_path(path: LaserPath, lo, hi) → LaserPath[source]

The parts of the tracks inside the box [lo, hi] (a track that leaves and comes back splits into several).

morphogen.laser.patterns.make_pattern(kind: str, band, *, beam, bottom=None, pause=30.0, rotation: float = 0.0, cover: bool = False, **params) → LaserPath[source]

A pattern of PATTERNS (or polylines) over the band (x0, x1, y0, y1) (mm), its tracks followed by beam and bottom. rotation (degrees) turns the pattern about the centre of the band: the specimen is then cut at -rotation from the axes of the pattern (the anisotropy of an architectured sheet, tested at 0°, 45° and 90°); the pattern is drawn on a square that covers the turned band, its families of tracks repeated at their spacing over it (the treated sheet), then clipped to the band and its margin — so is it unturned with cover (the periodic sheet around a cell, periodic).