equilibrium Module

Contains an abstract base class for reading equilibrium data for a pulse.

class indica.equilibrium.Equilibrium(equilibrium_data, T_e=None, R_shift=0.0, z_shift=0.0, sess=<indica.session.Session object>, offset_picker=<function interactive_offset_choice>)[source]

Class to hold and interpolate equilibrium data.

At instantiation it will require calibration to select an offset along the major radius. Electron temperature data is provided for this purpose. Once calibrated, the electron temperature at normalised flux surface rho = 1 should be about 100eV.

Parameters
  • equilibrium_data (Dict[str, DataArray]) – A collection of equilibrium data rea in using get_equilibrium(). TODO: List full set of required quantities.

  • T_e (Optional[DataArray]) – Electron temperature data (from HRTS on JET). If present, used to compute an offset of the equilibrium along the major radius.

  • R_shift (float) – How much to shift the equilibrium profile inwards on the major radius. Ignored if T_e is also passed as an argument.

  • z_shift (flaot) – How much to shift the equilibrium profile downwards in the vertical coordinate.

  • sess (session.Session) – An object representing the session being run. Contains information such as provenance data.

  • offset_picker (OffsetPicker) – A callback which determines by how much to offset the equilibrium data along the major radius. Allows the user to select this interactively.

Btot(R, z, t=None)[source]

Total magnetic field strength at this location in space.

Parameters
Returns

  • Btot – Total magnetic field strength at the given location and times.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

R_hfs(rho, t=None, kind='poloidal')[source]
Major radius position of the given flux surface on the High Flux

Side of the magnetic axis.

Parameters
Returns

  • R_hfs – Major radius on the HFS for the given flux surfaces.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

R_lfs(rho, t=None, kind='poloidal')[source]
Major radius position of the given flux surface on the Low Flux

Side of the magnetic axis.

Parameters
Returns

  • R_lfs – Major radius on the LFS for the given flux surfaces.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

convert_flux_coords(rho, t=None, from_kind='poloidal', to_kind='toroidal')[source]

Convert between different coordinate systems.

Parameters
Returns

  • rho – New flux surface for each position.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

cross_sectional_area(rho, t=None, ntheta=12, kind='poloidal')[source]

Calculates the cross-sectional area inside the flux surface rho and at given time t.

Parameters
Returns

  • area – Cross-sectional areas calculated at rho and t.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[xarray.core.dataarray.DataArray, Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

enclosed_volume(rho, t=None, kind='poloidal')[source]

Returns the volume enclosed by the specified flux surface.

Parameters
Returns

  • vol – Volumes of space enclosed by the flux surfaces.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[xarray.core.dataarray.DataArray, xarray.core.dataarray.DataArray, Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

flux_coords(R, z, t=None, kind='poloidal')[source]

Convert to the flux surface coordinate system.

Parameters
Returns

  • rho – Flux surface for each position.

  • theta – Poloidal angle along flux surfaces.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

invert_enclosed_volume(vol, t=None, kind='poloidal')[source]

Returns the value of the flux surface enclosing the specified volume.

Parameters
Returns

  • rho – Flux surfaces for the enclosed volumes.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

minor_radius(rho, theta, t=None, kind='poloidal')[source]

Minor radius at the given locations in the tokamak.

Parameters
Returns

  • minor_radius – Minor radius of the locations.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[xarray.core.dataarray.DataArray, Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]

spatial_coords(rho, theta, t=None, kind='poloidal')[source]

Convert to the spatial coordinate system.

Parameters
Returns

  • R – Major radius positions.

  • z – Vertical positions.

  • t – If t was not specified as an argument, return the time the results are given for. Otherwise return the argument.

Return type

Tuple[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable], Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]