morphogen.models.tiling_field

Microstructures defined cell by cell on a tiling other than the square grid.

Cellular automata (and reaction-diffusion, thresholded cell by cell) on triangles, hexagons, Penrose rhombi, Ammann-Beenker squares and rhombi, prisms, truncated octahedra, rhombic dodecahedra or golden rhombohedra (morphogen.automata.tilings) give a phase per cell. Images are rasterized at any resolution, each voxel taking the phase of the cell containing its centre (partial volumes by supersampling), so that every analysis and solver applies. The realization keeps the specification of its tiling (lattice, box, cell size and, for quasi-periodic tilings, the offsets of their grids and the order of a periodic approximant), from which the tiling is rebuilt, and the phases of the cells meeting the domain.

morphogen.models.tiling_field.VOXELS_PER_CELL = {2: 4, 3: 2}

Voxels per cell size of the default images (2D, 3D).

morphogen.models.tiling_field.default_grid(domain: Domain, tiling: Tiling) → Grid[source]

Grid of the default images of a tiling: 4 voxels per cell size in 2D (one through the thickness), 2 in 3D.

class morphogen.models.tiling_field.TilingField(domain: Domain, tiling: Tiling | dict, phases, *, cells=None, attributes: dict | None = None, **kwargs)[source]

Bases: Microstructure

A phase per cell of a tiling covering the domain.

Parameters:
  • tiling – The Tiling, or its spec.

  • phases – uint8 phase of each cell (of each of cells when given).

  • cells – Indices of the cells kept (those meeting a window cut from a larger tiling); all cells when None.

  • attributes – JSON-able data (number of steps, history of the run…).

property default_grid: Grid
property binary: bool
phase_of(cells) → ndarray[source]

Phases of cells of the tiling (0 for cells not kept: outside the window).

cell_image(shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

Image of the index (in the tiling) of the cell containing each voxel centre.

voxelize(shape=None, *, voxel_size=None, grid: Grid | None = None, supersampling=1)[source]

Phase image (uint8), or partial volume fractions of phase 1 (float32) when supersampling > 1 (supersampling**3 sub-samples per voxel).

contains(points) → ndarray[source]

Whether points lie in phase 1.

implicit_phases() → list[int][source]

The phases of the realization, each described by an implicit function (phase_level_set()), in increasing order: phase 1 and what surrounds it (the structures of more phases, or of others, say theirs).

phase_level_set(phase: int, shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

The implicit function of a phase (see Microstructure.phase_level_set()): the cells of the phase are convex, each the points on the inner side of the planes of its faces; the function is half the smallest gauge of the cells of the phase (the largest distance of the point to the planes of a cell, negative in it) minus half the smallest gauge of the other cells, among the cell of the point and those that share a vertex with it: zero on the faces between a cell of the phase and another, the distance to the face near it, clipped to a band of four voxels.

level_set(shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

The implicit function of phase 1 (phase_level_set()).

phase_level_sets_at(points, reach: float = inf) → dict[int, ndarray][source]

The functions of phase_level_set() at the points: half the smallest gauge of the cells of each phase minus half the smallest gauge of the other cells, among the cell of the point and those that share a vertex with it, within [-reach, reach] (default: the diagonal of the box).

level_set_at(points, reach: float = inf) → ndarray[source]

The function of phase 1 at the points (phase_level_sets_at()).

summary() → dict[source]

Counts and sizes describing the realization.