desc.coils.SplineXYZCoil
- class desc.coils.SplineXYZCoil(current, X, Y, Z, knots=None, method='cubic', name='')Source
Coil parameterized by spline points in X,Y,Z.
- Parameters:
current (float) – current through coil, in Amperes
X (array-like) – Points for X, Y, Z describing the curve. If the endpoint is included (ie, X[0] == X[-1]), then the final point will be dropped.
Y (array-like) – Points for X, Y, Z describing the curve. If the endpoint is included (ie, X[0] == X[-1]), then the final point will be dropped.
Z (array-like) – Points for X, Y, Z describing the curve. If the endpoint is included (ie, X[0] == X[-1]), then the final point will be dropped.
knots (ndarray) – arbitrary curve parameter values to use for spline knots, should be a monotonic, 1D ndarray of same length as the input X,Y,Z. If None, defaults to using an equal-arclength angle as the knots If supplied, will be rescaled to lie in [0,2pi]
method (str) –
method of interpolation
'nearest'
: nearest neighbor interpolation'linear'
: linear interpolation'cubic'
: C1 cubic splines (aka local splines)'cubic2'
: C2 cubic splines (aka natural splines)'catmull-rom'
: C1 cubic centripetal “tension” splines'cardinal'
: C1 cubic general tension splines. If used, default tension of c = 0 will be used'monotonic'
: C1 cubic splines that attempt to preserve monotonicity in the data, and will not introduce new extrema in the interpolated points'monotonic-0'
: same as ‘monotonic’ but with 0 first derivatives at both endpoints
name (str) – name for this curve
Methods
compute
(names[, grid, params, transforms, ...])Compute the quantity given by name on grid.
compute_Bnormal
(surface[, eval_grid, ...])Compute Bnormal from self on the given surface.
compute_magnetic_field
(coords[, params, ...])Compute magnetic field at a set of points.
copy
([deepcopy])Return a (deep)copy of this object.
equiv
(other)Compare equivalence between DESC objects.
flip
([normal])Flip the curve about the plane with specified normal.
from_values
(current, coords[, knots, ...])Create SplineXYZCoil from coordinate values.
load
(load_from[, file_format])Initialize from file.
pack_params
(p)Convert a dictionary of parameters into a single array.
rotate
([axis, angle])Rotate the curve by a fixed angle about axis in X, Y, Z coordinates.
save
(file_name[, file_format, file_mode])Save the object.
save_BNORM_file
(surface, fname[, basis_M, ...])Create BNORM-style .txt file containing Bnormal Fourier coefficients.
save_mgrid
(path, Rmin, Rmax, Zmin, Zmax[, ...])Save the magnetic field to an mgrid NetCDF file in "raw" format.
to_FourierXYZ
([N, grid, s, name])Convert coil to FourierXYZCoil representation.
to_SplineXYZ
([knots, grid, method, name])Convert coil to SplineXYZCoil.
translate
([displacement])Translate the curve by a rigid displacement in X, Y, Z.
Convert a single array of concatenated parameters into a dictionary.
Attributes
Number of knots in the spline.
Coordinates for X.
Coordinates for Y.
Coordinates for Z.
Current passing through the coil, in Amperes.
total number of optimizable parameters.
dictionary of integers of sizes of each optimizable parameter.
Knots for spline.
Method of interpolation to use.
Name of the curve.
string names of parameters that have been declared optimizable.
dictionary of arrays of optimizable parameters.
Rotation matrix of curve in X, Y, Z.
Displacement of curve in X, Y, Z.
arrays of indices for each parameter in concatenated array.