This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
data:line_fitting_idl [2024/11/12 01:43] Peter Young [Emission line fitting using IDL software] |
data:line_fitting_idl [2024/11/12 18:02] (current) Peter Young [IDL Software for Emission Line Fitting] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Emission line fitting using IDL software ====== | + | ====== IDL Software for Emission Line Fitting ====== |
- | ===== Fitting a Gaussian at each spatial pixel in a raster (IDL) ===== | + | |
+ | ===== Fitting a Gaussian at each spatial pixel in a raster ===== | ||
Spectra at each spatial pixel in a raster can be fit with Gaussians using the eis\_auto\_fit IDL routine developed for the Hinode/EIS mission (you must have the EIS branch in your Solarsoft distribution). The key step is to format a SPICE wavelength window into a "windata" structure using the routine spice\_getwindata. An example call is: | Spectra at each spatial pixel in a raster can be fit with Gaussians using the eis\_auto\_fit IDL routine developed for the Hinode/EIS mission (you must have the EIS branch in your Solarsoft distribution). The key step is to format a SPICE wavelength window into a "windata" structure using the routine spice\_getwindata. An example call is: | ||
Line 21: | Line 22: | ||
If you have problems running the EIS software on SPICE data, please contact [[https://science.gsfc.nasa.gov/sed/bio/peter.r.young|Dr. Peter Young]]. | If you have problems running the EIS software on SPICE data, please contact [[https://science.gsfc.nasa.gov/sed/bio/peter.r.young|Dr. Peter Young]]. | ||
- | ===== Fitting a Gaussian to a spatially-averaged spectrum (IDL) ===== | + | ===== Fitting a Gaussian to a spatially-averaged spectrum ===== |
In this scenario, a spatial region is selected in the raster, perhaps a bright point or a loop, and the spectra are averaged over this region to produce a single, 1D spectrum. Gaussians are then fit to this spectrum. The procedure is as follows: | In this scenario, a spatial region is selected in the raster, perhaps a bright point or a loop, and the spectra are averaged over this region to produce a single, 1D spectrum. Gaussians are then fit to this spectrum. The procedure is as follows: | ||
Line 34: | Line 35: | ||
These routines are modified from routines originally written for Hinode/EIS. Further details can be found in [[https://doi.org/10.5281/zenodo.6339584 | These routines are modified from routines originally written for Hinode/EIS. Further details can be found in [[https://doi.org/10.5281/zenodo.6339584 | ||
|EIS Software Note 15]]. | |EIS Software Note 15]]. | ||
+ | |||
+ | ===== Using an auto_fit template for mask spectra ===== | ||
+ | |||
+ | The fitting templates created for eis\_auto\_fit can be useful for fitting mask spectra as well. First create the template for the window you are interested in: | ||
+ | |||
+ | '' | ||
+ | IDL> wd=spice\_getwindata(file)\\ | ||
+ | IDL> eis\_fit\_template,wd,template \\ | ||
+ | '' | ||
+ | |||
+ | Now create the mask spectrum using the procedure described above. You can then apply the template to the mask spectrum by doing: | ||
+ | |||
+ | '' | ||
+ | IDL> fit=spice\_mask\_auto\_fit(wd,spec,template,chi2=chi2) | ||
+ | '' | ||
+ | |||
+ | The output structure ''fit'' contains the fit results. The reduced chi-square value for the fit is returned in the optional output. To overplot the fit on the spectrum, do: | ||
+ | |||
+ | '' | ||
+ | IDL> p=spice\_plot\_mask\_auto\_fit(spec,fit) | ||
+ | '' | ||
+ | |||