HereditaryStratigraphicSurface

class HereditaryStratigraphicSurface

Wrapper around downstream.dsurf.Surface that supports the same interface as HereditaryStratigraphicColumn.

Assumes that surface is initialized filled with differentiae, meaning that dstream T values are offset from rank/number of items deposited by surface size S. This also means that preinitialized-differentia have negative rank.

__init__(dstream_surface: Surface[int], *, predeposit_strata: int | None = None, stratum_differentia_bit_width: int = 64) None[source]

A wrapper around the downstream Surface object to match the hstrat.HereditaryStratigraphicColumn interface.

Initially deposits S + predeposit_strata strata, where S is the surface size. If surface is already initialized, predeposit_strata is ignored and a ValueError is raised if predeposit_strata is not None.

Parameters

dstream_surface: downstream.dsurf.Surface

The surface to use to store annotations.

predeposit_strata: int, default 1

The number of strata to deposit on the surface during initialization. Default 1 matches behavior of HereditaryStratigraphicColumn.

stratum_differentia_bit_widthint, default 64

The bit width for generated differentia.

Methods

Attributes

S

Number of buffer sites available to store differentiae.

Clone() HereditaryStratigraphicSurface[source]

Create an independent copy of the surface.

Contains identical data but may be freely altered without affecting data within this surface.

CloneDescendant() HereditaryStratigraphicSurface[source]

Return a cloned surface that has had an additional stratum deposited.

Does not alter self.

CloneNthDescendant(num_stratum_depositions: int) HereditaryStratigraphicSurface[source]

Return a cloned surface that has had n additional strata deposited.

Does not alter self.

Parameters

num_stratum_depositions: int

How many generations should clone surface be descended?

DepositStrata(num_stratum_depositions: int) None[source]

Elapse n generations.

Parameters

num_stratum_depositions: int

How many generations to elapse?

DepositStratum(differentia: int | None = None) None[source]

Elapse a generation by depositing a differentia value.

Differentia may be provided (useful for testing) or, by default, randomly generated.

GetColumnIndexOfRank(rank: int) int | None[source]

Map generation of deposition to column position.

What is the index position within retained strata of the stratum deposited at rank r? Returns None if no stratum with rank r is present within the store.

GetNextRank() int[source]

Get the rank of the next stratum to be deposited.

This is the rank of the next stratum to be deposited, not the rank of the most recent stratum.

GetNumDiscardedStrata() int[source]

How many deposited strata have been discarded?

Determined by number of generations elapsed and the configured column retention policy. Does not include S initialization strata.

GetNumStrataDeposited() int[source]

How many strata have been deposited on the surface?

Note that a first S strata may be deposited on the surface during initialization.

GetNumStrataRetained() int[source]

How many strata are currently stored within the surface?

May be fewer than the number of strata deposited if strata have been discarded as part of the configured stratum retention policy.

GetRankAtColumnIndex(index: int) int[source]

Map column position to generation of deposition.

What is the deposition rank of the stratum positioned at index i among retained strata? Index order is from most ancient (index 0) to most recent.

GetRankAtStorageIndex(index: int) int | None[source]

Map column position to generation of deposition.

What is the deposition rank of the stratum positioned at index i among retained strata? Index order is from most ancient (index 0) to most recent.

GetStorageIndexOfRank(rank: int) int | None[source]

Map generation of deposition to position within surface storage.

What is the surface position within retained strata of the stratum deposited at rank r? Returns None if no stratum with rank r is present within the store.

GetStratumAtColumnIndex(index: int) HereditaryStratum[source]

Get the stratum positioned at index i among retained strata.

Index order is from most ancient (index 0) to most recent.

GetStratumAtRank(rank: int) HereditaryStratum | None[source]

Get the stratum deposited at generation g.

Returns None if stratum with rank g is not retained.

GetStratumDifferentiaBitWidth() int[source]

How many bits wide are the differentia of strata?

HasAnyAnnotations() bool[source]

Do any retained strata have annotations?

HasDiscardedStrata() bool[source]

Have any deposited strata been discarded?

Does not include S initialization strata.

IterRankDifferentiaZip(copyable: bool = False) Iterator[Tuple[int, int]][source]

Iterate over ranks of retained strata and their differentia.

If copyable, return an iterator that can be copied to produce a new fully-independent iterator at the same position.

Equivalent to zip(surf.IterRetainedRanks(), surf.IterRetainedDifferentia()).

IterRetainedDifferentia() Iterator[int][source]

Iterate over differentia of strata stored in the surface.

Differentia yielded from most ancient to most recent.

IterRetainedRanks() Iterator[int][source]

Iterate over deposition ranks of strata stored in the surface.

The store may be altered during iteration without iterator invalidation, although subsequent updates will not be reflected in the iterator.

IterRetainedStrata() Iterator[HereditaryStratum][source]

Iterate over strata stored in the surface.

Strata are yielded from most ancient to most recent.

property S

Number of buffer sites available to store differentiae.

__init__(dstream_surface: Surface[int], *, predeposit_strata: int | None = None, stratum_differentia_bit_width: int = 64) None[source]

A wrapper around the downstream Surface object to match the hstrat.HereditaryStratigraphicColumn interface.

Initially deposits S + predeposit_strata strata, where S is the surface size. If surface is already initialized, predeposit_strata is ignored and a ValueError is raised if predeposit_strata is not None.

Parameters

dstream_surface: downstream.dsurf.Surface

The surface to use to store annotations.

predeposit_strata: int, default 1

The number of strata to deposit on the surface during initialization. Default 1 matches behavior of HereditaryStratigraphicColumn.

stratum_differentia_bit_widthint, default 64

The bit width for generated differentia.