freegsnke.switch_profile module
Implements some functionality needed by the FreeGSNKE profile object to find optimised coefficients when switching between profile parametrizations.
Copyright 2025 UKAEA, UKRI-STFC, and The Authors, as per the COPYRIGHT and README files.
This file is part of FreeGSNKE.
FreeGSNKE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
FreeGSNKE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
You should have received a copy of the GNU Lesser General Public License along with FreeGSNKE. If not, see <http://www.gnu.org/licenses/>.
- freegsnke.switch_profile.Lao_parameters_finder(pn_, pprime_, ffprime_, n_alpha, n_beta, alpha_logic=True, beta_logic=True, Ip_logic=True)[source]
Finds best fitting alpha, beta parameters for a Lao85 profile, to reproduce the input pprime_ and ffprime_ n_alpha and n_beta represent the number of free parameters Simple linear fit.
- Parameters:
pn (np.array) – Normalised plasma function, array of values btw 0 and 1.
pprime (np.array) – pprime(pn_)
ffprime (np.array) – ffprime(pn_)
n_alpha (int) – Number of free parameters for the pprime term
n_beta (int) – Number of free parameters for the ffprime term
alpha_logic (bool, optional) – add polynomial term in Lao85 profile so that ppprime(1)=0, by default True
beta_logic (bool, optional) – add polynomial term so that ffpprime(1)=0,, by default True
Ip_logic (bool, optional) – if False, scale coefficients, by default True
nn (int, optional) – number of points to be used for fit, by default 100
- Returns:
optimal alpha and beta parameters Note these need to be used with the same alpha and beta logic terms provided as inputs.
- Return type:
np.array, np.array