examples.utils.context_features

Feature builders for single-state dynamical systems.

@dataclass
class SingleStateContextEmbedding:

Construct auxiliary features for single-state trajectories.

The nanorings dataset only contains an AMR channel (and a shared H-field drive). This helper reproduces the manual feature engineering we explored earlier, but keeps the original state untouched: we expose the augmented features separately so callers can provide them as inputs to the drift or diffusion networks without inflating the state dimension.

Example usage::

builder = SingleStateContextEmbedding(context_points=5)
state, inputs = builder.build(trajectories, h_signal, time_grid, metadata)

Here state is the original AMR/H tensor, while inputs contains the sinusoidal harmonics and context windows described below.

SingleStateContextEmbedding(context_points: int = 5, include_sinusoids: bool = True)
context_points: int = 5
include_sinusoids: bool = True
def build( self, trajectories: torch.Tensor, h_signal: torch.Tensor, time_grid: torch.Tensor, metadata: MutableMapping[str, object]) -> Tuple[torch.Tensor, torch.Tensor]:

Return (state, inputs) tensors with additional context features.