Utilities
╔══════════════════════════════════════════════════════════╗ ║ utils « boundary handling & data preprocessing » ║ ╚══════════════════════════════════════════════════════════╝
- class satyre.utils.HyperspaceSolver(vector=None, border=10000.0)[source]
Resolve boundary crossings in a square toroidal arena.
Given a displacement vector that may extend beyond the arena borders, the solver decomposes it into a sequence of sub-steps that wrap around the edges.
- Parameters:
Example
>>> import numpy as np >>> from satyre.utils import HyperspaceSolver >>> vec = np.array([[-9000., -9000.], [-14000., -16000.]]) >>> solver = HyperspaceSolver(vector=vec, border=10000) >>> sub_steps = solver.solve() >>> sub_steps[-1] # final in-bounds position array([...])
- satyre.utils.build_transition_matrices(idx_path, velo_path)[source]
Build Markov transition matrices from raw text files.
- Parameters:
- Return type:
tuple[ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]],ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]],ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]]- Returns:
A tuple
(cumsum_matrix, pm_index, velocity_array)where:cumsum_matrix — cumulative transition-probability matrix of shape
(N+1, N+1)(row 0 / col 0 are header indices).pm_index — companion index matrix of same shape mapping columns back to PM identifiers.
velocity_array —
(N+1, 3)array of[thrust, slip, yaw]velocities.
Example
>>> from satyre.utils import build_transition_matrices >>> trans, idx, velos = build_transition_matrices( ... 'data/ORL_IDX.txt', 'data/ORL_C.txt' ... )
HyperspaceSolver
- class satyre.utils.hyperspace_solver.HyperspaceSolver(vector=None, border=10000.0)[source]
Bases:
objectResolve boundary crossings in a square toroidal arena.
Given a displacement vector that may extend beyond the arena borders, the solver decomposes it into a sequence of sub-steps that wrap around the edges.
- Parameters:
Example
>>> import numpy as np >>> from satyre.utils import HyperspaceSolver >>> vec = np.array([[-9000., -9000.], [-14000., -16000.]]) >>> solver = HyperspaceSolver(vector=vec, border=10000) >>> sub_steps = solver.solve() >>> sub_steps[-1] # final in-bounds position array([...])
Preprocessing
╔══════════════════════════════════════════════════════════╗ ║ preprocessing « build Markov transition matrices » ║ ╚══════════════════════════════════════════════════════════╝
Converts raw experimental data (prototypical-movement index
sequences and velocity tables) into the cumulative transition-
probability matrices consumed by MarkovWalker.
- satyre.utils.preprocessing.build_transition_matrices(idx_path, velo_path)[source]
Build Markov transition matrices from raw text files.
- Parameters:
- Return type:
tuple[ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]],ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]],ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]]- Returns:
A tuple
(cumsum_matrix, pm_index, velocity_array)where:cumsum_matrix — cumulative transition-probability matrix of shape
(N+1, N+1)(row 0 / col 0 are header indices).pm_index — companion index matrix of same shape mapping columns back to PM identifiers.
velocity_array —
(N+1, 3)array of[thrust, slip, yaw]velocities.
Example
>>> from satyre.utils import build_transition_matrices >>> trans, idx, velos = build_transition_matrices( ... 'data/ORL_IDX.txt', 'data/ORL_C.txt' ... )