# Using spectral line indexes

Once we have identified a line from some species in our spectral survey, we may want to search for other lines of that species at different frequencies. For this, Weeds allows to create a line index, which works in a similar way as CLASS scan indexes. Scan indexes are created by the CLASS `find` command and they are listed by the `list` command. A given scan from the current index can then be loaded and plotted using the `get` and `plot` commands. Likewise, line indexes are created with the `lfind` command, listed with the `llist` command, and a given line may be loaded and plotted using the `lget` and `lplot` commands.

For example, let's assume that we have identified a methanol line on the spectrum shown on Fig. 1, and that we want to see if other methanol lines are present in the spectrum (which covers frequencies between 90 and 100 GHz). The methanol line index is built with:

    [fontsize=\scriptsize]
    LAS90> lfind "CH3OH, vt=0,1"
    I-SELECT,  36 lines found in the frequency range 89999.6813201 to 100000.269737 MHz

and then listed with:

    [fontsize=\scriptsize]
    LAS90> llist
      # Species         Freq[MHz] Err[MHz] Eup[K]  Gup  Aij[s-1]    Upper level -- Lower level    Origin
      1 CH3OH, vt=0,1   90295.864   1.754  1234.0   47  1.12e-08    23 +8 15  1 -- 23 +6 17  1    cdms
      2 CH3OH, vt=0,1   90812.387   0.232   808.3   41  2.81e-06    20 -3 17  1 -- 19 -2 17  1    cdms
      3 CH3OH, vt=0,1   91254.686   0.010   514.3   41  5.31e-08    20 -2 19  0 -- 20 +2 18  0    cdms
      4 CH3OH, vt=0,1   92409.579   0.019    44.3    9  5.10e-10     4 +1  3  0 -- 3 -2  2  0     cdms
    (...)
     36 CH3OH, vt=0,1   99776.775   0.649   902.3   41  4.98e-06    20 +3 18  1 -- 21 +4 18  1    cdms

The command prints all methanol lines between 90 and 100 GHz, ordered by increasing rest frequencies. It also builds an internal index containing all these lines. Note that the species name must be typed exactly as it appears in the database and between double quotes, i.e. `"CH3OH, vt=0,1"` in this case.

Like for scans, each line is associated with an entry number, that we can use to load and to plot the line. Since, by default, lines are ordered by frequency, subsequent entry numbers will correspond to lines with increasing frequencies. However, if we search for lines of a given species, it is usually a good idea to look for lines with the lowest upper energy levels, because we expect them to be brighter than higher lying lines. For this, we can re-order the lines by increasing upper level energies using the `/sortby e` option:

    [fontsize=\scriptsize]
    LAS90> lfind "CH3OH, vt=0,1" /sortby e
    I-SELECT,  36 lines found in the frequency range 89999.6813201 to 100000.269737 MHz
    LAS90> llist
      # Species         Freq[MHz] Err[MHz] Eup[K]  Gup  Aij[s-1]    Upper level -- Lower level    Origin
      1 CH3OH, vt=0,1   96741.375   0.005     7.0    5  3.41e-06     2  0  2 +0 -- 1  0  1 +0     cdms
      2 CH3OH, vt=0,1   96739.362   0.005    12.5    5  2.56e-06     2 -1  2  0 -- 1 -1  1  0     cdms
      3 CH3OH, vt=0,1   96744.550   0.005    20.1    5  3.41e-06     2 +0  2  0 -- 1 +0  1  0     cdms
      4 CH3OH, vt=0,1   95914.309   0.005    21.4    5  2.49e-06     2  1  2 +0 -- 1  1  1 +0     cdms
    (...)
     36 CH3OH, vt=0,1   95523.388   1.982  1289.5   49  1.74e-08    24 +8 16  1 -- 24 +6 18  1    cdms

Since we have already identified the first three lines in the index, let's have a look at another one:

    [fontsize=\scriptsize]
    LAS90> lget 4
    I-LGET,  Found line frequency in the current scan
      # Species         Freq[MHz] Err[MHz] Eup[K]  Gup  Aij[s-1]    Upper level -- Lower level    Origin
      1 CH3OH, vt=0,1   95914.309   0.005    21.4    5  2.49e-06     2  1  2 +0 -- 1  1  1 +0     cdms

The `lget` command modifies the scan frequency so that the velocity axis is centered at the line rest frequency. We can then use:

    [fontsize=\scriptsize]
    LAS90> lplot

which gives the spectrum shown on Fig. 2.

Figure 2: Line displayed with lplot command. The blue vertical line shows the rest frequency of the line. The upper x-axis shows the velocity offset from the line rest frequency.

The `lget` and `lplot` commands allow to quickly “navigate” in a spectral survey to look for the different lines of a given species. `lget f` will load the first line of the index, then `lget n` will get the next one. `lget p` will get the previous one, etc. If you get lost at some point, you can always type `llist` to display the line index again.