Source Calibration

pydiana.tools.source_calibration.get_iron_data(num=2, decimals=0)[source]

Function for getting the iron peaks of Ka and Kb

Parameters:

num : integer specifying how many lines we want to return. If 3 it returns the two Ka lines and the Kb line, if 2 it averages the two Ka lines and returns one Ka and one Kb, if 1 it only returns the averaged Ka line. decimals : integer saying how many decimal places to use. The approximation is done to the order of magnitude specified by 10^(-decimals) (if decimals is negative it will approximate to tens, hundreds, etc...)

returns:

2D array

rtype:

First row containing the energy of the iron lines in eV. The second row contains the intensities of the iron lines.

pydiana.tools.source_calibration.iron_calibrate(fit_peaks, parfix=None, iron_peak_energies=None, iron_peak_errors=None, unit_iron='eV', get_detail_matrices=False, showplot=True)[source]

Function for fitting the iron calibration constant

Parameters:
  • fit_peaks (pandas dataframe with the fit result of the histogram fitting of the iron lines) --

  • iron_peak_energies (array-like with the energies of the 2 iron lines) --

  • iron_peak_errors (array-like with the error on the energies of the 2 iron lines) --

  • unit_iron (string with the unit of the iron energies) --

Returns:

  • fit_results (pandas dataframe containing the fit results)

  • func (root fitted function)

pydiana.tools.source_calibration.iron_fit(histogram, params, parfix=None, unit='mV', xrange=None, advanced=False, constrained=False, degree=None, polType='Chebyshev', fit_options='QSL')[source]

Utility for fitting a double gaussian to the iron peak

Parameters:
  • histogram (dictionary containing "counts" with the heights of the histogram bars, and "bin_edges" containing the edges of the histogram bins (left and right)) --

  • params (array-like containing the parameters of the gaussians) --

  • parfix (array-like contatining the index of the parameters to fix) --

  • advanced (Boolean to switch off and on the advanced 3 gaussian fitting. It can be used to fit two separate gaussians in case the two different K_a lines can be resolved.) --

  • constrained (Boolean used to toggle a constained gaussian fitting (apart from the parameters of the first gaussian, the mean values and intensities of the remaining ones are physically determined).) --

Returns:

  • fit_results (pandas dataframe containing the fit results)

  • func (root fitted function)