spinecho_sim package#
A set of tools for spin echo simulations.
- class spinecho_sim.ParticleState(*, spin: GenericSpin, displacement: ParticleDisplacement = <factory>, parallel_velocity: float, gyromagnetic_ratio: float = -204000000.0)#
Bases:
object
Represents the state of a particle in the simulation.
- as_coherent() list[CoherentParticleState] #
Convert to a CoherentParticleState.
- displacement: ParticleDisplacement#
- gyromagnetic_ratio: float = -204000000.0#
- parallel_velocity: float#
- spin: GenericSpin#
- class spinecho_sim.Solenoid(*, length: float, field: Callable[[float], np.ndarray[Any, np.dtype[np.floating]]])#
Bases:
object
Dataclass representing a solenoid with its parameters.
- field: Callable[[float], np.ndarray[Any, np.dtype[np.floating]]]#
- classmethod from_experimental_parameters(*, length: float, magnetic_constant: float, current: float) Solenoid #
Build a solenoid from an experimental magnetic constant and current.
- length: float#
- simulate_trajectories(initial_states: list[ParticleState], n_steps: int = 100) SolenoidSimulationResult #
Run a solenoid simulation for multiple initial states.
- simulate_trajectory(initial_state: ParticleState, n_steps: int = 100) SolenoidTrajectory #
Run the spin echo simulation using configured parameters.
- class spinecho_sim.SolenoidSimulationResult(*, trajectories: TrajectoryList, positions: ndarray[Any, dtype[floating]])#
Bases:
object
Represents the result of a solenoid simulation.
- property displacements: ParticleDisplacementList#
Extract the displacements from the simulation states.
- positions: ndarray[Any, dtype[floating]]#
- trajectories: TrajectoryList#
- class spinecho_sim.SolenoidTrajectory(*, trajectory: Trajectory, positions: ndarray[Any, dtype[floating]])#
Bases:
object
Represents the trajectory of a particle as it moves through the simulation.
- property displacement: ParticleDisplacement#
The displacement of the particle at the end of the trajectory.
- positions: ndarray[Any, dtype[floating]]#
- trajectory: Trajectory#
Subpackages#
- spinecho_sim.solenoid package
- spinecho_sim.state package
Submodules#
spinecho_sim.util module#
- spinecho_sim.util.get_figure(ax: Axes | None = None) tuple[Figure | SubFigure, Axes] #
Get a figure and axes for plotting.
- spinecho_sim.util.get_measure_label(measure: Literal['real', 'imag', 'abs', 'arg']) str #
Get the specified measure of an array.
- spinecho_sim.util.measure_data(arr: ndarray, measure: Literal['real', 'imag', 'abs', 'arg']) ndarray #
Get the specified measure of an array.