desc.magnetic_fields.SplineMagneticField.from_field
- classmethod SplineMagneticField.from_field(field, R, phi, Z, params=None, method='cubic', extrap=False, NFP=None, chunk_size=None, source_grid=None)Source
Create a splined magnetic field from another field for faster evaluation.
- Parameters:
field (MagneticField or callable) – field to interpolate. If a callable, should take a vector of cylindrical coordinates and return the field in cylindrical components
R (ndarray) – 1d arrays of interpolation nodes in cylindrical coordinates
phi (ndarray) – 1d arrays of interpolation nodes in cylindrical coordinates
Z (ndarray) – 1d arrays of interpolation nodes in cylindrical coordinates
params (dict, optional) – parameters passed to field
method (str) – spline method for SplineMagneticField
extrap (bool) – whether to extrapolate splines beyond specified R,phi,Z
NFP (int, optional) – Number of toroidal field periods. If not provided, will default to 1 or the provided field’s NFP, if it has that attribute.
chunk_size (int or None) – Size to split computation into chunks of evaluation points. If no chunking should be done or the chunk size is the full input then supply
None. Default isNone.source_grid (Grid, optional) – Grid used to discretize field. Defaults to the default grid for given field.