Edge profile models
- class pedinf.models.mtanh(radius=None, low_field_side=True)
The standard ‘mtanh’ function used for pedestal fitting. Specifically, the function is:
\[\mathrm{mtanh}(R, \, \underline{\theta}) = L(z) \left(h - b + \frac{awz}{4} \right) + b\]where
\[z = -4 \frac{R - R_0}{w}, \quad \quad L(x) = \frac{1}{1 + e^{-x}}.\]The model parameter vector \(\underline{\theta}\) has the following order:
\[\underline{\theta} = \left[ \, R_0, \, h, \, w, \, a, \, b \, \right],\]where
\(R_0\) is the radial location of the pedestal.
\(h\) is the pedestal height.
\(w\) is the pedestal width.
\(a\) is the profile gradient beyond the pedestal top.
\(b\) is the background level.
- gradient(radius: ndarray, theta: ndarray) ndarray
Calculates the gradient (w.r.t. major radius) of the
mtanh
function. See the documentation formtanh
for details of the function itself.- Parameters
radius – Radius values at which the gradient is evaluated.
theta – The model parameters as an array.
- Returns
The predicted gradient profile at the given radius values.
- jacobian(radius: ndarray, theta: ndarray) ndarray
Calculates the jacobian of the
mtanh
model. The jacobian is a matrix where element \(i, j\) is the derivative of the model prediction at the \(i\)’th radial position with respect to the \(j\)’th model parameter. See the documentation formtanh
for details of the model itself.- Parameters
radius – Radius values at which the jacobian is evaluated.
theta – The model parameters as an array.
- Returns
The jacobian matrix for the given radius values.
- prediction(radius: ndarray, theta: ndarray) ndarray
Calculates the prediction of the
mtanh
model. See the documentation formtanh
for details of the model itself.- Parameters
radius – Radius values at which the prediction is evaluated.
theta – The model parameters as an array.
- Returns
The predicted profile at the given radius values.
- prediction_and_jacobian(radius: ndarray, theta: ndarray) Tuple[ndarray, ndarray]
Calculates the prediction and the jacobian of the
mtanh
model. The jacobian is a matrix where element \(i, j\) is the derivative of the model prediction at the \(i\)’th radial position with respect to the \(j\)’th model parameter. See the documentation formtanh
for details of the model itself.- Parameters
radius – Radius values at which the prediction and jacobian are evaluated.
theta – The model parameters as an array.
- Returns
The model prediction and the jacobian matrix for the given radius values.
- class pedinf.models.lpm(radius=None, low_field_side=True)
A modified version of the ‘mtanh’ function which includes an additional parameter controlling how rapidly the profile decays at the ‘foot’ of the pedestal. Specifically, the function is:
\[\mathrm{lpm}(R, \, \underline{\theta}) = (h - b)\,L^{k}(z + \ln{k}) + \frac{aw}{4}S(z) + b\]where
\[z = -4 \frac{R - R_0}{w}, \quad \quad L(x) = \frac{1}{1 + e^{-x}}, \quad \quad S(x) = \int_{-\infty}^{x} L(x')\,\mathrm{d}x' = \ln{(1 + e^x)}\]The model parameter vector \(\underline{\theta}\) has the following order:
\[\underline{\theta} = \left[ \, R_0, \, h, \, w, \, a, \, b, \, k \, \right],\]where
\(R_0\) is the radial location of the pedestal.
\(h\) is the pedestal height.
\(w\) is the pedestal width.
\(a\) is the profile gradient beyond the pedestal top.
\(b\) is the background level.
\(k\) is a shaping parameter which affects how the profile decays.
- gradient(radius: ndarray, theta: ndarray) ndarray
Calculates the gradient (w.r.t. major radius) of the
lpm
model. See the documentation forlpm
for details of the model itself.- Parameters
radius – Radius values at which the gradient is evaluated.
theta – The model parameters as an array.
- Returns
The predicted gradient profile at the given radius values.
- jacobian(radius: ndarray, theta: ndarray) ndarray
Calculates the jacobian of the
lpm
model. The jacobian is a matrix where element \(i, j\) is the derivative of the model prediction at the \(i\)’th radial position with respect to the \(j\)’th model parameter. See the documentation forlpm
for details of the model itself.- Parameters
radius – Radius values at which the jacobian is evaluated.
theta – The model parameters as an array.
- Returns
The jacobian matrix for the given radius values.
- prediction(radius: ndarray, theta: ndarray) ndarray
Calculates the prediction of the
lpm
model. See the documentation forlpm
for details of the model itself.- Parameters
radius – Radius values at which the prediction is evaluated.
theta – The model parameters as an array.
- Returns
The predicted profile at the given radius values.
- prediction_and_jacobian(radius: ndarray, theta: ndarray) Tuple[ndarray, ndarray]
Calculates the prediction and the jacobian of the
lpm
model. The jacobian is a matrix where element \(i, j\) is the derivative of the model prediction at the \(i\)’th radial position with respect to the \(j\)’th model parameter. See the documentation forlpm
for details of the model itself.- Parameters
radius – Radius values at which the prediction and jacobian are evaluated.
theta – The model parameters as an array.
- Returns
The model prediction and the jacobian matrix for the given radius values.
- class pedinf.models.exspline(knots: ndarray, radius=None, low_field_side=True)
‘exspline’ uses a combination of exponentiated b-splines and a logistic function to model the profile shape. The logistic function is combined with the exponentiated splines multiplicatively, and so models the pedestal as a localised fractional decrease in the background profile. The size of the fractional decrease is controlled by the parameter \(f \in [0, 1]\).
\[\mathrm{exspline}(R, \, \underline{\theta}) = \exp{\left[\sum_{i=1}^{n} a_i \phi_i(R)\right]} \left((1 - f) L(z) + f\right)\]where
\[z = -4 \frac{R - R_0}{w}, \quad \quad L(x) = \frac{1}{1 + e^{-x}}\]The model parameter vector \(\underline{\theta}\) has the following order:
\[\underline{\theta} = \left[ \, R_0, \, f, \, w, \, a_1 \, a_2, \, \ldots, \, a_n \, \right],\]where
\(R_0\) is the logistic function location.
\(f\) is the logistic function ‘floor’.
\(w\) is the logistic function width.
\(a_i\) is the weight for the \(i\)’th b-spline basis function.
- gradient(radius: ndarray, theta: ndarray) ndarray
Calculates the gradient (w.r.t. major radius) of the
exspline
model. See the documentation forexspline
for details of the model itself.- Parameters
radius – Radius values at which the gradient is evaluated.
theta – The model parameters as an array.
- Returns
The predicted gradient profile at the given radius values.
- jacobian(radius: ndarray, theta: ndarray) ndarray
Calculates the jacobian of the
exspline
model. The jacobian is a matrix where element \(i, j\) is the derivative of the model prediction at the \(i\)’th radial position with respect to the \(j\)’th model parameter. See the documentation forexspline
for details of the model itself.- Parameters
radius – Radius values at which the jacobian is evaluated.
theta – The model parameters as an array.
- Returns
The jacobian matrix for the given radius values.
- prediction(radius: ndarray, theta: ndarray) ndarray
Calculates the prediction of the
exspline
model. See the documentation forexspline
for details of the model itself.- Parameters
radius – Radius values at which the prediction is evaluated.
theta – The model parameters as an array.
- Returns
The predicted profile at the given radius values.
- prediction_and_jacobian(radius: ndarray, theta: ndarray) Tuple[ndarray, ndarray]
Calculates the prediction and the jacobian of the
exspline
model. The jacobian is a matrix where element \(i, j\) is the derivative of the model prediction at the \(i\)’th radial position with respect to the \(j\)’th model parameter. See the documentation forexspline
for details of the model itself.- Parameters
radius – Radius values at which the prediction and jacobian are evaluated.
theta – The model parameters as an array.
- Returns
The model prediction and the jacobian matrix for the given radius values.