Source code for gtsimulation.magnetic_field._uniform

import numpy as np

from gtsimulation.magnetic_field import AbsBfield


[docs] class Uniform(AbsBfield): """ Uniform magnetic field. The field has the same magnitude and direction at every point. Parameters ---------- B : array-like, shape (3,) Magnetic field components (Bx, By, Bz) in nT. """ def __init__(self, B): super().__init__() self.ModelName = "Uniform" self.B = np.array(B).astype(np.float64)
[docs] def calc_field(self, x, y, z): return self.B
[docs] def update_state(self, new_date): pass
def __str__(self): return ( f"{self.ModelName}\n" f"\tB: {self.B} nT" )