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
R (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Major radius position at which to get magnetic field strength.
z (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – The vertial position at which to get the magnetic field strength.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times at which to get the magnetic field strength. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Flux values for the locations.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times at which to get the major radius. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Flux values for the locations.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times at which to get the major radius. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Input flux surface coordinate.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times for conversions. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
from_kind (Optional[str]) – The type of flux surfaces used for the input coordinates. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
to_kind (Optional[str]) – The type of flux surfaces on which to calculate the output coordinates. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Values of rho at which to calculate the cross-sectional area.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Values of time at which to calculate the cross-sectional area.
ntheta (int) – Number subdivisions of 2 * pi to integrate over for the cross- sectional area.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Flux surfaces to get the enclosed volumes for.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times at which to get the enclosed volume. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
R (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Major radius positions.
z (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Vertical positions.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times for conversions. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
vol (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Volumes of space enclosed by the flux surfaces.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times at which to get the enclosed volume. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Flux surfaces on which the locations fall.
theta (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Poloidal positions on which the locations fall.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times at which to get the minor radius. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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
rho (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Flux surface coordinate.
theta (Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]) – Angular position.
t (Optional[Union[float, int, numpy.ndarray, xarray.core.dataarray.DataArray, xarray.core.dataset.Dataset, xarray.core.variable.Variable]]) – Times for conversions. Defaults to the time range specified when equilibrium object was instantiated and frequency the equilibrium data was calculated at.
kind (str) – The type of flux surface to use. May be “toroidal”, “poloidal”, plus optional extras depending on implementation.
- 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]]