fit_static_thy¶
- TRXASprefitpack.driver.fit_static_thy(thy_peak: Sequence[ndarray], fwhm_G_init: float, fwhm_L_init: float, policy: str, peak_shift: Optional[ndarray] = None, peak_scale: Optional[ndarray] = None, edge: Optional[str] = None, edge_pos_init: Optional[ndarray] = None, edge_fwhm_init: Optional[ndarray] = None, base_order: Optional[int] = None, method_glb: Optional[str] = None, method_lsq: Optional[str] = 'trf', kwargs_glb: Optional[dict] = None, kwargs_lsq: Optional[dict] = None, bound_fwhm_G: Optional[Tuple[float, float]] = None, bound_fwhm_L: Optional[Tuple[float, float]] = None, bound_peak_shift: Optional[Sequence[Tuple[float, float]]] = None, bound_peak_scale: Optional[Sequence[Tuple[float, float]]] = None, bound_edge_pos: Optional[Sequence[Tuple[float, float]]] = None, bound_edge_fwhm: Optional[Sequence[Tuple[float, float]]] = None, e: Optional[ndarray] = None, intensity: Optional[ndarray] = None, eps: Optional[ndarray] = None) StaticResult[source]¶
driver routine for fitting static spectrum with sum of voigt broadend thoretical spectrum, edge and polynomial base line. To solve least square optimization problem efficiently, it implements the seperation scheme. Moreover this driver uses two step algorithm 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
thy_peak (sequence of np.ndarray) – peak position and intensity for theoretically calculated spectrum
fwhm_G_init (float) – initial gaussian part of fwhm parameter
fwhm_L_init (float) – initial lorenzian part of fwhm parameter
policy ({'shift', 'scale', 'both'}) – policy to match discrepancy between thoretical spectrum and experimental one
peak_shift (np.ndarray) – peak shift parameter for each species
peak_scale (np.ndarray) – peak scale parameter for each species
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
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_fwhm_G (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 (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_peak_shift (sequence of tuple) – boundary for peak shift parameter. If bound_peak_shift is None, the upper and lower bound are given by set_bound_e0.
bound_peak_scale (sequence of tuple) – boundary for peak scale parameter. If bound_peak_scale is None, the upper and lower bound are given as (0.9*peak_scale, 1.1*peak_scale).
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
Every theoretical spectrum is normalize.