alhambra.tilesets
#
Module Contents#
Classes#
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Class representing a tileset, whether abstract or sequence-level. |
Functions#
Attributes#
- class alhambra.tilesets.XgrowGlueOpts[source]#
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- abstract calculate_gses(tileset: TileSet) tuple[list[xgrow.tileset.Bond], list[xgrow.tileset.Glue]] [source]#
- classmethod from_str(glueopts: str) XgrowGlueOpts [source]#
- class alhambra.tilesets.GrowSelfComplementaryGlues[source]#
Bases:
XgrowGlueOpts
Helper class that provides a standard way to create an ABC using inheritance.
- class alhambra.tilesets.GrowPerfectGlues[source]#
Bases:
XgrowGlueOpts
Helper class that provides a standard way to create an ABC using inheritance.
- class alhambra.tilesets.GrowOrthogonalGlues[source]#
Bases:
XgrowGlueOpts
Helper class that provides a standard way to create an ABC using inheritance.
- class alhambra.tilesets.GrowFullGlues[source]#
Bases:
XgrowGlueOpts
Helper class that provides a standard way to create an ABC using inheritance.
- class alhambra.tilesets.TileSet(tiles: Iterable[alhambra.tiles.Tile] = tuple(), glues: Iterable[alhambra.glues.Glue] = tuple(), seeds: Mapping[str | int, alhambra.seeds.Seed] | None = None, *, seed: alhambra.seeds.Seed | None = None, lattices: Mapping[str | int, alhambra.grid.Lattice] | None = None, guards: Mapping[str | int, list[str]] = dict(), params: dict | None = None)[source]#
Bases:
alhambra.classes.Serializable
Class representing a tileset, whether abstract or sequence-level.
- property allglues: alhambra.glues.GlueList[source]#
- property alldomains: alhambra.glues.GlueList[source]#
- seeds: dict[str | int, alhambra.seeds.Seed][source]#
- lattices: dict[str | int, alhambra.grid.Lattice][source]#
- classmethod from_mix(mix: alhambra_mixes.Mix, tilesets_or_lists: TileSet | alhambra.tiles.TileList | Iterable[TileSet | alhambra.tiles.TileList], *, seed: bool | alhambra.seeds.Seed = False, base_conc: alhambra_mixes.ureg.Quantity | str = Q_(100.0, nM)) TileSet [source]#
Given some
TileSet
s, or lists ofTile
s from which to take tiles, generate an TileSet from the mix.
- run_xgrow(to_lattice: bool = True, _include_out: bool = False, glues: XgrowGlueOpts | str | None = None, seed: str | int | alhambra.seeds.Seed | None | Literal[False] = None, seed_offset: tuple[int, int] | None = None, xgrow_seed: tuple[int, int, int | str] | None = None, **kwargs: Any) Any [source]#
Run the tilesystem in Xgrow.
- to_rgrow(glue_handling: XgrowGlueOpts | str | None = None, seed: str | int | alhambra.seeds.Seed | None | Literal[False] = None, seed_offset: tuple[int, int] | None = None, **kwargs)[source]#
- to_rgrow_dict(glue_handling: XgrowGlueOpts | str | None = None, seed: str | int | alhambra.seeds.Seed | None | Literal[False] = None, seed_offset: tuple[int, int] | None = None, **kwargs)[source]#
- to_xgrow(glue_handling: XgrowGlueOpts | str | None = None, seed: str | int | alhambra.seeds.Seed | None | Literal[False] = None, seed_offset: tuple[int, int] | None = None) xgrow.tileset.TileSet [source]#
Convert Alhambra TileSet to an XGrow TileSet
- classmethod from_scadnano(des: scadnano.Design, ret_fails: bool = False) TileSet [source]#
Create TileSet from Scadnano Design.
- to_scadnano(lattice: alhambra.grid.LatticeSupportingScadnano | None = None) scadnano.Design [source]#
Export TileSet (with lattice) as Scadnano Design.
- lattice_tiles(lattice: alhambra.grid.AbstractLattice | int | str | numpy.ndarray, *, x: int | slice | None = None, y: int | slice | None = None, copy: bool = False) list[alhambra.tiles.Tile] [source]#
Return a list of (unique) tiles in a lattice, potentially taking a slice of the lattice.
- Parameters:
lattice (AbstractLattice | int | str) – Lattice or reference to a lattice in the tileset
x (int | slice | None, optional) – index in the lattice, by default None
y (int | slice | None, optional) – index in the lattice, by default None
copy (bool, optional) – return copies if True (useful for creating a new set) or tiles in the set if False (useful for modifying the set), by default False
- create_guards_square(lattice: alhambra.grid.AbstractLattice, square_size: int, init_x: int = 0, init_y: int = 0, skip: Callable[[alhambra.glues.Glue], bool] = _skip_polyT_and_inertname) list[str] [source]#
- create_abstract_diagram(lattice: alhambra.grid.AbstractLattice | str | int | numpy.ndarray | None, filename=None, scale=1, guards: Collection[str] | str | int = tuple(), seed: str | bool | alhambra.seeds.Seed = True, seed_offset: tuple[int, int] = (0, 0), **options)[source]#
Create an SVG layout diagram from a lattice.
This currently uses the abstract diagram bases to create the layout diagrams.
- Parameters:
xgrowarray (ndarray or dict) – Xgrow output. This may be a numpy array of an xgrow state, obtained in some way, or may be the ‘array’ output of xgrow.run.
filename (string) – File name / path of the output file.
- abstract reduce_tiles(preserve=('s22', 'ld'), tries=10, threads=1, returntype='equiv', best=1, key=None, initequiv=None)[source]#
Apply tile reduction algorithm, preserving some set of properties, and using a multiprocessing pool.
- Parameters:
tileset (TileSet) – The system to reduce.
preserve (a tuple or list of strings, optional) – The properties to preserve. Currently supported are ‘s1’ for first order sensitivity, ‘s2’ for second order sensitivity, ‘s22’ for two-by-two sensitivity, ‘ld’ for small lattice defects, and ‘gs’ for glue sense (to avoid spurious hierarchical attachment). Default is currently (‘s22’, ‘ld’).
tries (int, optional) – The number of times to run the algorithm.
threads (int, optional) – The number of threads to use (using multiprocessing).
returntype ('TileSet' or 'equiv' (default 'equiv')) – The type of object to return. If ‘equiv’, returns an array of glue equivalences (or list, if best != 1) that can be applied to the tileset with apply_equiv, or used for further reduction. If ‘TileSet’, return a TileSet with the equiv already applied (or a list, if best != 1).
best (int or None, optional) – The number of systems to return. If 1, the result will be returned directly; if k > 1, a list will be returned of the best k results (per cmp); if k = None, a list of all results will be returned, sorted by cmp. (default 1)
key (function (ts, equiv1, equiv2) -> some number/comparable) – A comparison function for equivs, to sort the results. FIXME: documentation needed. Default (if None) here is to sort by number of glues in the system, regardless of number of tiles.
initequiv (equiv) – If provided, the equivalence array to start from. If None, start from the tileset without any merged glues.
- Returns:
reduced – The reduced system/systems
- Return type:
single TileSet or equiv, or list
- abstract reduce_ends(preserve=['s22', 'ld'], tries=10, threads=1, returntype='equiv', best=1, key=None, initequiv=None)[source]#
Apply end reduction algorithm, preserving some set of properties, and using a multiprocessing pool.
- Parameters:
tileset (TileSet) – The system to reduce.
preserve (a tuple or list of strings, optional) – The properties to preserve. Currently supported are ‘s1’ for first order sensitivity, ‘s2’ for second order sensitivity, ‘s22’ for two-by-two sensitivity, ‘ld’ for small lattice defects, and ‘gs’ for glue sense (to avoid spurious hierarchical attachment). Default is currently (‘s22’, ‘ld’).
tries (int, optional) – The number of times to run the algorithm.
threads (int, optional) – The number of threads to use (using multiprocessing).
returntype ('TileSet' or 'equiv' (default 'equiv')) – The type of object to return. If ‘equiv’, returns an array of glue equivalences (or list, if best != 1) that can be applied to the tileset with apply_equiv, or used for further reduction. If ‘TileSet’, return a TileSet with the equiv already applied (or a list, if best != 1).
best (int or None, optional) – The number of systems to return. If 1, the result will be returned directly; if k > 1, a list will be returned of the best k results (per cmp); if k = None, a list of all results will be returned, sorted by cmp. (default 1)
key (function (ts, equiv1, equiv2) -> some number/comparable) – A comparison function for equivs, to sort the results. FIXME: documentation needed. Default (if None) here is to sort by number of glues in the system, regardless of number of tiles.
initequiv (equiv) – If provided, the equivalence array to start from. If None, start from the tileset without any merged glues.
- Returns:
reduced – The reduced system/systems
- Return type:
single TileSet or equiv, or list
- abstract latticedefects(direction='e', depth=2, pp=True, rotate=False)[source]#
Calculate and show possible small lattice defect configurations.
- abstract apply_equiv(equiv)[source]#
Apply an equivalence array (from, eg, TileSet.reduce_ends or TileSet.reduce_tiles).
- Parameters:
equiv (ndarray) – An equivalence array, for this tileset, generated by reduction functions.
- Returns:
A tileset with the equivalence array, and thus the reduction, applied.
- Return type:
- check_consistent()[source]#
Check the TileSet consistency.
Check a number of properties of the TileSet for consistency. In particular:
Each tile must pass Tile.check_consistent()
TileSet.ends and TileSet.tiles.endlist() must not contain conflicting ends or end sequences.
- If there is a seed:
It must be of an understood type (it must be in seeds.seedtypes)
All adapter locations must be valid.
The seed must pass its check_consistent and check_sequence.