coilpy.booz_xform#

class coilpy.booz_xform.BOOZ_XFORM(*args, **kwargs)[source]#

Bases: SortedDict

static from_vmec(wout, mbooz=0, nbooz=0, surfaces=[])[source]#

Prepare BOOZ_XFORM input file from VMEC wout file

Parameters:
  • wout (str) – VMEC wout filename.

  • mbooz (int, optional) – Maximum poloildal mode number. Defaults to 0 (4*Mpol).

  • nbooz (int, optional) – Maximum toroidal mode number. Defaults to 0 (4*Ntor).

  • surfaces (list, optional) – Flux surfaces list. Defaults to [] (1:NS).

plot(ordering=0, mn=(None, None), ax=None, log=True, normalize=True, logical_not=False, **kwargs)[source]#

Plot |B| components 1D profile

Parameters:
  • ordering (integer, optional) – Plot the leading Nordering asymmetric modes. Defaults to 0.

  • mn (tuple, optional) – Plot the particular (m,n) mode. Defaults to (None, None).

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

  • log (bool, optional) – Plot in log scale. Defaults to True.

  • normalize (bool, optionl) – Normalized to B_00. Defaults to True.

  • logical_not (bool, optional) – Unselect mn modes. Defaults to False.

  • kwargs (dict) – Keyword arguments for matplotlib.pyplot.plot. Defaults to {}.

Returns:

Matplotlib axis plotted on.

Return type:

ax (Matplotlib axis)

plot2d(ns=-1, npol=128, ntor=128, ax=None, contour=True, **kwargs)[source]#

Plot |B| contour on the flux surface

Parameters:
  • ns (int, optional) – Flux surface index in self.jlist. Defaults to -1.

  • npol (int, optional) – Poloidal resolution. Defaults to 128.

  • ntor (int, optional) – Toroidal resolution. Defaults to 128.

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

  • contour (bool, optional) – Whether plotting the contour lines. Defaults to True.

Returns:

Matplotlib axis plotted on.

Return type:

ax (Matplotlib axis)

static plot_helicity(vals, xm, xn, xx, ordering=0, mn=(None, None), ax=None, log=False, normalize=False, logical_not=False, **kwargs)[source]#
to_FOCUS(ns=-1, focus_file='plasma.boundary', tol=1e-08, iota=None)[source]#

Write a FOCUS plasma boundary file in Boozer coordinates

Parameters:
  • ns (int, optional) – Flux surface label to be exported. Defaults to -1.

  • focus_file (str, optional) – FOCUS plasma boundary file name. Defaults to ‘plasma.boundary’.

  • tol (float, optional) – Truncated tolerance. Defaults to 1.0E-8.

  • iota (float, optional) – The target iota to be extracted. Defaults to None.

static write_input(extension, mbooz, nbooz, surfaces)[source]#

Write a BOO_XFORM input file

Parameters:
  • extension (str) – VMEC output extension.

  • mbooz (int) – Maximum poloidal mode.

  • nbooz (int) – Maximum toroidal mode

  • surfaces (list) – List of flux surfaces.