Skip to content

NcQfactor

dexter.NcQfactor(path: str, interp_type: Interp1DType)

Numerical q-factor reconstructed from a NetCDF file.

Related quantities are computed by interpolating over the data arrays.

Note

If either psi_norm or psip_norm is missing from the netCDF file, it is calculated from the other by integrating \(q(\psi_p)\) or \(\iota(\psi)\) respectively. In the case that the calculated values are monotonic, the other flux can be used as a flux coordinate as well.

Parameters:

  • path (str) –

    The path to the NetCDF file.

  • interp_type (Interp1DType) –

    The 1D Interpolation type.

Example
NcQfactor creation
>>> qfactor = dex.NcQfactor(path, "Steffen")

Methods:

Attributes:

dexter.NcQfactor.psi_state: FluxState property

The state of the toroidal flux coordinate.

dexter.NcQfactor.psip_state: FluxState property

The state of the poloidal flux coordinate.

dexter.NcQfactor.path: str property

The path of the netCDF file.

dexter.NcQfactor.netcdf_version: NetCDFVersion property

The netCDF convention version (SemVer).

dexter.NcQfactor.equilibrium_type: EquilibriumType property

The object's equilibrium's type.

dexter.NcQfactor.interp_type: str property

The Interpolation type.

dexter.NcQfactor.psi_last: float property

The value of the last closed toroidal flux surface \(\psi_{LCFS}\) in Normalized Units.

dexter.NcQfactor.psip_last: float property

The value of the last closed poloidal flux surface \(\psi_{p,LCFS}\) in Normalized Units.

dexter.NcQfactor.qlast: float property

The value of \(q\) at the last closed flux surface.

dexter.NcQfactor.qaxis: float property

The value of \(q\) on the magnetic axis.

dexter.NcQfactor.psi_array: Array1 property

The NetCDF \(\psi\) data.

dexter.NcQfactor.psip_array: Array1 property

The NetCDF \(\psi_p\) data.

dexter.NcQfactor.q_array: Array1 property

The NetCDF \(q\) data.

dexter.NcQfactor.q_of_psi(psi: ArrayLike) -> NDArray

The \(q(\psi)\) value.

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

dexter.NcQfactor.q_of_psip(psip: ArrayLike) -> NDArray

The \(q(\psi_p)\) value.

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

dexter.NcQfactor.dpsip_dpsi(psi: ArrayLike) -> NDArray

The derivative \(d\psi_p(\psi)/d\psi\) value in Normalized Units.

It's a good check that the values coincide with qfactor.iota_of_psi(psi).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

dexter.NcQfactor.dpsi_dpsip(psip: ArrayLike) -> NDArray

The derivative \(d\psi(\psi_p)/d\psi_p\) value in Normalized Units.

It's a good check that the values coincide with qfactor.q_of_psip(psip).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

dexter.NcQfactor.iota_of_psi(psi: ArrayLike) -> NDArray

The \(\iota(\psi) = \dfrac{1}{q(\psi)}\) value.

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

dexter.NcQfactor.iota_of_psip(psip: ArrayLike) -> NDArray

The \(\iota(\psi_p) = \dfrac{1}{q(\psi_p)}\) value.

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

dexter.NcQfactor.plot_q_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(q(\psi)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(q(\psi)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.plot_q_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(q(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(q(\psi_p)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.plot_dpsip_dpsi(points: int = 1000, show: bool = True) -> Canvas

Plots \(d\psi_p(\psi)/d\psi\) and \(\iota(\psi)\).

This is a check to make sure the two quantities do indeed overlap.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate the two splines. Defaults to 1000.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.plot_dpsi_dpsip(points: int = 1000, show: bool = True) -> Canvas

Plots \(d\psi(\psi_p)/d\psi_p\) and \(q(\psi_p)\).

This is a check to make sure the two quantities do indeed overlap.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate the two splines. Defaults to 1000.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.plot_iota_of_psi(points: int = 1000, show: bool = True) -> Canvas

Plots \(\iota(\psi)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\iota(\psi)\). Defaults to 1000.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.plot_iota_of_psip(points: int = 1000, show: bool = True) -> Canvas

Plots \(\iota(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\iota(\psi_p)\). Defaults to 1000.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.psip_of_psi(psi: ArrayLike) -> NDArray

The \(\psi_p(\psi)\) value in Normalized Units.

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

dexter.NcQfactor.psi_of_psip(psip: ArrayLike) -> NDArray

The \(\psi(\psi_p)\) value in Normalized Units.

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

dexter.NcQfactor.plot_psip_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi_p(\psi)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.plot_psi_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi(\psi_p)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcQfactor.psi_of_q(q: ArrayLike) -> NDArray

The toroidal flux \(\psi\) in Normalized Units.

Parameters:

  • q (ArrayLike) –

    The q-factor value \(q\).

dexter.NcQfactor.psip_of_q(q: ArrayLike) -> NDArray

The poloidal flux \(\psi_p\) in Normalized Units.

Parameters:

  • q (ArrayLike) –

    The q-factor value \(q\).