alhambra.fastreduce#

Module Contents#

Classes#

FGlueList

FTileList

_FastTileSet

Functions#

_fdg(dir, gs1, gs2)

_ffakedouble_n(tn, sta, gluelist[, outputonly, dir4, ...])

_ffakesingle(ftile, gluelist)

_ft_to_fta(ftiles)

ptins(fts[, equiv, tau])

Calculate potential tile attachments to input neighborhoods

is_2go_single_nn(fts, tn, un, equiv[, tau, in2go, ...])

gen_2go_single_ins(fts[, tau])

gen_2go_profile(fts[, equiv, ins2go, also22go])

is_2go_equiv(fts[, equiv, ins2go, origsens])

is_22go_equiv(fts[, equiv, ins2go, orig22go])

fta_to_ft(stiles, un[, sel])

isatamequiv(fts, equiv[, initptins])

tilemerge(fts, equiv, t1, t2[, preserveuse])

_findpotentialtilemerges(fts, equiv)

_findpotentialgluemerges(fts, equiv)

_recfix(fts, equiv, tp, initptins[, check2go, ins2go, ...])

_tilereduce(fts[, equiv, check2go, initptins, ...])

_gluereduce(fts[, equiv, check2go, check22go, ...])

_single_reduce_tiles(p)

_single_reduce_ends(p)

reduce_tiles(tileset[, preserve, tries, threads, ...])

Apply tile reduction algorithm, preserving some set of properties, and using a multiprocessing pool.

reduce_ends(tileset[, preserve, tries, threads, ...])

Apply end reduction algorithm, preserving some set of properties, and using a multiprocessing pool.

Attributes#

FTile

FTilesArray

TAU

uN

uI

uO

uB

uP

U_UNUSED

U_INPUT

U_OUTPUT

RSEL

FTI

HSEL

VSEL

alhambra.fastreduce.FTile[source]#
alhambra.fastreduce.FTilesArray[source]#
alhambra.fastreduce.TAU = 2[source]#
alhambra.fastreduce.uN = 0[source]#
alhambra.fastreduce.uI = 1[source]#
alhambra.fastreduce.uO = 2[source]#
alhambra.fastreduce.uB = 3[source]#
alhambra.fastreduce.uP = 4[source]#
class alhambra.fastreduce.FGlueList(glues)[source]#
blankequiv()[source]#
iseq(equiv, a, b)[source]#
domerge(equiv, a, b, preserveuse=False)[source]#
alhambra.fastreduce.U_UNUSED[source]#
alhambra.fastreduce.U_INPUT = 1[source]#
alhambra.fastreduce.U_OUTPUT = 0[source]#
class alhambra.fastreduce.FTileList(tiles, gluelist)[source]#
alhambra.fastreduce.RSEL = (2, 3, 0, 1)[source]#
alhambra.fastreduce.FTI = (1, 0, 1, 0)[source]#
alhambra.fastreduce._fdg(dir, gs1, gs2)[source]#
alhambra.fastreduce._ffakedouble_n(tn, sta, gluelist, outputonly=True, dir4=False, equiv=None)[source]#
alhambra.fastreduce.HSEL = ((1, 0, 5, 6), (2, 3, 4, 0))[source]#
alhambra.fastreduce.VSEL = ((1, 2, 0, 6), (0, 3, 4, 5))[source]#
alhambra.fastreduce._ffakesingle(ftile, gluelist)[source]#
alhambra.fastreduce._ft_to_fta(ftiles)[source]#
class alhambra.fastreduce._FastTileSet(tilesystem)[source]#
applyequiv(ts, equiv)[source]#
togluemergespec(ts, equiv)[source]#
alhambra.fastreduce.ptins(fts, equiv=None, tau=2)[source]#

Calculate potential tile attachments to input neighborhoods

alhambra.fastreduce.is_2go_single_nn(fts, tn, un, equiv, tau=2, in2go=None, retall=False, also22go=False)[source]#
alhambra.fastreduce.gen_2go_single_ins(fts, tau=2)[source]#
alhambra.fastreduce.gen_2go_profile(fts, equiv=None, ins2go=None, also22go=False)[source]#
alhambra.fastreduce.is_2go_equiv(fts, equiv=None, ins2go=None, origsens=None)[source]#
alhambra.fastreduce.is_22go_equiv(fts, equiv=None, ins2go=None, orig22go=None)[source]#
alhambra.fastreduce.fta_to_ft(stiles, un, sel=None)[source]#
alhambra.fastreduce.isatamequiv(fts, equiv, initptins=None)[source]#
alhambra.fastreduce.tilemerge(fts, equiv, t1, t2, preserveuse=False)[source]#
alhambra.fastreduce._findpotentialtilemerges(fts, equiv)[source]#
alhambra.fastreduce._findpotentialgluemerges(fts, equiv)[source]#
alhambra.fastreduce._recfix(fts, equiv, tp, initptins, check2go=False, ins2go=None, orig2go=None, orig22go=None, check22go=False, checkld=False, chain=None, preserveuse=False)[source]#
alhambra.fastreduce._tilereduce(fts, equiv=None, check2go=False, initptins=None, check22go=False, checkld=False, preserveuse=False)[source]#
alhambra.fastreduce._gluereduce(fts, equiv=None, check2go=False, check22go=False, checkld=False, initptins=None, preserveuse=False)[source]#
alhambra.fastreduce._single_reduce_tiles(p)[source]#
alhambra.fastreduce._single_reduce_ends(p)[source]#
alhambra.fastreduce.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.fastreduce.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