Analysis of edge profile inference results
The pedinf.analysis module provides tools for analysis and post-processing
of inferred electron temperature and density profiles.
Inferring the separatrix given a temperature
If the separatrix temperature has been estimated, for example
via power-balance analysis, the separatrix_given_temperature
function can be used to infer the separatrix radius, density
and pressure.
- pedinf.analysis.separatrix_given_temperature(ne_profile_samples: ndarray, te_profile_samples: ndarray, model: ProfileModel, te_sep: float = None, te_sep_error: float = None, te_sep_samples: ndarray = None) dict
Given an estimated separatrix electron temperature (and optionally an associated uncertainty) this function estimates the separatrix major radius, electron density and electron pressure.
- Parameters
ne_profile_samples – A set of sampled parameters of a profile model from
pedinf.modelsrepresenting possible electron density edge profiles. The samples should be given as anumpy.ndarrayof shape(n, m)wherenis the number of samples andmis the number of model parameters.te_profile_samples – A set of sampled parameters of a profile model from
pedinf.modelsrepresenting possible electron temperature edge profiles. The samples should be given as anumpy.ndarrayof shape(n, m)wherenis the number of samples andmis the number of model parameters.model – An instance of one of the model classes from
pedinf.models.te_sep – The electron temperature value for which the corresponding major radius, electron density and electron pressure will be estimated.
te_sep_error – The Gaussian uncertainty on the given value of
te_sep.te_sep_samples – Samples of the separatrix temperature value. This allows non-gaussian uncertainties on the separatrix temperature to included in the analysis. Specifying
te_sep_samplesoverrides any values given to thete_seporte_sep_errorarguments, which will be ignored. The number of separatrix temperature samples given must be equal to the number of profile samples.
- Returns
A dictionary containing the mean and standard-deviation for the separatrix major radius, separatrix electron density, and separatrix electron pressure. The keys are
R_mean, ne_mean, pe_meanfor the means, andR_std, ne_std, pe_stdfor the standard-deviations.
Inferring the separatrix given a scaling
Given a scaling which predicts the separatrix electron temperature
as a function of the separatrix electron density (e.g. from modelling),
the separatrix_given_scaling function can be used to infer the
separatrix radius, temperature, density and pressure.
- pedinf.analysis.separatrix_given_scaling(ne_profile_samples: ndarray, te_profile_samples: ndarray, model: ProfileModel, separatrix_scaling: callable, radius_limits=(1.2, 1.6))
Given a scaling function which specifies the separatrix temperature as a function of the separatrix density, estimate the mean and standard-deviation of the separatrix radius and separatrix electron density, temperature and pressure.
- Parameters
ne_profile_samples – A set of sampled parameters of a profile model from
pedinf.modelsrepresenting possible electron density edge profiles. The samples should be given as anumpy.ndarrayof shape(n, m)wherenis the number of samples andmis the number of model parameters.te_profile_samples – A set of sampled parameters of a profile model from
pedinf.modelsrepresenting possible electron temperature edge profiles. The samples should be given as anumpy.ndarrayof shape(n, m)wherenis the number of samples andmis the number of model parameters.model – An instance of one of the model classes from
pedinf.models.separatrix_scaling (callable) – A callable which maps a given separatrix density to a corresponding separatrix temperature. It must take an array of electron density values as its only argument.
radius_limits – A tuple specifying the range of radius values used to search for the separatrix position in the form
(lower_limit, upper_limit).
- Returns
A dictionary containing the mean and standard-deviation for the separatrix major radius, and separatrix electron temperature, density and pressure. The keys are
R_mean, te_mean, ne_mean, pe_meanfor the means, andR_std, te_std, ne_std, pe_stdfor the standard-deviations.
Inferring the pressure profile
The pressure_profile_and_gradient function generates a sample
of pressure and pressure gradient profiles and associated means and
highest-density intervals.
- pedinf.analysis.pressure_profile_and_gradient(radius: ndarray, ne_profile_samples: ndarray, te_profile_samples: ndarray, model: ProfileModel) Tuple[PlasmaProfile, PlasmaProfile]
Calculates the electron pressure and pressure gradient profiles at specified major radius positions, given samples of the edge electron temperature and density profiles.
It is assumed that the electron temperatures and densities have units of \(eV\) and \(m^{-3}\) respectively, and the returned electron pressure will have units of \(N / m^2\).
- Parameters
radius – Major radius values at which to evaluate the pressure profiles as a
numpy.ndarray.ne_profile_samples – A set of sampled parameters of a profile model from
pedinf.modelsrepresenting possible electron density edge profiles. The samples should be given as anumpy.ndarrayof shape(n, m)wherenis the number of samples andmis the number of model parameters.te_profile_samples – A set of sampled parameters of a profile model from
pedinf.modelsrepresenting possible electron temperature edge profiles. The samples should be given as anumpy.ndarrayof shape(n, m)wherenis the number of samples andmis the number of model parameters.model – An instance of one of the model classes from
pedinf.models.
- Returns
A tuple of two
PlasmaProfileobjects, the first corresponding to the electron pressure profile, and the second to the electron pressure gradient profile.
Estimating pressure profile parameters
The pressure_parameters function estimates the parameters of the electron
pressure for a given edge profile model and corresponding set of temperature
and density parameters.
- pedinf.analysis.pressure_parameters(ne_parameters: ndarray, te_parameters: ndarray, model: ProfileModel, return_diagnostics=False)
Approximates the electron pressure profile parameters by re-fitting the profile model to the predicted pressure profile obtained from the product of the predicted temperature and density profiles.
- Parameters
ne_parameters – The density parameter vector for the given profile model.
te_parameters – The temperature parameter vector for the given profile model.
model – An instance of either the
mtanh` or ``lpmmodel classes frompedinf.models.return_diagnostics – If set as
True, a dictionary containing diagnostic information about the fit to the pressure will be returned alongside the fit parameters.
- Returns
The fitted pressure profile parameters.
The PlasmProfile class
PlasmaProfile is a data class which packages all the data associated with a given estimate of a plasma profile.
- class pedinf.analysis.PlasmaProfile(axis: ndarray, profile_samples: ndarray, axis_label: str = None, profile_label: str = None, axis_units: str = None, profile_units: str = None)
Class for representing the estimate of a plasma profile derived from samples of possible profiles produced by uncertainty quantification.
- Parameters
axis – The axis values at which the profile samples were evaluated as a 1D
numpy.ndarray.profile_samples – The profile samples as a 2D
numpy.ndarrayof shape(axis.size, n_samples).axis_label – A description of the axis on which the profiles have been evaluated, e.g. ‘major radius’.
profile_label – A description of the quantity represented by the profile, e.g. ‘electron temperature’.
axis_units – The units of the axis values, e.g. ‘m’ for metres.
profile_units – The units of the profile values, e.g. ‘eV’ for electron temperature.
- classmethod from_parameters(axis: ndarray, parameter_samples: ndarray, model: ProfileModel, gradient: bool = False, axis_label: str = None, profile_label: str = None, axis_units: str = None, profile_units: str = None)
Class for representing the estimate of a plasma profile derived from samples of possible profiles produced by uncertainty quantification.
- Parameters
axis – The axis values at which the profile samples are to be evaluated as a 1D
numpy.ndarray.parameter_samples – The model parameter samples as a 2D
numpy.ndarrayof shape(model.n_parameters, n_samples).model – An instance of a profile model class from the
pedinf.modelsmodule.gradient – If given
Truethe profile samples will be the gradient of the model prediction instead of the prediction itself. Default isFalse.axis_label – A description of the axis on which the profiles have been evaluated, e.g. ‘major radius’.
profile_label – A description of the quantity represented by the profile, e.g. ‘electron temperature’.
axis_units – The units of the axis values, e.g. ‘m’ for metres.
profile_units – The units of the profile values, e.g. ‘eV’ for electron temperature.
- plot(axis=None, color: str = None)
Plot the profile.
- Parameters
axis – A matplotlib axis object on which the profile will be plotted.
color – A valid
matplotlibcolor string which will be used to plot the profile.