xarray_curve_eval

PlasmaCalcs.tools.xarray_tools.xarray_sci.xarray_curve_eval(params, f, xdata, *, stddev=False)

evaluate a curve fit result (params) for this function at these xdata.

[EFF] note: well-vectorized f could equivalently do:
f(xdata, *params.transpose(‘param’, …))
and that would probably be much faster, if it is an available option.
params: xarray.DataArray or xarray.Dataset
curve_fit result, or result[‘params’]. Must have ‘param’ dimension.
if Dataset, will internally use params[‘params’].
f: callable like f(x, param1, param2, …)
function which was fit / to be evaluated.
xdata: 1D xarray.DataArray
x values at which to evaluate the fit.
stddev: bool
whether to instead return Dataset with data_vars ‘eval+std’, ‘eval’, and ‘eval-std’,
telling f(xdata, *(params+std)), f(xdata, *params), and f(xdata, *(params-std)).
Fails if params is not a Dataset with ‘stddev’ data_var.