StaticField

class StaticField(strengths=None, target_spins=None)

Represent a static magnetic field.

Initialize the static magnetic field.

Parameters:
  • strengths (List[float]) – Strengths of the components (in \(\text{T}\), defaults to zero vector).

  • target_spins (Sequence[str] | None) – Iterable (or single string) of spin names the field should affect; None applies it to every spin.

Hint

Strengths of the components can be set at initialization:

static_field = StaticField([0, 0.001, 0.01])

Or it can be set after initialization:

static_field = StaticField()
static_field.vec = [0, 0.001, 0.01]

Or components can be set one-by-one:

static_field = StaticField()
static_field.y = 0.001
static_field.z = 0.01

Methods

normalize()

Normalize the vector to unit length.

Attributes

target_spins

Names of the spins affected by the field, or None for all spins.

vec

Vector corresponding the static magnetic field.

x

The \(x\) components of the static magnetic field.

y

The \(y\) components of the static magnetic field.

z

The \(z\) components of the static magnetic field.