fit_static_voigt

TRXASprefitpack.driver.fit_static_voigt(e0_init: ndarray, fwhm_G_init: ndarray, fwhm_L_init: ndarray, edge: str | None = None, edge_pos_init: ndarray | None = None, edge_fwhm_init: ndarray | None = None, base_order: int | None = None, method_glb: str | None = None, method_lsq: str | None = 'trf', kwargs_glb: dict | None = None, kwargs_lsq: dict | None = None, bound_e0: Sequence[Tuple[float, float]] | None = None, bound_fwhm_G: Sequence[Tuple[float, float]] | None = None, bound_fwhm_L: Sequence[Tuple[float, float]] | None = None, bound_edge_pos: Sequence[Tuple[float, float]] | None = None, bound_edge_fwhm: Sequence[Tuple[float, float]] | None = None, e: ndarray | None = None, intensity: ndarray | None = None, eps: ndarray | None = None) StaticResult[source]

driver routine for fitting static spectrum with sum of voigt component, edge and polynomial baseline.

It separates linear and non-linear part of the optimization problem to solve non linear least sequare optimization problem efficiently.

Moreover this driver uses two step method to search best parameter, its covariance and estimated parameter error.

Step 1. (method_glb) Use global optimization to find rough global minimum of our objective function. In this stage, it use analytic gradient for scalar residual function.

Step 2. (method_lsq) Use least squares optimization algorithm to refine global minimum of objective function and approximate covariance matrix. Because of linear and non-linear seperation scheme, the analytic jacobian for vector residual function is hard to optain. Thus, in this stage, it uses numerical jacobian.

Parameters:
  • e0_init (np.ndarray) – initial peak position of each voigt component

  • fwhm_G_init (np.ndarray) – initial gaussian part of fwhm parameter of each voigt component

  • fwhm_L_init (np.ndarray) – initial lorenzian part of fwhm parameter of each voigt component

  • edge ({'g', 'l'}) – type of edge function. If edge is not set, edge feature is not included.

  • edge_pos_init (np.ndarray) – initial edge position

  • edge_fwhm_init (np.ndarray) – initial fwhm parameter of edge

  • method_glb ({None, 'basinhopping', 'ampgo'}) – Method for global optimization Algorithm.

  • method_lsq ({'trf', 'dogbox', 'lm'}) – method of local optimization for least_squares minimization (refinement of global optimization solution)

  • kwargs_glb – keyward arguments for global optimization solver

  • kwargs_lsq – keyward arguments for least square optimization solver

  • bound_e0 (sequence of tuple) – boundary for each voigt componet. If upper and lower bound are same, driver assumes that the parameter is fixed during optimization. If bound_e0 is None, the upper and lower bound are given by set_bound_e0.

  • bound_fwhm_G (sequence of tuple) – boundary for fwhm_G parameter. If bound_fwhm_G is None, the upper and lower bound are given as (fwhm_G/2, 2*fwhm_G).

  • bound_fwhm_L (sequence of tuple) – boundary for fwhm_L parameter. If bound_fwhm_L is None, the upper and lower bound are given as (fwhm_L/2, 2*fwhm_L).

  • bound_edge_pos (sequence of tuple) – boundary for edge position, if bound_edge_pos is None and edge is set, the upper and lower bound are given by set_bound_t0.

  • bound_edge_fwhm (sequence of tuple) – boundary for fwhm parameter of edge feature. If bound_edge_fwhm is None, the upper and lower bound are given as (edge_fwhm/2, 2*edge_fwhm).

  • e (np.narray) – energy range for data

  • intensity (np.ndarray) – intensity of static spectrum data

  • eps (np.ndarray) – estimated errors of static spectrum data

  • Returns – StaticResult class object

  • Note

    • if initial fwhm_G is zero then such voigt component is treated as lorenzian component

    • if initial fwhm_L is zero then such voigt component is treated as gaussian component