# xaid_calib

## Module characteristics

- Goal: to calibrate a XAFS spectrum Mu(x). Calibration is done by calculating Mu(Energy), where the energy is calculated as a second degree polynomial in x. In other words, this module helps in finding the a,b,c coefficients in:
  Energy_eV[i] = a+b*(x[i]-x[0])+c*(x[i]-x[0])^2
  being i the index of the i-th point. (The substraction of x[0] is essential for TurboXAS experiments performed in ESRF/ID24 beamline).
- Method: Display the reference spectrum and the spectrum to calibrate in a plotting window. Change interactively the parameters. x[0] and a can be automatically calculated via the computation of the spectra inflexion points.
- Input: Two files:
  1. A 2 column file with calibrated spectrum (reference file) Mu(Energy_in_eV).
  2. A 2 column file with spectrum to calibrate Mu(x).
- Output: The a,b,c coefficients and x[0]

## Example of use

1. Open the main window
2. Load two files, the first one with the reference spectrum and the second other with the spectrum to calibrate. As examples, use the files Ge_calib.chi and Ge_calib.chi in the Example directory. This may be done just by clicking the button
3. You may plot the loaded files using the button close to the file name.
4. Click the button to guess the initial values of x[0] and a using by calculating the spectra inflexion points. A new graphical window appears with the reference spectrum and the spectrum to calibrate:
5. Change b manually with the expansion compression value. In the example, it can be estimated that the dashed spectrum must compress at least 20 times to fit the solid one, so we put .05 in b (do not forget to press ENTER for refreshig the plot):
6. Then improve the b value by fine tuning using the buttons. You may change the step of the movement. You may also zoom in the plotting window for better looking.
7. Sometimes the heights of the two spectra are very different, avoiding a good overlapping. In such a case, the Y axis can be expanded (and shifted) using the controls
   .
   Note that this option helps in visualizing the fine tuning but it does not affect the resulting coefficients
8. A result may be this one:
   The resulting parameters may be copied to another program. They are automatically passed to DELIA in the case that XAID_CALIB is called from DELIA.