### MCA HOWTOs

HOWTO - Display MCA spectra in energy instead of channels
HOWTO - Calibrate MCA spectra
HOWTO - Define a ROI
HOWTO - Fit MCA Spectra
HOWTO - Simple fit
HOWTO - Advanced fit

### Display MCA spectra in energy instead of channels

At the calibration combo box below the Mca graphics window, select Internal. If the spectra in the graphics window have an energy calibration associated (either they were already calibrated or they have been calibrated by PyMca), each spectrum will be shown with its corresponding calibration.
The default options of the calibration combo box are:
None - Spectra are shown against channel number.
Original - Each spectrum is shown with the energy calibration it came with.
Internal - Each spectrum is shown with the energy calibration it came with unless it has been recalibrated in PyMca.
Other options will be present in case the user has previously decided to perform an energy calibration. Selecting any of these non default options will plot all the spectra with the same selected energy calibration.

### Calibrate MCA spectra

Select the spectrum to calibrate by clicking on its legend.
Click on calibrate.
If you want to enter a calibration by hand or to copy a calibration from other curve, click edit. The rest should be more or less self-explanatory.
If you want to calculate a new calibration from the data themselves, click compute. You will be presented a new graph window with the selected spectrum.
The program offers to you the possibility to search automatically for peaks (you should give an estimation of the FWHM of the peaks) or to enter a peak with the mouse by selecting the manual search icon.
Found or entered peaks will be denoted by vertical markers on the graph. To enter the associated energy to that peak just click on the marker. Do that for all the peaks you would like to use.
Once you have finished click OK to validate the calibration or Cancel to disregard it. Back to the main application, select the appropriate option in the calibration combo box.

### Define a ROI

A table of Regions of Interest (ROIs) may be seen below the MCA graph. A default ROI named ICR is always present.
The Raw counts contains the total counts between the markers.
The Net counts contains the Raw counts minus the counts under an imaginary background line going from the spectrum point at the beginning of the ROI to the spectrum point at the ending of the ROI. To define a new ROI just click the "ADD ROI" button and move the blue markers (click and move) to the appropriate position(s).

### Fit MCA Spectra

Select the spectrum to be fitted by clicking on its legend.
Select the region to be fitted by zooming with the mouse.
Click on the Fit Icon. Select "Simple" or "Advanced" depending on the type of fit to be performed.

### Simple Fit

PyMca automatically searches for peaks in the spectrum, divides the spectrum in several regions depending on the separation among peaks and on the FWHM specified in the configuration and presents all the results in a table.
Peaks for which the calculated area presents potential problems are underlined in red.
WARNING:
If you are interested on the peak areas, the fit has to be made with the calibration set to None. If not, the calculated areas need to be divided by the value shown besides B: of the used energy calibration in order to get the actual areas.
If you are interested on peak FWHM in energy, the fit has to be made with the calibration set to an option different from None.

### Advanced Fit

This is PyMca main reason of being. The initial goal of PyMca was to supply an interactive tool to set up the configuration file of a program for batch fitting of multiple spectra.
The expected procedure is:
- select an active curve
- calibrate it if not already calibrated
- select internal calibration
- zoom to the desired fitting region
- click fit icon
- select advanced
- configure
- fit
The "Configure" button opens a dialog box with several tabs.
The FIT tab allows to specify convergence criteria.
The PEAKS tab allows the user to select the elements and lines (K, L1, L2, L3) to be considered. Elements with selected lines are shown in yellow.
The PEAKS SHAPE allows fine tuning of the HYPERMET function describing the peaks.
The ATTENUATORS tab allows to take into account absorbers that could modify the peak ratios of the elements as seen by the detector.
It is convenient to SAVE the final configuration in a file for using it in other session or in batch mode.
The "Tools" button shows a popup menu offering to print the table or to generate a detailed HTML report. The report can be visualized by any web browser. A detailed description of the fitting function(s) and most of the algorithms used can be found here