coilpy.pm4stell#

Some useful functions used for the PM4STELL project

coilpy.pm4stell.blocks2ficus(block_file, ficus_file, moment_file=None, dipole_file=None, magnitization=1100000.0, clip=None, **kwargs)[source]#

Convert PM4STELL blocks file to FICUS inputs

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

  • ficus_file (str) – FICUS input CSV filename.

  • moment_file (str, optional) – Moments file to assign the magnetic moment. Defaults to None.

  • dipole_file (str, optional) – FAMUS dipole file to assign the magnetic moment. Defaults to None.

  • magnitization (float, optional) – The magnetization of the material. Defaults to 1.1e6.

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

Returns:

Data in the format of pandas.DataFrame

Return type:

pandas.DataFrame

Note: This requires to load the MUSE package (tmqian/MUSE) to the sys.path.

Example

magnets = blocks2ficus(“magpie_trial104b_blocks.csv”, “trial104b_ficus.csv”, dipole_file=”disc_ftri_wp0_c9a_tr104b.focus”)

coilpy.pm4stell.blocks2vtk(block_file, vtk_file, moment_file=None, dipole_file=None, clip=0, **kwargs)[source]#

Write a VTK file from the blocks file

Parameters:
  • block_file (str) – File name and path to the blocks file.

  • vtk_file (str) – VTK file name to be saved.

  • moment_file (str, optional) – File name and path to the moments file. Defaults to None.

  • dipole_file (str, optional) – File name and path to the FAMUS dipole file (*.focus). Defaults to None.

  • clip (int, optional) – The threshold value to clip magents with rho>=clip. Defaults to 0.

Returns:

The constructed meshio.Mesh object.

Return type:

meshio.Mesh

coilpy.pm4stell.read_ansys_bfield(filename)[source]#