next up previous
Next: Displaying More Than One Spectrum
Up: Dealing With Multiple Spectra
Previous: Dealing With Multiple Spectra

Averaging Several Spectra

  SPECX is able to average only two spectra at a time. If you want to average several spectra you will have to do a little juggling with the stack.

For example, if I want to average spectra 1 through 5, I would have to do the following. Read in spectrum 1, read in spectrum 2, average them, read spectrum 3, average again, read spectrum 4, average, read 5 and average one more time.

Thus to average five spectra (131, 132, 133, 134 and 135, say) you would type:

$\gt\!\gt$ r-g-d 131
$\gt\!\gt$ r-g-d 132; ave
$\gt\!\gt$ r-g-d 133; ave
$\gt\!\gt$ r-g-d 134; ave
$\gt\!\gt$ r-g-d 135; ave

Generally, if you have learned to put all the necessary commands on one line you can repeat the sequence of using the `up-arrow' key and editing the line. If you have to do it very often, it would probably be smart to write a command file (see Section [*]) or an in-line do-loop (see Section [*]) to do it for you. Such a do-loop might go like this:

>> r-g-d 131
>> do i 132 133
 Enter commands to do, line at a time, EOF to finish
 insert >> r-g-d i
 insert >> ave
 insert >>
This would then average your spectra. Certainly less typing if you have a lot of spectra in sequence(s) to average. Note that having done the do-loop once creates a file called temp.spx which does the same thing as the do-loop we just made. So if you had two more groups of spectra (say, 138-143 and 145-150) to average with the preceding average, just type

$\gt\!\gt$ @temp 138 143
$\gt\!\gt$ @temp 145 150

to complete the set of spectra to be averaged.



next up previous
Next: Displaying More Than One Spectrum
Up: Dealing With Multiple Spectra
Previous: Dealing With Multiple Spectra

Specx Cookbook Reduction of millimetre wave data
Starlink Cookbook 8
Henry Matthews, Tim Jenness
1st March 1997
E-mail:ussc@star.rl.ac.uk

Copyright © 2005 Council for the Central Laboratory of the Research Councils