jax_sbgeom.coils.discrete_coil module

class DiscreteCoil(positions: Array, _centre_i: Array)[source]

Bases: Coil

Class representing a coil defined by discrete positions and a centre. This centre is precomputed from the given positions. It does not feature in the computation of the coil positions; only the centre.

positions: Array
classmethod from_positions(positions: Array)[source]

Create a DiscreteCoil from discrete positions

Positions are assumed to be non-periodic (in other words, the first and last point are not equal).

Parameters:

positions (Array) – Cartesian positions of discrete coil points […, 3]

Returns:

DiscreteCoil object

Return type:

DiscreteCoil

length(n_samples: int = None)[source]

Length of the closed polyline through the discrete positions (exact; n_samples is unused).

centroid(n_samples: int = None)[source]

Length-weighted centroid of the closed polyline (exact: segment midpoints weighted by segment length; n_samples is unused).

bounding_box(n_samples: int = None)[source]

Bounding box (min, max) of the closed polyline: the extrema of a piecewise linear curve are at the vertices (exact; arguments unused).

curvature(s)[source]

Curvature kappa = |x' x x''| / |x’|^3 (1/m) of the space curve, independent of the parametrisation. Returns an array of the shape of s.

position(s)[source]

Position along the coil as a function of arc length

Parameters:

s (jnp.ndarray) – Arc length(s) along the coil

Returns:

Cartesian position(s) along the coil

Return type:

jnp.ndarray

tangent(s)[source]

Tangent vector along the coil as a function of arc length

Parameters:

s (jnp.ndarray) – Arc length(s) along the coil

Returns:

Tangent vector(s) along the coil

Return type:

jnp.ndarray

centre()[source]

Centre of the coil

Returns:

Centre of the coil

Return type:

jnp.ndarray

normal(s)[source]

Normal vector along the coil as a function of arc length Not defined for DiscreteCoil

Parameters:

s (jnp.ndarray) – Arc length(s) along the coil

Returns:

Normal vector(s) along the coil (jnp.nan)

Return type:

jnp.ndarray

reverse_parametrisation()[source]

Reverse the parametrisation of the discrete coil. Reverses all points except the first (s=0 remains s=0).