Magnetic Fields¶
Objects for creating magnetic field objects, along with some common components.
Overview¶
|
Base magnetic field class |
Spatially constant magnetic field |
|
|
Spherical quadrupole magnetic field |
|
Ioffe-Pritchard trap magnetic field |
Details¶
- class pylcp.magField(field, eps=1e-05)[source]¶
Base magnetic field class
Stores a magnetic defined magnetic field and calculates useful derivatives for pylcp.
- Parameters
field (array_like with shape (3,) or callable) – If constant, the magnetic field vector, specified as either as an array_like with shape (3,). If a callable, it must have a signature like (R, t), (R), or (t) where R is an array_like with shape (3,) and t is a float and it must return an array_like with three elements.
eps (float, optional) – Small distance to use in calculation of numerical derivatives. By default eps=1e-5.
- eps¶
small epsilon used for computing derivatives
- Type
float
- FieldMag(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Magnetic field magnitude at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
B – the magnetic field mangitude at position R and time t.
- Return type
float
- gradField(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Full spaitial derivative of the magnetic field at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – the full gradient of the magnetic field, with elements
\[\begin{split}\begin{pmatrix} \frac{dB_x}{dx} & \frac{dB_y}{dx} & \frac{dB_z}{dx} \\ \frac{dB_x}{dy} & \frac{dB_y}{dy} & \frac{dB_z}{dy} \\ \frac{dB_x}{dz} & \frac{dB_y}{dz} & \frac{dB_z}{dz} \\ \end{pmatrix}\end{split}\]- Return type
array_like, shape (3, 3)
Notes
This method calculates the derivative stupidly, just using first order numerical differentiation using the eps parameter.
- gradFieldMag(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Gradient of the magnetic field magnitude at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – \(\nabla|B|\), the gradient of the magnetic field magnitude at position \(R\) and time \(t\).
- Return type
array_like, shape (3,)
- class pylcp.constantMagneticField(B0)[source]¶
Spatially constant magnetic field
Represents a magnetic field of the form
\[\mathbf{B} = \mathbf{B}_0\]
- Parameters
val (array_like with shape (3,)) – The three-vector defintion of the constant magnetic field.
- gradField(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Gradient of the magnetic field magnitude at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – \(\nabla|B|=0\), the gradient of the magnitude of a constant magnetic field is always zero.
- Return type
np.zeros((3,))
- gradFieldMag(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Gradient of the magnetic field magnitude at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – The gradient of a constant magnetic field magnitude is always zero.
- Return type
np.zeros((3,))
- class pylcp.quadrupoleMagneticField(alpha, eps=1e-05)[source]¶
Spherical quadrupole magnetic field
Represents a magnetic field of the form
\[\mathbf{B} = \alpha\left(- \frac{x\hat{x}}{2} - \frac{y\hat{y}}{2} + z\hat{z}\right)\]
- Parameters
alpha (float) – strength of the magnetic field gradient.
- gradField(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Full spaitial derivative of the magnetic field at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – the full gradient of the magnetic field, with elements
\[\begin{split}\begin{pmatrix} -\alpha/2 & 0 & 0 \\ 0 & -\alpha/2 & 0 \\ 0 & 0 & \alpha \\ \end{pmatrix}\end{split}\]- Return type
array_like, shape (3, 3)
- class pylcp.iPMagneticField(B0, B1, B2, eps=1e-05)[source]¶
Ioffe-Pritchard trap magnetic field
Generates a magnetic field of the form
\[\mathbf{B} = B_1 x \hat{x} - B_1 y \hat{y} + \left(B_0 + \frac{B_2}{2}z^2\right)\hat{z}\]
- Parameters
B0 (float) – Constant offset field
B1 (float) – Magnetic field gradient in x-y plane
B2 (float) – Magnetic quadratic component along z direction.
Notes
It is currently missing extra terms that are required for it to fulfill Maxwell’s equations at second order.
- gradField(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Full spaitial derivative of the magnetic field at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – the full gradient of the magnetic field, with elements
\[\begin{split}\begin{pmatrix} \frac{dB_x}{dx} & \frac{dB_y}{dx} & \frac{dB_z}{dx} \\ \frac{dB_x}{dy} & \frac{dB_y}{dy} & \frac{dB_z}{dy} \\ \frac{dB_x}{dz} & \frac{dB_y}{dz} & \frac{dB_z}{dz} \\ \end{pmatrix}\end{split}\]- Return type
array_like, shape (3, 3)
Notes
This method calculates the derivative stupidly, just using first order numerical differentiation using the eps parameter.
- gradFieldMag(R=array([0.0, 0.0, 0.0]), t=0)[source]¶
Gradient of the magnetic field magnitude at R and t:
- Parameters
R (array_like, size (3,), optional) – vector of the position at which to return the kvector. By default, the origin.
t (float, optional) – time at which to return the k-vector. By default, t=0.
- Returns
dB – \(\nabla|B|\), the gradient of the magnetic field magnitude at position \(R\) and time \(t\).
- Return type
array_like, shape (3,)