polyphys.manage.types#

polyphys.manage.types#

This types module provides type definitions and type aliases to support clarity, type safety, and documentation for the data structures and classes used within the PolyPhys package.

Custom types here represent domain-specific concepts such as PropertyT, EntityT, and DirectionT, which clarify the usage of fundamental types like str, int, and bool. PhaseT and StageT are the phase and stage vocabularies that make_database() checks its arguments against, and NormalizerT the ways a density profile may be normalized.

Composite types such as tuples and dictionaries (TimeSeriesT, NonScalarHistT, etc.) group related information for structured data handling.

This module also defines type aliases for input sources and simulation metadata.

Module Attributes

ParserInstanceT

A parser instance, an instance of a ParserBase subclass.

ParserClassT

A parser class, a subclass of ParserBase.

Pathish

A file-system path, a str or an os.PathLike of str.

PathIter

An iterable of paths.

PathGroup

The paths of one group, such as the files that share a basename, e.g. tuple[Path, ...].

PathGroupIter

An iterable of path groups, e.g. list[tuple[Path, ...]].

AnyPathIter

An iterable of paths or of path groups, for user-facing functions.

AxisT

A Cartesian axis, 0, 1, or 2 for x, y, or z.

BinT

How fixedsize_bins() fits a range to whole bins, 'ordinary', 'nonnegative', or 'periodic'.

DirectionT

A direction of a histogram or profile, 'x', 'y', 'z', the radial 'r', or the azimuthal 'theta'.

EnsembleName

The name of an artifact at the ensemble level.

EntityT

A species label, such as 'Mon' or 'Crd'.

GeometryT

The geometry of a simulation box, a periodic 'cubic' box or a 'cylindrical' one, periodic along its axis.

GroupT

A particle group, such as 'bug' or 'all'.

HasEdgeT

Whether a quantity has bin edges.

LineageT

A level of the artifact lineage.

WholeRelationT

How the segments of a whole combine; whole_from_segments() sums 'histogram' segments, joins 'tseries' segments, and checks that 'bin_edge' segments agree.

PhaseT

A phase directory of a project, in the order the data flows through them; make_database() accepts exactly these.

NormalizerT

