desc.magnetic_fields.SplineMagneticField.from_mgrid

classmethod SplineMagneticField.from_mgrid(mgrid_file, extcur=None, method='cubic', extrap=False)Source

Create a SplineMagneticField from an “mgrid” file from MAKEGRID.

Parameters:
  • mgrid_file (str or path-like) – File path to mgrid netCDF file to load from.

  • extcur (array-like, optional) – Currents for each coil group. They default to the coil currents from the mgrid file for “scaled” mode, or to 1 for “raw” mode.

  • method (str) – Interpolation method.

  • extrap (bool) – Whether to extrapolate beyond the domain of known field values (True) or return NaN (False).