Gaussian fitting for IRIS (iris_auto_fit)


One or more Gaussians can be automatically fit to IRIS rasters with the IDL routine IRIS_AUTO_FIT, available in Solarsoft. This page describes how the routine is used and how the results can be viewed with IRIS_FIT_VIEWER.

IRIS_AUTO_FIT is a wrapper to the routine EIS_AUTO_FIT that was developed for the Hinode/EIS mission. For full details on how that routine works and the options that are available, please check EIS Software Note No. 16 and the examples in EIS Software Note No. 17.

IMPORTANT: you will need to have the EIS Solarsoft directory on your computer for IRIS_AUTO_FIT to work.

Calling iris_auto_fit for IRIS

The call is:

IDL> iris_auto_fit, windata, fitdata [, template=template, wvl_select=wvl_select]

The optional template and wvl_select structures are created with eis_fit_template and eis_wvl_select (see EIS Software Note No. 16).

Viewing the results graphically

The fits can be viewed using the following GUI:

IDL> iris_fit_viewer, windata, fitdata

Again this is a wrapper to the EIS routine eis_fit_viewer. The routine allows you to browse the fit results across the raster and study individual profiles.

Extracting line parameters

To extract the intensity, line-of-sight velocity or width from the FITDATA structure, use:

IDL> int=eis_get_fitdata(fitdata, /int)
IDL> vel=eis_get_fitdata(fitdata, /vel)
IDL> wid=eis_get_fitdata(fitdata, /wid)

You can give the /map keyword to put the images into an IDL map structure.

Reference wavelengths

When working out the velocity, the routine uses the tag FITDATA.REFWVL as the reference wavelength against which Doppler shifts are determined. This tag is set to be the average centroid of the line over the raster. One can manually set this to the reference wavelength of the line (see my line list, for example), however this assumes that the IRIS wavelength scale is accurate.

The best approach is to measure the centroid of a very cool line close to the line of interest as these lines generally have very small velocities (< 1 km/s). Examples are S I 1401.51 (near Si IV 1402.77) and O I 1355.60 (near Fe XXI 1354.08). You don't need to measure these lines at every pixel in the raster, as you simply need one measurement for an exposure. For example, you can sum all pixels along the slit and measure the cool line centroid from this one spectrum.

Suppose you measure the S I centroid, and it is +0.01 Å compared to the reference wavelength. We can then manually set the REFWVL value for Si IV 1402.77 to be:

IDL> fitdata.refwvl=1402.770 + 0.01

(1402.770 is the reference wavelength for the Si IV line) and then the velocity map obtained with EIS_GET_FITDATA will be derived using this value.

The WINDATA structure

IRIS_AUTO_FIT takes as input a WINDATA structure. A key point of the windata structure is that it contains an error array for the intensities, which is needed for Gaussian fitting (see Young et al. 2015 for a description of how the errors are computed). To create an IRIS windata structure, one does:

IDL> wd=iris_getwindata(file,wvl,/calib)

where wvl is the wavelength you're interested in (e.g., 1402.7 for Si IV). The /CALIB keyword is recommended as it outputs intensities (and errors) in calibrated units of erg cm-2 s-1 sr-1 pixel-1. If you do not use this keyword, then the intensities are in units of DN pixel-1.

There are a set of routines for manipulating the windata structure, which are described in EIS Software Note No. 21. For example one can spatially bin data using EIS_BIN_WINDATA, or one can reduce the size of arrays using EIS_TRIM_WINDATA.

IRIS_GET_WINDATA can run slowly for large files - see the tips given below for how to speed up the routine.

Fit templates

The routine EIS_FIT_TEMPLATE is a GUI-based routine for creating a template for the fit. The user simply specifies the location and height of the emission line (or lines) by clicking on a spectrum. The spectrum is obtained by selecting a region in the displayed image. See EIS Software Note No. 16 for more details.

The template is essential if you're attempting to doing multi-Gaussian fitting. I also recommend it even if you're just doing a single-Gauss fit.

EIS_FIT_TEMPLATE automatically detects if an IRIS spectrum has been input, and it adjusts the parameters that go into the template accordingly. If you inspect the code you will see the lines:

          width=0.03
dcen=0.50
wid_lim=[0.02,0.55]

Where width gives the initial value for the line's Gaussian width, dcen gives the range over which the centroid can vary (i.e., +/- dcen angstroms from the initial centroid), and wid_lim gives the allowed range for the Gaussian width. These values enter into template.lines, so you can manually edit this for different cases. For example, the width of O I 1355.6 will never reach 0.55, so you can set a smaller value to prevent silly fits. I set the parameters in order to handle the very broad Si IV lines that are sometimes seen.

If the fits reach the parameter limits, then IRIS_AUTO_FIT will let you know (see "Checking parameter limits..." text in output). If many pixels are hitting the limits then you should manually change the limits in the template.

Huge file problems

There are two types of huge file for IRIS: (1) large rasters that take the full-CCD spectra, and (2) long-duration sit-and-stare studies. Creating the windata structures for these can take minutes, and so I give tips below for speeding up this process.

Full-CCD spectra

If you are only interested in a sub-region of the spectrum, then you can do:

IDL> wd=iris_getwindata(file, 1401, wrange=[1398,1407])

which will extract only the wavelength region 1398-1407 angstroms.

Long-duration sit-and-stare

If there is a specific time period that you are interested in, then note the pixels that correspond to this period (using iris_raster_browser is a good way of doing this, as it shows the X-pixel number in the top-left corner of the GUI). If the pixels are [x0,x1], then do:

IDL> wd=iris_getwindata(file, 1401, ixrange=[x0,x1])

which will only extract this time range into the windata structure. (Note that this can also be used to select a sub-range in the X-direction for raster data.)

Example

Fit the Si IV 1402.77 line across an active region raster.

IDL> files=iris_find_file('12-oct-2013 21:00')
IDL> wd=iris_getwindata(files[0],1402.77,/calib)
IDL> wdx=eis_trim_windata(wd,[1402,1403.5])
IDL> eis_fit_template,wdx,template   ; --> select the Si IV with this widget
IDL> iris_auto_fit, wdx, fit, template=template

The fitting should take about 1-2 minutes. To view the results do:

IDL> iris_fit_viewer, wdx, fit

To extract the intensity array as an IDL map and plot, do:

IDL> map=eis_get_fitdata(fit,/int,/map)
IDL> p=plot_map_obj(map,rgb_table=3)

Check the value of fit.refwvl (should be 1402.800), and try setting it to the Si IV rest wavelength of 1402.770. See how the velocity map changes when you call iris_fit_viewer. This shows the transition region is predominantly red-shifted. A more accurate wavelength calibration needs to be done by using a cool line as reference (see above).


Page maintained by Dr P.R. Young.