Skip to content

Data handling

dynax.differentiate(ts, ys)

Approximate the derivatives of a timeseries via cubic interpolation.

PARAMETER DESCRIPTION
ts

The time of each observation.

TYPE: Float[Array, 'k']

ys

The observations themselves. Should use NaN to indicate missing data.

TYPE: T

RETURNS DESCRIPTION
T

PyTree of derivatives of ys evaluated at ts.

dynax.Trajectory

Simple dataclass for storing trajectory like data.

The fields are
  • ts: Timestamps, (typically) expected shape (...,)
  • ys: State vectors, (typically) expected shape (..., n)
  • y_ts: State derivatives, (typically) expected shape (..., n)
  • us: Inputs/Excitations, (typically) expected shape (..., m)

__init__(ts=None, ys=None, *, y_ts=None, us=None, dtype=None)

Initialize a Trajectory and converts all arrays to jax arrays.

PARAMETER DESCRIPTION
ts

Timestamps. Defaults to None.

TYPE: Any DEFAULT: None

ys

States. Defaults to None.

TYPE: Any DEFAULT: None

y_ts

State derivatives. Defaults to None.

TYPE: Any DEFAULT: None

us

Input/Exciataions. Defaults to None.

TYPE: Any DEFAULT: None

dtype

Data type of the arrays after conversion to jax arrays. Defaults to None.

TYPE: str | type[Any] | numpy.dtype | jax._src.typing.SupportsDType | None DEFAULT: None

__getitem__(index)

Index all fields simultaniously.

PARAMETER DESCRIPTION
index

Any index into a jax.numpy array.

TYPE: Index

RETURNS DESCRIPTION
dynax.Trajectory

Trajectory with every field indexed by index.

stack(trajectories, axis=0, dtype=None) staticmethod

Broadcasted stacking of trajectories.

PARAMETER DESCRIPTION
trajectories

Sequence of trajectories to stack.

TYPE: Sequence[dynax.Trajectory]

axis

Axis along which to stack. Defaults to 0.

TYPE: int DEFAULT: 0

dtype

Optional dtype of the resulting array. If not specified, the dtype will be determined via type promotion rules described in type-promotion. Defaults to None.

TYPE: str | type[Any] | numpy.dtype | jax._src.typing.SupportsDType | None DEFAULT: None

RETURNS DESCRIPTION
dynax.Trajectory

Trajectory containing the stacked arrays.