coilpy.focushdf5#

class coilpy.focushdf5.FOCUSHDF5(filename, periodic=False, **kwargs)[source]#

Bases: HDF5

FOCUS output hdf5 file

Bmod()[source]#
Bnorm(plottype='2D', source='all', axes=None, flip=False, **kwargs)[source]#

Plot Bn distribution.

Keyword Arguments:
  • '2D' (plottype -- string,) –

  • 'all' (source -- string, 'coil', 'plasma', 'sum' or) –

  • be (axes -- matplotlib.pyplot or mayavi.mlab axis, axis to) – plotted on (default None)

  • coil, (flip -- logical, determine how to calculate Bn from) – True: coil_Bn = Bn - plas_Bn; False: coil_Bn = Bn + plas_Bn

Returns:

obj – matplotlib.pyplot or mayavi.mlab plotting object

convergence(term='bnorm', iteration=True, axes=None, **kwargs)[source]#
curvature(iteration=True, vlines=True, shift_ind=0, icoil=1, NS=128)[source]#

Curvature ploting for the FOCUS-spline paper [arXiv:2107.02123] by N. Lonigro

Parameters:
  • iteration (bool, optional) – [description]. Defaults to True.

  • vlines (bool, optional) – [description]. Defaults to True.

  • shift_ind (int, optional) – [description]. Defaults to 0.

  • icoil (int, optional) – [description]. Defaults to 1.

  • NS (int, optional) – [description]. Defaults to 128.

Returns:

[description]

Return type:

[type]

iota_plot(axes=None, **kwargs)[source]#

Plot the rotational transform profile

Parameters:
  • axes (matplotlib.pyplot.axis, optional) – axis to be plotted on. Defaults to None.

  • kwargs (optional) – Keyword arguments passed to matplotlib.pyplot.plot, e.g. color=’r’.

Returns:

The updated axis

Return type:

matplotlib.pyplot.axis

plot(engine='plotly', scalars='bn', fig=None, ax=None, show=True, **kwargs)[source]#

Plot 3D field on the plasma from FOCUS ouput

Parameters:
  • engine (str, optional) – 3D plot engine, one of [“mayavi”, “pyplot”, “plotly”]. Defaults to “plotly”.

  • scalars (str, optional) – Scalar function on the surface, one of [“Bn”, “B”, “plas_Bn”] or 2D arrays. Defaults to “bn”.

  • fig (, optional) – Figure to be plotted on. Defaults to None.

  • ax (, optional) – Axis to be plotted on. Defaults to None.

  • show (bool, optional) – If show the plotly figure immediately. Defaults to True.

  • kwargs – optional keyword arguments for plotting.

Raises:

ValueError – Plot engine should be one value of [“mayavi”, “pyplot”, “plotly”].

poincare_plot(color=None, prange='full', **kwargs)[source]#

Poincare plot from FOCUS output. :param color: dot colors. Defaults to None (rainbow). :type color: matplotlib color, or None :param prange: Plot range, one of [“upper”, “lower”, “all”]. Defaults to “full”. :type prange: str, optional :param kwargs: matplotlib scatter keyword arguments

Returns:

None

toVTK(name=None, full=False, **kwargs)[source]#

Save surface and magnetic field data into VTK file :param name – string: None, if None, using self.filename :param VTK file name. default: None, if None, using self.filename :param full – boolean: :param if save the entire torus: :param **kwargs – external data will be saved in VTK file:

Returns:

VTK file name