pyrokinetics.diagnostics.Diagnostics#

class pyrokinetics.diagnostics.Diagnostics(pyro)[source]#

Bases: object

Contains all the diagnistics that can be applied to simulation output data.

Currently, this class contains only the function to generate a Poincare map, but new diagnostics will be available in future.

Please call “load_gk_output” before attempting to use any diagnostic

Parameters:

pyro (Pyro object containing simulation output data (and geometry))

__init__(pyro)[source]#
Parameters:

pyro (Pyro)

Methods

__init__(pyro)

bicoherence(fluctuation[, ...])

Perform bicoherence analysis for a given DataArray

cross_bicoherence(fluctuation1, ...[, ...])

Perform cross bicoherence analysis for a given DataArray

gs2_geometry_terms([ntheta_multiplier])

ideal_ballooning_solver([theta0])

Adapted from ideal-ballooning-solver rahulgaur104/ideal-ballooning-solver

bicoherence(fluctuation, wavenumber_tolerance=1e-05, stationary=True)[source]#

Perform bicoherence analysis for a given DataArray

Bispectrum given by:

\[Bi(k_{x,1}, k_{y,1}, k_{x,2}, k_{y,2}) = \langle f_1 * f_2 * f_3^\dagger\rangle_{t}\]

The bicoherence is normalised to

\[b^2 = \frac{|Bi|^2}{\langle|f_1 * f_2|^2\rangle_{t} \langle|f_3|^2\rangle_{t}}\]

where

\[f_1 = fluctuation(k_{x,1}, k_{y,1}, t)\]
\[f_2 = fluctuation(k_{x,2}, k_{y,2}, t)\]
\[f_3 = fluctuation(k_{x,3}, k_{y,3}, t)\]

with \(\langle\rangle_{t}\) being an average over time

where \(k_{x,3} = k_{x,1}+k_{x,2}\) \(k_{y,3} = k_{y,1}+k_{y,2}\)

Parameters:
  • fluctuation (xr.DataArray) – Fluctuation dataset which must be a DataArray with dimensions (\(k_x\), \(k_y\), \(t\))

  • wavenumber_tolerance (float) – Tolerance to find matching wavenumbers in \(k_{x,3}, k_{y,3}\)

Returns:

data – Dataset with DataArray of bicoherence and phase with dimensions (\(k_{x,1}\), \(k_{y,1}\),:math:k_{x,2}, \(k_{y,2}\))

Return type:

xr.Dataset

cross_bicoherence(fluctuation1, fluctuation2, fluctuation3, wavenumber_tolerance=1e-05, stationary=True)[source]#

Perform cross bicoherence analysis for a given DataArray

Bispectrum given by:

\[Bi(k_{x,1}, k_{y,1}, k_{x,2}, k_{y,2}) = \langle f_1 * f_2 * f_3^\dagger\rangle_{t}\]

The bicoherence is normalised to

\[b^2 = \frac{|Bi|^2}{\langle|f_1 * f_2|^2\rangle_{t} \langle|f_3|^2\rangle_{t}}\]

where

\[f_1 = fluctuation1(k_{x,1}, k_{y,1}, t)\]
\[f_2 = fluctuation2(k_{x,2}, k_{y,2}, t)\]
\[f_3 = fluctuation3(k_{x,3}, k_{y,3}, t)\]

with \(\langle\rangle_{t}\) being an average over time

where \(k_{x,3} = k_{x,1}+k_{x,2}\) \(k_{y,3} = k_{y,1}+k_{y,2}\)

Parameters:
  • fluctuation1 (xr.DataArray) – First fluctuation dataset which must be a DataArray with dimensions (\(k_x\), \(k_y\), \(t\))

  • fluctuation2 (xr.DataArray) – Second fluctuation dataset which must be a DataArray with dimensions (\(k_x\), \(k_y\), \(t\))

  • fluctuation3 (xr.DataArray) – Third fluctuation dataset which must be a DataArray with dimensions (\(k_x\), \(k_y\), \(t\))

  • wavenumber_tolerance (float) – Tolerance to find matching wavenumbers in \(k_{x,3}, k_{y,3}\)

Returns:

data – Dataset with DataArray of cross-bicoherence and phase with dimensions (\(k_{x,1}\), \(k_{y,1}\),:math:k_{x,2}, \(k_{y,2}\))

Return type:

xr.Dataset

gs2_geometry_terms(ntheta_multiplier=1)[source]#
Parameters:

ntheta_multiplier (int)

ideal_ballooning_solver(theta0=0.0)[source]#

Adapted from ideal-ballooning-solver rahulgaur104/ideal-ballooning-solver

Parameters:

theta0 (float) – Ballooning angle

Returns:

gamma – Ideal ballooning growth rate

Return type:

Float