Periodic Nonuniform Piecewise [module]

Here are the methods of the class splinekit.PeriodicNonuniformPiecewise.

This class validates a list of pieces as being a periodic partition.


class splinekit.periodic_nonuniform_piecewise.PeriodicNonuniformPiecewise(pieces: List[Piece], *, period: int)

Bases: object

The class that maintains a valid periodic partition of a closed-open proper interval of integer diameter with zero as left bound.

Let a Piece object define some arbitrary attribute over a domain made of an interval. Consider now a list of such pieces and assume that their combined intervals make for a partition of the closed-open interval \([0, P),\) where the period \(P\) is a positive integer. An instance of the class PeriodicNonuniformPiecewise maintains a database of such pieces and provides a convenience method to access the appropriate piece at any \(x\in{\mathbb{R}}\).


property pieces: List[Piece]

The list of all pieces associated to this PeriodicNonuniformPiecewise instance, sorted by increasing domain.

Returns:

All pieces as a list.

Return type:

list of Piece


property period: int

The period associated to this PeriodicNonuniformPiecewise instance.

Returns:

The period.

Return type:

int


class Piece(domain: Interval, item: Any)

Bases: NamedTuple

Each piece of a PeriodicNonuniformPiecewise object is a named tuple made of two fields. The first field is named domain and is an Interval object that describes an arbitrary domain over which the piece extends. The second field is named item and carries the attributes of the piece—often, a function.


domain: Interval

The domain of the piece.


item: Any

The item of the piece.


item_at(x: float) Any

Convenience method to access individual pieces.

The pieces are periodized with period period. Accordingly, the index x is free to take any real value.

Parameters:

x (float) – Floating-point index of the piece.

Returns:

The item associated to the piece whose interval contains x.

Return type:

Any