coilpy.magtense_interface#

coilpy.magtense_interface.blocks2tiles(block_file, dipole_file, clip=0, mu=(1.05, 1.05), **kwargs)[source]#

Construct magtense.Tiles from PM4STELL blocks file

Parameters:
  • block_file (str) – Path and file name to the blocks file (usually contains _blocks.csv).

  • dipole_file (str) – FAMUS dipole file to assign the magnetic moment.

  • clip (float, optional) – The minimum rho value to preserve. Defaults to 0.

  • mu (tuple, optional) – Magnetic permeability in the parallel and perpendicular direction. Defaults to (1.05, 1.05).

Returns:

Prisms in the type of magtense.Titles.

Return type:

prism (magtense.Tiles)

coilpy.magtense_interface.build_prism(lwh, center, rot, mag_angle, mu, remanence)[source]#

Construct a prism in magtense.Tiles.

Parameters:
  • center (array-like) – The centers of the prisms.

  • rot (array-like) – The rotation angles around x,y,z-axis of the prisms.

  • lwh (array-like) – The dimensions of the prism in length, width, height.

  • mag_angle (array-like) – Magnetization angle in spherical coordinates.

  • mu (array-like) – Permeability in the parallel and perpendicular direction.

  • remanence (float or array-like) – Magnetic remanence.

Returns:

Prisms in the type of magtense.Titles.

Return type:

prism (magtense.Titles)

coilpy.magtense_interface.corner2tiles(corner_file, dipole_file, clip=0, mu=(1.05, 1.05), **kwargs)[source]#

Construct magtense.Tiles from MUSE corner file

Parameters:
  • corner_file (str) – Path and file name to the corner file (usually contains _corner.csv).

  • dipole_file (str) – FAMUS dipole file to assign the magnetic moment.

  • clip (float, optional) – The minimum rho value to preserve. Defaults to 0.

  • mu (tuple, optional) – Magnetic permeability in the parallel and perpendicular direction. Defaults to (1.05, 1.05).

Returns:

Prisms in the type of magtense.Titles.

Return type:

prism (magtense.Tiles)

coilpy.magtense_interface.get_center(top, bot)[source]#

Get geometry information from 8 vertices of a prism.

Parameters:
  • top (numpy.ndarray) – Vertices of the top surface, in shape of (4,3).

  • bot (numpy.ndarray) – Vertices of the bottom surface, in shape of (4,3).

Returns:

The center of the prism. rot (numpy.ndarray): The rotation angles around x,y,z-axis of the prism. lwh (numpy.ndarray): The dimension of the prism in length, width, height.

Return type:

center (numpy.ndarray)

coilpy.magtense_interface.get_rotmat(rot)[source]#

Rotation matrix in the order of x,y,z

Parameters:

rot (list,(3,)) – Rotation angle around x,y,z-axis.

Returns:

The 3X3 rotation matrix.

Return type:

numpy.ndarray

coilpy.magtense_interface.magtense2vtk(mags, vtk_file, **kwargs)[source]#

Export magtense.Tiles to VTK

Parameters:
  • mags (magtense.Tiles) – Magnet prisms in magtense.Tiles.

  • vtk_file (str) – VTK file name.

  • kwargs (optional) – keyword arguments passed to meshio.Mesh(), e.g. , cell_data={“m”:[m]}

Returns:

The constructed meshio.Mesh object.

Return type:

meshio.Mesh

coilpy.magtense_interface.muse2magntense(muse_file, mu=(1.05, 1.05), magnetization=1160000.0, **kwargs)[source]#