coil_utils module

Calculate the magnetic field from a arbitrary current loop and a anti-helmholtz coil.

coil_utils.field_anti_helmholtz(coil_turns, R, D, I, r)

Calculate field inside anti-helmholtz coils.

Their normal vector points in the z direction.

First coil is in the position [0, 0, D] and its normal vector n points in the +z direction. The current I direction follows the right hand-rule regarding the normal vector.

Parameters
  • coil_turns – number of turns in the coil.

  • R – coil radius in m.

  • D – distance between the coordinate system and the coils in m.

  • I – electric current in A.

  • r – position vector r in the space to evaluate B field

Returns

vector representing B field in position r (in Tesla).

coil_utils.field_loop(r, r0, n, R, I)

Return the magnetic field from an arbitrary current loop.

See eqns (1) and (2) in Phys Rev A Vol. 35, N 4, pp. 1535-1546; 1987.

Parameters
  • r (list [x y z]) –

    Position vector where the magnetc field is to be evaluated,

    where x, y, z in meters.

  • r0 (list [x y z]) – Position vector of the loop center, where x, y, z in meters.

  • n (list [x y z]) – Normal vector of loop plane at its center. Current I is oriented by the right-hand-rule.

  • R (float) – Radius of the loop in meters.

  • I (float) – Electrical current in A.

Returns

Magnetic field vector at point r in Tesla.

Return type

numpy array [x y z]