chalc.sixpack.types

Implementation of a 6-pack of persistence diagrams.

Classes

SimplexPairings

Persistence diagram represented by paired and unpaired simplices.

SixPack

6-pack of persistence diagrams.

Module Contents

class SimplexPairings(paired: collections.abc.Collection[tuple[int, int]] = set(), unpaired: collections.abc.Collection[int] = set())

Bases: collections.abc.Collection

digraph inheritancea3cfdb496f { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Collection" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Sized" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Iterable" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Container" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Container" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Iterable" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "SimplexPairings" [URL="#chalc.sixpack.types.SimplexPairings",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Persistence diagram represented by paired and unpaired simplices."]; "Collection" -> "SimplexPairings" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Sized" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; }

Persistence diagram represented by paired and unpaired simplices.

__bool__() bool

Return true if the diagram is non-empty.

__contains__(feature: object) bool

Return true if a feature is in the diagram.

The feature to check should be either a pair of simplices (int, int) or a single simplex (int).

__eq__(other: object) bool

Check if two diagrams have the same paired and unpaired simplices.

__hash__() int

Return a hash of the persistence diagram.

__iter__() collections.abc.Iterator[tuple[int, int] | int]

Iterate over all features in the diagram.

__len__() int

Return the number of features in the diagram.

__str__() str

Represent the persistence diagram as a string.

property paired: frozenset[tuple[int, int]]

Set of indices of paired simplices.

paired_as_matrix() numpy.ndarray[tuple[int, Literal[2]], numpy.dtype[numpy.int64]]

Return a matrix representation of the finite persistence features in the diagram.

property unpaired: frozenset[int]

Set of indices of unpaired simplices.

class SixPack(
kernel: SimplexPairings | None = None,
cokernel: SimplexPairings | None = None,
domain: SimplexPairings | None = None,
codomain: SimplexPairings | None = None,
image: SimplexPairings | None = None,
relative: SimplexPairings | None = None,
entrance_times: collections.abc.Sequence[float] = [],
dimensions: collections.abc.Sequence[int] = [],
)

Bases: collections.abc.Mapping

digraph inheritancef35d1a9f87 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Collection" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Sized" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Iterable" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Container" -> "Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Container" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Iterable" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Mapping" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A Mapping is a generic container for associating key/value"]; "Collection" -> "Mapping" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SixPack" [URL="#chalc.sixpack.types.SixPack",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="6-pack of persistence diagrams."]; "Mapping" -> "SixPack" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Sized" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; }

6-pack of persistence diagrams.

__bool__() bool

Return true if any diagram in the 6-pack is non-empty.

__contains__(key: object) bool

Return true if a diagram is in the 6-pack.

__eq__(other: object) bool

Check if two 6-packs of persistence diagrams are identical.

__getitem__(key: DiagramName) SimplexPairings

Access a specific diagram in the 6-pack.

__hash__() int

Return a hash of the 6-pack of persistence diagrams.

__iter__() collections.abc.Iterator[DiagramName]

Iterate over all diagrams in the 6-pack.

__len__() int

Return the number of diagrams in the 6-pack.

property dimensions: numpy.ndarray[tuple[int], numpy.dtype[numpy.int64]]

Dimensions of the simplices.

property entrance_times: numpy.ndarray[tuple[int], numpy.dtype[numpy.float64]]

Entrance times of the simplices.

classmethod from_file(file: h5py.Group) SixPack

Load a 6-pack of persistence diagrams from a HDF5 file or group.

Parameters:

file – A h5py file or group.

get_matrix(diagram_name: DiagramName, dimension: int) numpy.ndarray[tuple[int, Literal[2]], numpy.dtype[numpy.float64]]
get_matrix(diagram_name: DiagramName, dimension: list[int] | None = None) list[numpy.ndarray[tuple[int, Literal[2]], numpy.dtype[numpy.float64]]]

Get a specific diagram as a matrix of birth and death times.

Parameters:
  • diagram_name – One of 'ker', 'cok', 'dom', 'cod', 'im', or 'rel'.

  • dimension – Dimension(s) of the diagram desired. If a list is provided then a list of matrices is returned, with the order of matrices respecting the order of entries of dim. If dimension is not provided then the returned matrix will contain persistent features from all homological dimensions from zero to max(self.dimensions).

Returns:

An \(m \times 2\) matrix whose rows are a pair of birth and death times, or a list of such matrices.

items() collections.abc.ItemsView[DiagramName, SimplexPairings]

View of the diagrams in the 6-pack.

keys() collections.abc.KeysView[DiagramName]

View of the names of the diagrams in the 6-pack.

classmethod names() tuple[DiagramName, Ellipsis]

Return the names of the diagrams in the 6-pack.

num_features() int

Count the total number of features across all diagrams in the 6-pack.

save(file: h5py.Group) None

Save a 6-pack of persistence diagrams to a HDF5 file or group.

Parameters:

file – A h5py file or group.

threshold(tolerance: float) SixPack

Discard all features with persistence <=tolerance.

values() collections.abc.ValuesView[SimplexPairings]

View of the diagrams in the 6-pack.