[{ALLOW edit EISMainUsers}]
[{ALLOW view Anonymous}]
!!!Worksheet 6 - Fitting Gaussians to the data 

Generally the EIS emission lines have a Gaussian shape and, by fitting a Gaussian function to the spectrum, one can derive line intensity, line width and velocity maps. The high sensitivity of EIS means that for many lines it is possible to perform good quality fits at each pixel in the image. The  routine EIS_AUTO_FIT in Solarsoft takes the output from eis_getwindata (Worksheet 5) and fits a single Gaussian to each pixel in the image. The calling procedure is:

{{{
IDL> eis_auto_fit, wd, fit
}}}

The output from EIS_AUTO_FIT is an IDL structure called FIT. Intensity, velocity and line width arrays can be extracted from FIT by doing:

{{{
int=eis_get_fitdata(fit,/int,calib=calib)
vel=eis_get_fitdata(fit,/vel,calib=calib)
wid=eis_get_fitdata(fit,/wid,calib=calib)
}}}

The optional input 'calib' specifies which radiometric calibration to apply to the data. Please check the calibration discussion page for more details. The recommended options are 1 or 3 for the Del Zanna (2013) or Warren et al. (2014) calibrations. Neglecting to specify calib means that the original laboratory calibration (as performed in the call to eis_prep) will be retained. Although 'calib' does not need to be specified for the velocity and line width arrays, it's good practice to always specify it.

Error arrays for each parameter can be obtained by adding the optional output 'error=error'. Make sure that 'calib' takes the same value as it did when you extracted the intensity array.

{{{
int=eis_get_fitdata(fit,/int,error=int_error,calib=calib)
}}}

This example shows the most simple use for eis_auto_fit. The routine can also be used to perform multiple Gaussian fits and a full description of the capabilities are given in two documents: '[Gaussian fitting for the Hinode/EIS mission|ftp://sohoftp.nascom.nasa.gov/solarsoft/hinode/eis/doc/eis_notes/16_AUTO_FIT/eis_swnote_16.pdf]' and '[Gaussian fitting examples using eis_auto_fit|https://ftp://sohoftp.nascom.nasa.gov/solarsoft/hinode/eis/doc/eis_notes/17_AUTO_FIT_EXAMPLES/eis_swnote_17.pdf]'.

Some points to note about the line fit parameters:

# The velocity map has been calibrated such that the average velocity across the whole raster is set to zero. Alternative methods of calibrating the velocity map are described in the fitting documents listed above. If velocity maps are used in scientific analysis, then scientists should consider carefully how the maps are calibrated.
# When the line width array is extracted with eis_get_fitdata, it is automatically corrected for the instrumental line width. To keep the instrumental component, use the /keep_inst_width keyword. The thermal component of the line width can be removed by using the thermal_wid= optional input - see the routine header for details on how to use this keyword.