libs.elements.magnets package

Submodules

libs.elements.magnets.CuboidMagnet module

class libs.elements.magnets.CuboidMagnet.CuboidMagnet(pos: ndarray, rot: ndarray, dim: ndarray, direction: ndarray, m: float, mu_r: float, temperature: float, tk: float, maxh: float)

Bases: Magnet

Subclass of magnets in cylinder shape. Inherits from the Magnet parent class.

Parameters:
  • rot (numpy.ndarray) – Rotation of the magnet in the 3D space in radians. The magnetic field points along the body-fixed z-axis.

  • dim (numpy.ndarray) – Dimension of the cuboid along the body-fixed coordinate axes.

  • direction (np.ndarray) – Direction of the magnetic field.

  • transformation_matrix (numpy.ndarray) – The transformation matrix to transform the global coordinate system to the body-fixed coordinate system with direction of the magnetisation pointing along the body-fixed z-axis.

  • m_vec (numpy.ndarray) – Magnetisation of the magnet along the three global coordinate axes.

convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

dim: ndarray
direction: ndarray
classmethod from_dict(dictionary: Dict[any]) CuboidMagnet
Method to init an instance of the Gear class by passing a dictionary with the corresponding

arguments. Arguments that are in the dictionary and not in the class are ignored while arguments missing in the dictionary get initialised with the standard values defined in the template class method.

Returns:

Instance of the CuboidMagnet class.

Return type:

CuboidMagnet

get_transformation_matrix() ndarray
Method for calculating the transformation matrix to transform the global coordinate system into the

body-fixed coordinate system.

Returns:

The transformation matrix.

Return type:

numpy.ndarray

gui() CuboidMagnet

Returns a copy of the class with attributes converted to units used in the gui.

gui_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

m_vec: ndarray
reset()

Calls the init method with the actual class attributes.

rot: ndarray
classmethod template() CuboidMagnet

Class method to init the class with a set of standard values.

Returns:

Object of the CuboidMagnet class.

Return type:

CuboidMagnet

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

transformation_matrix: ndarray

libs.elements.magnets.MagnetTemplate module

class libs.elements.magnets.MagnetTemplate.MagnetTemplate(*args, **kwargs)

Bases: Magnet

convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

classmethod from_dict(dictionary: Dict[any]) MagnetTemplate
Method to init an instance of the MagnetTemplate class by passing a dictionary with the corresponding

arguments.

Returns:

Instance of the MagnetTemplate class.

Return type:

MagnetTemplate

gui() MagnetTemplate

Returns a copy of the class with attributes converted to units used in the gui.

Returns:

Object of the MagnetTemplate class.

Return type:

SensorTemplate

gui_dict() Dict[str, any]

Method creates a dictionary of the class members that will be stored in the ini file. Variables not passed to the init method are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

reset() None

Calls the init method with the actual class attributes.

classmethod template() MagnetTemplate

Class method to init the class with a set of default values.

Returns:

Object of the MagnetTemplate class.

Return type:

SensorTemplate

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

libs.elements.magnets.RodMagnet module

class libs.elements.magnets.RodMagnet.RodMagnet(pos: ndarray, axis: ndarray, direction: ndarray, radius: float, length: float, m: float, mu_r: float, temperature: float, tk: float, maxh: float)

Bases: Magnet

Subclass of magnets in rod shape. Inherits from the Magnet parent class.

Parameters:
  • axis (numpy.ndarray) – Longitudinal axis of the rod. The magnetic field points along the axis determined by this parameter.

  • direction (np.ndarray) – Direction of the magnetic field.

  • radius (float) – Radius of the rod.

  • length (float) – Length of the rod.

  • m (numpy.ndarray) – Magnetisation of the magnet along the rod high axis.

axis: ndarray
convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

direction: ndarray
classmethod from_dict(dictionary: Dict[any]) RodMagnet
Method to init an instance of the Gear class by passing a dictionary with the corresponding

arguments. Arguments that are in the dictionary and not in the class are ignored while arguments missing in the dictionary get initialised with the standard values defined in the template class method.

Returns:

Instance of the RodMagnet class.

Return type:

RodMagnet

gui() RodMagnet

Returns a copy of the class with attributes converted to units used in the gui.

gui_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

length: float
m: float
radius: float
reset()

Calls the init method with the actual class attributes.

classmethod template() RodMagnet

Class method to init the class with a set of standard values.

Returns:

Object of the RodMagnet class.

Return type:

RodMagnet

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

libs.elements.magnets.UniField module

class libs.elements.magnets.UniField.UniField(direction: ndarray, strength: float)

Bases: object

Holds the parameters of a uniform magnetic field and creates the related B-Field.

This field is then superimposed with the fields emanating from the magnets in the simulation.

Parameters:
  • direction (numpy array [1, 3] (float)) – The direction of the uniform magnetic field.

  • strength (float) – The strength of the uniform magnetic field.

  • mu0 (float) – Magnetic field constant.

  • h_vec (numpy.ndarray) – Vector of the uniform magnetic field.

  • b_vec (numpy.ndarray) – Vector of the uniform magnetic flux density.

b_vec: ndarray
convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

direction: ndarray
classmethod from_dict(dictionary: Dict[any]) UniField
Method to init an instance of the Gear class by passing a dictionary with the corresponding

arguments. Arguments that are in the dictionary and not in the class are ignored while arguments missing in the dictionary get initialised with the standard values defined in the template class method.

Returns:

Instance of the UniField class.

Return type:

UniField

gui() UniField

Returns a copy of the class with attributes converted to units used in the gui.

gui_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

h_vec: ndarray
mu0: float
reset()

Calls the init method with the actual class attributes.

strength: float
classmethod template() UniField

Class method to init the class with a set of standard values.

Returns:

Object of the UniField class.

Return type:

UniField

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

Module contents