## Worksheet 8 - Creating a density map#

The first task in creating a density map is to fit the two lines of the density sensitive ratio with eis_auto_fit. For this example we will consider the Fe XII (186.85+186.89)/195.12 density diagnostic. Note that the 186.85 and 186.89 lines are blended in the EIS spectrum and are fit with a single Gaussian.

```wd195=eis_getwindata(l1name, 195.12, /refill)
wd186=eis_getwindata(l1name, 186.88, /refill)
```
```eis_auto_fit, wd195, fit195
eis_auto_fit, wd186, fit186
```

Before generating a density map we first need to obtain the theoretical curve that relates the emission line ratio to density. The CHIANTI atomic database is needed for this step so first please ensure that CHIANTI is part of your Solarsoft distribution.

To derive the theoretical ratio curve, do:

```ratio=eis_chianti_dens_ratio()
```

a menu will appear on the screen asking you to choose a line ratio. The Fe XII ratio appears as option 2, so type in 2 to select it. (The ratio can also be selected by simply putting 2 as input to eis_chianti_dens_ratio - see the routine header for more details about the inputs to the routine.)

The output 'ratio' is a structure containing the ratio as a function of density as well as other information. You can plot this ratio by doing:

```plot, ratio.dens, ratio.ratio
```

The density map can now be generated:

```dens=eis_density(fit195, fit186, ratio)
```

'dens' is another IDL structure with tags:

Tag Description
dens Electron number density (cm-3)
ldens Log (to base 10) of density
lo Low density corresponding to 1-sigma errors on ratio
hi High density corresponding to 1-sigma errors on ratio
ratio The ratio values
coldepth The plasma column depth (cm)

Usually plotting the logarithm of the density gives the best image:

```plot_image, dens.ldens, min=8.5, max=10.0
```

More details about how the density and column depth are computed are given in EIS Software Note #15 .