erlab.analysis.gold

Fermi edge fitting.

Functions

correct_with_edge(darr, modelresult[, ...])

Corrects the given data array darr with the given values or fit result.

edge(gold, angle_range, eV_range[, ...])

Fit a Fermi edge to the given gold data.

poly(gold, angle_range, eV_range[, ...])

poly_from_edge(center[, weights, degree, ...])

resolution(gold, angle_range, eV_range_edge)

resolution_roi(gold_roi, eV_range[, ...])

spline(gold, angle_range, eV_range[, ...])

spline_from_edge(center[, weights, lam])

erlab.analysis.gold.correct_with_edge(darr, modelresult, shift_coords=True, plot=False, plot_kw=None, **shift_kwargs)[source]

Corrects the given data array darr with the given values or fit result.

Parameters:
  • darr (DataArray) – The input data array to be corrected.

  • modelresult (ModelResult | ndarray[Any, dtype[floating]] | Callable) – The model result that contains the fermi edge information. It can be an instance of lmfit.model.ModelResult, a numpy array containing the edge position at each angle, or a callable function that takes an array of angles and returns the corresponding energy value.

  • shift_coords (bool) – If True, the coordinates of the output data will be changed so that the output contains all the values of the original data. If False, the coordinates and shape of the original data will be retained, and only the data will be shifted. Defaults to False.

  • plot (bool) – Whether to plot the original and corrected data arrays. Defaults to False.

  • plot_kw (dict | None) – Additional keyword arguments for the plot. Defaults to None.

  • **shift_kwargs – Additional keyword arguments to erlab.analysis.utilities.shift.

Returns:

corrected – The edge corrected data.

Return type:

xarray.DataArray

erlab.analysis.gold.edge(gold, angle_range, eV_range, bin_size=(1, 1), temp=None, vary_temp=False, fast=False, method='leastsq', scale_covar=True, normalize=True, fixed_center=None, progress=True, parallel_kw=None, parallel_obj=None, return_full=False, **kwargs)[source]

Fit a Fermi edge to the given gold data.

Parameters:
  • gold (DataArray) – The gold data to fit the edge model to.

  • angle_range (tuple[float, float]) – The range of alpha values to consider.

  • eV_range (tuple[float, float]) – The range of eV values to consider.

  • bin_size (tuple[int, int]) – The bin size for coarsening the gold data, by default (1, 1).

  • temp (float | None) – The temperature in Kelvins. If None, the temperature is inferred from the attributes, by default None

  • vary_temp (bool) – Whether to fit the temperature value during fitting, by default False.

  • fast (bool) – Whether to use the Gaussian-broadeded step function to fit the edge, by default False.

  • method (str) – The fitting method to use, by default "leastsq".

  • scale_covar (bool) – Whether to scale the covariance matrix, by default True.

  • fixed_center (float | None) – The fixed center value. If provided, the Fermi level will be fixed at the given value, by default None.

  • normalize (bool) – Whether to normalize the energy coordinates, by default True.

  • progress (bool) – Whether to display the fitting progress, by default True.

  • parallel_kw (dict | None) – Additional keyword arguments for parallel fitting, by default None.

  • parallel_obj (Parallel | None) – The joblib.Parallel object to use for fitting, by default None. If provided, parallel_kw will be ignored.

  • return_full (bool) – Whether to return the full fit results, by default False.

  • **kwargs – Additional keyword arguments to fitting.

Returns:

  • center_arr, center_stderr – The fitted center values and their standard errors, returned when return_full is False.

  • fitresults – A dataset containing the full fit results, returned when return_full is True.

Return type:

tuple[DataArray, DataArray] | list[ModelResult]

erlab.analysis.gold.poly(gold, angle_range, eV_range, bin_size=(1, 1), temp=None, vary_temp=False, fast=False, method='leastsq', normalize=True, degree=4, correct=False, crop_correct=False, parallel_kw=None, plot=True, fig=None, scale_covar=True, scale_covar_edge=True)[source]
erlab.analysis.gold.poly_from_edge(center, weights=None, degree=4, method='leastsq', scale_covar=True)[source]
erlab.analysis.gold.resolution(gold, angle_range, eV_range_edge, eV_range_fit=None, bin_size=(1, 1), degree=4, fast=False, method='leastsq', plot=True, parallel_kw=None, scale_covar=True)[source]
erlab.analysis.gold.resolution_roi(gold_roi, eV_range, fix_temperature=True, method='leastsq', plot=True, scale_covar=True)[source]
erlab.analysis.gold.spline_from_edge(center, weights=None, lam=None)[source]