alhambra.fastreduceD
#
Module Contents#
Classes#
Base class for protocol classes. |
|
Functions#
|
|
|
|
|
Calculate potential tile attachments to input neighborhoods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Apply tile reduction algorithm, preserving some set of properties, and using a multiprocessing pool. |
|
Apply end reduction algorithm, preserving some set of properties, and using a multiprocessing pool. |
Attributes#
- class alhambra.fastreduceD.FTile[source]#
-
- structure: Type[alhambra.tiles.Tile][source]#
- class alhambra.fastreduceD.FTilesArray[source]#
-
- classmethod from_ftiles(ftiles: Iterable[FTile]) FTilesArray [source]#
- class alhambra.fastreduceD.TileWithUse[source]#
Bases:
Protocol
Base class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
- class alhambra.fastreduceD.FGlueList(glues: alhambra.glues.GlueList[alhambra.glues.Glue])[source]#
- class alhambra.fastreduceD.FTileList(tiles: alhambra.tiles.TileList[alhambra.tiles.Tile], gluelist: FGlueList)[source]#
- stiles: FTilesArray[source]#
- htiles: FTilesArray[source]#
- vtiles: FTilesArray[source]#
- alhambra.fastreduceD._ffakedouble_n(tn: int, sta, gluelist: FGlueList, outputonly: bool = True, *, dir4: Literal[True], equiv=None) tuple[list[FTile], list[FTile], list[FTile], list[FTile]] [source]#
- alhambra.fastreduceD._ffakedouble_n(tn: int, sta, gluelist: FGlueList, outputonly: bool = True, *, dir4: Literal[False] = False, equiv=None) tuple[list[FTile], list[FTile]]
- class alhambra.fastreduceD._FastTileSet(tilesystem: alhambra.tilesets.TileSet)[source]#
-
- applyequiv(ts: alhambra.tilesets.TileSet, equiv) alhambra.tilesets.TileSet [source]#
- alhambra.fastreduceD.ptins(fts: _FastTileSet, equiv: Equiv | None = None, tau=2) list[list[numpy.ndarray[Any, numpy.dtype[numpy.int64]]]] [source]#
Calculate potential tile attachments to input neighborhoods
- alhambra.fastreduceD._2go_moveandfill(fts: _FastTileSet, t: int, i: int, allin=True, allout=True, pdir=None, x=0, y=0, old_d=None) TMap [source]#
- alhambra.fastreduceD._2go_findtrialmoves(fts: _FastTileSet, tilei, direction, equiv=None)[source]#
- alhambra.fastreduceD._2go_checkandmove(fts, ct, x, y, i, tmap: TMap, exclude=tuple(), equiv=None)[source]#
- alhambra.fastreduceD.is_2go_nn(fts: _FastTileSet, tn: int, un: int, equiv: numpy.ndarray[Any, numpy.dtype[numpy.int64]], tau: int = 2, tmaps: dict[int, TMap] | None = None, *, retall: Literal[True], also22go: bool = False) tuple[bool, tuple[Any, Any] | None] [source]#
- alhambra.fastreduceD.is_2go_nn(fts: _FastTileSet, tn: int, un: int, equiv: numpy.ndarray[Any, numpy.dtype[numpy.int64]], tau: int = 2, tmaps: dict[int, TMap] | None = None, *, retall: Literal[False] = False, also22go: bool = False) bool
- alhambra.fastreduceD.gen_2go_maps(fts: _FastTileSet) dict[int, TMap] [source]#
- alhambra.fastreduceD.gen_2go_profile(fts: _FastTileSet, equiv=None, tmaps=None, also22go: bool = False)[source]#
- alhambra.fastreduceD.is_2go_equiv(fts: _FastTileSet, equiv: Equiv | None = None, tmaps=None, origsens=None)[source]#
- alhambra.fastreduceD._recfix(fts, equiv, tp, initptins, check2go=False, tmaps=None, orig2go=None, orig22go=None, check22go=False, checkld=False, chain=None, preserveuse=False)[source]#
- alhambra.fastreduceD._tilereduce(fts, equiv=None, check2go=False, initptins=None, check22go=False, checkld=False, preserveuse=False)[source]#
- alhambra.fastreduceD._gluereduce(fts: _FastTileSet, equiv: Equiv | None = None, check2go: bool = False, check22go: bool = False, checkld: bool = False, initptins=None, preserveuse: bool = False)[source]#
- alhambra.fastreduceD.reduce_tiles(tileset, 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
- alhambra.fastreduceD.reduce_ends(tileset, 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