res_grad_voigt

TRXASprefitpack.res.res_grad_voigt(x0: ndarray, num_voigt: int, edge: Optional[str] = None, num_edge: Optional[int] = 0, base_order: Optional[int] = None, fix_param_idx: Optional[ndarray] = None, e: Optional[ndarray] = None, intensity: Optional[ndarray] = None, eps: Optional[ndarray] = None) ndarray[source]

scipy.optimize.minimizer compatible scalar residual function and its gradient for fitting static spectrum with the sum of voigt function, edge function base function

Parameters
  • x0

    initial parameter

    • i th: peak position e0_i for i th voigt component

    • \({num}_{voigt}+i\) th: fwhm_G of i th voigt component

    • \(2{num}_{voigt}+i\) th: fwhm_L of i th voigt component

    if edge is not None:

    • \(3{num}_{voigt}+i\) th: ith edge position

    • \(3{num}_{voigt}+{num}_{edge}+i\) th: fwhm of ith edge function

  • num_voigt – number of voigt component

  • edge ({'g', 'l'}) – type of edge shape function if edge is not set, it does not include edge function.

  • num_edge – number of edge component

  • base_order (int) – polynomial order of baseline function if base_order is not set, it does not include baseline function.

  • fix_param_idx – idx for fixed parameter (masked array for x0)

  • e – 1d array of energy points of data (n,)

  • intensity – intensity of static data (n,)

  • eps – estimated error of data (n,)

Returns

Tuple of scalar residual function \((\frac{1}{2}\sum_i {res}^2_i)\) and its gradient

Note

  • If fwhm_G of ith voigt component is zero then it is treated as lorenzian function with fwhm_L

  • If fwhm_L of ith voigt component is zero then it is treated as gaussian function with fwhm_G