Skip to content

Solution

pybasin.solution.Solution

Solution: Represents the time integration result for a single initial condition.

This class stores:

  • The initial condition used for integration.
  • The time series result from integration.
  • Features extracted from the trajectory.
  • Optional labels/classification for each trajectory.
  • Optional model parameters that were used in the integration.
  • Optional orbit data for orbit diagram plotting.

Attributes:

Name Type Description
initial_condition Tensor

The initial condition used for integration (shape: B, S).

time Tensor

Time points of the solution (shape: N).

y Tensor

State values over time (shape: N, B, S).

features Tensor | None

Filtered features used for classification.

extracted_features Tensor | None

Original extracted features before filtering.

extracted_feature_names list[str] | None

Names of extracted features.

feature_names list[str] | None

Names of filtered features.

labels ndarray | None

Labels assigned to each solution in the batch.

model_params dict[str, Any] | None

Parameters of the ODE model.

orbit_data OrbitData | None

Peak amplitude data for orbit diagram plotting.

Functions

__init__

__init__(
    initial_condition: Tensor,
    time: Tensor,
    y: Tensor,
    features: Tensor | None = None,
    labels: ndarray | None = None,
    model_params: dict[str, float] | None = None,
)

Initialize the Solution object.

Parameters:

Name Type Description Default
initial_condition Tensor

shape: (B, S) => B batches, S state variables

required
time Tensor

shape: (N,) => N time points

required
y Tensor

shape: (N, B, S) => N time points, B batches, S state variables

required
features Tensor | None

Optional features describing the trajectory.

None
labels ndarray | None

Optional classification labels for the solutions.

None
model_params dict[str, float] | None

Optional dictionary of model parameters used in the simulation.

None

set_labels

set_labels(labels: ndarray)

Assign a label to this solution.

Parameters:

Name Type Description Default
labels ndarray

The label to assign from the classification results.

required

set_extracted_features

set_extracted_features(features: Tensor, names: list[str])

Store extracted features before filtering.

Parameters:

Name Type Description Default
features Tensor

Extracted feature tensor.

required
names list[str]

List of feature names.

required

set_features

set_features(
    features: Tensor, names: list[str] | None = None
)

Store features extracted from the trajectory.

Parameters:

Name Type Description Default
features Tensor

A feature vector describing the solution (typically filtered).

required
names list[str] | None

Optional list of feature names (for filtered features).

None

get_summary

get_summary() -> dict[str, Any]

Return a summary of the solution.

Returns:

Type Description
dict[str, Any]

Dictionary with key information about the solution.

pybasin.utils.OrbitData dataclass

Data structure for orbit diagram plotting.

Stores peak amplitude information from steady-state trajectories, organized by degree of freedom (DOF). For period-N orbits, trajectories will have N distinct peak amplitude levels.

Attributes:

Name Type Description
peak_values Tensor

Peak amplitudes for each DOF. Shape (max_peaks, B, D) where D is number of DOFs. Padded with NaN for trajectories with fewer peaks.

peak_counts Tensor

Number of peaks per trajectory per DOF. Shape (B, D).

dof_indices list[int]

Which state indices were analyzed.

time_steady float

Time threshold used for steady-state filtering.