How a density profile is normalized, by the value of its first bin (r = 0, the cylinder axis or the chain's center of mass), its last bin (the far field along z or in a periodic cube), or its maximum; by a number; or by a function of the scaled profile that returns the value.

PlaneT

A Cartesian plane, 'xy', 'yz', or 'zx'.

PrimitiveLineageT

A lineage level that the probe writes, 'segment' or 'whole'.

PropertyT

The name of a physical property, such as 'gyrT'.

StageT

A stage of a phase directory; make_database() accepts exactly these.

TopologyT

The topology of a chain, such as 'linear' or 'ring'.

WholeName

The name of an artifact at the whole level.

EdgeDataT

Bin edges keyed by name.

EdgeT

A direction and a particle group.

EnsembleT

An ensemble's name and its data.

FreqDataT

Frequencies keyed by name.

HistogramT

A direction, a species, and a particle group.

HnsStatdictT

Binding statistics of H-NS proteins keyed by name.

NonScalarHistT

A property, a species, a particle group, and an axis.

NonScalarMatT

A property, a species, and a particle group.

TimeSeriesT

A property, a species, and a particle group.

WholeT

The data of wholes keyed by whole name.

InputType

An open file, a gzip.GzipFile, a text file, or any file object.

Classes

EnsembleName

The name of an artifact at the ensemble level.

EntityT

A species label, such as 'Mon' or 'Crd'.

GroupT

A particle group, such as 'bug' or 'all'.

HasEdgeT

Whether a quantity has bin edges.

PropertyT

The name of a physical property, such as 'gyrT'.

TopologyT

The topology of a chain, such as 'linear' or 'ring'.

WholeName

The name of an artifact at the whole level.

polyphys.manage.types.AnyPathIter#

An iterable of paths or of path groups, for user-facing functions.

alias of Iterable[str | PathLike[str]] | Iterable[Sequence[str | PathLike[str]]]

polyphys.manage.types.AxisT#

A Cartesian axis, 0, 1, or 2 for x, y, or z.

alias of Literal[0, 1, 2]

polyphys.manage.types.BinT#

How fixedsize_bins() fits a range to whole bins, 'ordinary', 'nonnegative', or 'periodic'.

alias of Literal[‘ordinary’, ‘nonnegative’, ‘periodic’]

polyphys.manage.types.DirectionT#

A direction of a histogram or profile, 'x', 'y', 'z', the radial 'r', or the azimuthal 'theta'.

alias of Literal[‘x’, ‘y’, ‘z’, ‘r’, ‘theta’]

polyphys.manage.types.EdgeDataT#

Bin edges keyed by name.

alias of dict[str, ndarray]

polyphys.manage.types.EdgeT#

A direction and a particle group.

alias of tuple[Literal[‘x’, ‘y’, ‘z’, ‘r’, ‘theta’], str]

polyphys.manage.types.EnsembleName#

The name of an artifact at the ensemble level.

polyphys.manage.types.EnsembleT#

An ensemble’s name and its data.

alias of tuple[str, ndarray | DataFrame]

polyphys.manage.types.EntityT#

A species label, such as 'Mon' or 'Crd'.

polyphys.manage.types.FreqDataT#

Frequencies keyed by name.

alias of dict[str, ndarray]

polyphys.manage.types.GeometryT#

The geometry of a simulation box, a periodic 'cubic' box or a 'cylindrical' one, periodic along its axis.

alias of Literal[‘cubic’, ‘cylindrical’]

polyphys.manage.types.GroupT#

A particle group, such as 'bug' or 'all'.

polyphys.manage.types.HasEdgeT#

Whether a quantity has bin edges.

polyphys.manage.types.HistogramT#

A direction, a species, and a particle group.

alias of tuple[Literal[‘x’, ‘y’, ‘z’, ‘r’, ‘theta’], str, str]

polyphys.manage.types.HnsStatdictT#

Binding statistics of H-NS proteins keyed by name.

alias of dict[str, list[int] | ndarray]

polyphys.manage.types.InputType#

An open file, a gzip.GzipFile, a text file, or any file object.

alias of GzipFile | TextIO | IO[Any]

polyphys.manage.types.LineageT#

A level of the artifact lineage.

alias of Literal[‘segment’, ‘whole’, ‘ensemble_long’, ‘ensemble’, ‘space’]

polyphys.manage.types.NonScalarHistT#

A property, a species, a particle group, and an axis.

alias of tuple[str, str, str, Literal[0, 1, 2]]

polyphys.manage.types.NonScalarMatT#

A property, a species, and a particle group.

alias of tuple[str, str, str]

polyphys.manage.types.NormalizerT#

How a density profile is normalized, by the value of its first bin (r = 0, the cylinder axis or the chain’s center of mass), its last bin (the far field along z or in a periodic cube), or its maximum; by a number; or by a function of the scaled profile that returns the value.

alias of Literal[‘first’, ‘last’, ‘max’] | float | Callable[[DataFrame], float]

polyphys.manage.types.ParserClassT#

A parser class, a subclass of ParserBase.

alias of type[ParserBase]

class polyphys.manage.types.ParserInstanceT#

A parser instance, an instance of a ParserBase subclass.

alias of TypeVar(‘ParserInstanceT’, bound=ParserBase)

polyphys.manage.types.PathGroup#

The paths of one group, such as the files that share a basename, e.g. tuple[Path, ...].

alias of Sequence[str | PathLike[str]]

polyphys.manage.types.PathGroupIter#

An iterable of path groups, e.g. list[tuple[Path, ...]].

alias of Iterable[Sequence[str | PathLike[str]]]

polyphys.manage.types.PathIter#

An iterable of paths.

alias of Iterable[str | PathLike[str]]

polyphys.manage.types.Pathish = str | os.PathLike[str]#

A file-system path, a str or an os.PathLike of str.

polyphys.manage.types.PhaseT#

A phase directory of a project, in the order the data flows through them; make_database() accepts exactly these.

alias of Literal[‘simsAll’, ‘simsCont’, ‘logs’, ‘trjs’, ‘probes’, ‘analysis’, ‘viz’, ‘galaxy’, ‘allInOne’]

polyphys.manage.types.PlaneT#

A Cartesian plane, 'xy', 'yz', or 'zx'.

alias of Literal[‘xy’, ‘yz’, ‘zx’]

polyphys.manage.types.PrimitiveLineageT#

A lineage level that the probe writes, 'segment' or 'whole'.

alias of Literal[‘segment’, ‘whole’]

polyphys.manage.types.PropertyT#

The name of a physical property, such as 'gyrT'.

polyphys.manage.types.StageT#

A stage of a phase directory; make_database() accepts exactly these.

alias of Literal[‘segment’, ‘wholeSim’, ‘ens’, ‘ensAvg’, ‘space’, ‘galaxy’]

polyphys.manage.types.TimeSeriesT#

A property, a species, and a particle group.

alias of tuple[str, str, str]

polyphys.manage.types.TopologyT#

The topology of a chain, such as 'linear' or 'ring'.

polyphys.manage.types.WholeName#

The name of an artifact at the whole level.

polyphys.manage.types.WholeRelationT#

How the segments of a whole combine; whole_from_segments() sums 'histogram' segments, joins 'tseries' segments, and checks that 'bin_edge' segments agree.

alias of Literal[‘histogram’, ‘tseries’, ‘bin_edge’]

polyphys.manage.types.WholeT#

The data of wholes keyed by whole name.

alias of dict[str, ndarray | DataFrame]