ADCS.environment.magnetic_field.magnetic_field module

Parent interface for magnetic field models.

class ADCS.environment.magnetic_field.magnetic_field.MagneticField[source]

Bases: ABC

Interface for an Earth magnetic field model.

Implementations evaluate geocentric spherical field components in nanotesla. The common field() method converts those components to Earth fixed Cartesian vectors in tesla.

Subclasses may set name to a short identifier. Models that leave it unset are identified by their class name.

field(position_ecef_km, date)[source]

Evaluate an Earth fixed magnetic field vector.

Parameters:
  • position_ecef_km (numpy.ndarray) – One ECEF position (3,) or positions (N, 3) [km].

  • date (datetime.datetime or sequence) – One UTC date or one date per position.

Returns:

ECEF field vector or vectors [T], matching the position shape.

Return type:

numpy.ndarray

Raises:

ValueError – If a position has the wrong shape or zero radius.

abstractmethod field_gc(r, theta, phi, date)[source]

Evaluate geocentric spherical field components.

Parameters:
  • r (float or numpy.ndarray) – Geocentric radius [km].

  • theta (float or numpy.ndarray) – Geocentric colatitude [deg].

  • phi (float or numpy.ndarray) – East longitude [deg].

  • date (datetime.datetime or sequence) – One UTC date or one date per position.

Returns:

Radial, southward, and eastward components [nT].

Return type:

tuple

name: str | None = None

Short identifier for the model (for example "wmm2025"). None means the class name is used instead.