FFTs of spectra in multispec files (or 1D FFTs of lines in 2D images)
Frank Valdes wrote on Dec 04, 2000
Q: I have a large number of spectra in a multispec format file for
which I would like to compute the FFTs. How can I do this for all the
spectra and preserve the multispec format?
A: The task to compute the FFTs is stsdas.analysis.fourier.forward. This
task, like most tasks outside the specific spectroscopic packages, does not
interpret the multispec format as a collection of 1D spectra but treats
such data as a 2D (or 3D if there are associated elements) image. So
to take the 1D FFTs you need to either use image sections to select the
1D vector or separate out the spectra in to separate 1D files. In order
to preseve the various multispec keywords this needs to be done using
SCOPY. The following script will automate the operation and produce the
real and imaginary parts of the FFT in multispec format. This is
a simple script with filenames hardwired. Edit this as needed for your
data.
--- doit.cl ---
# Extract each line of an echelle format file, take the 1D FFTs, and
# then put the 1D FFTs into a new echelle format file. This quick script
# has the number of lines and the file names hardwired. Turning on the
# verbose flag in SCOPY will show each spectrum being processed. Also
# one could redirect the output of FORWARD to "dev$null" to throw away
# the output.
for (i=1; i<=115; i+=1) {
scopy ("r1.ec[*,"//i//"]", "foo"//i)
forward ("foo"//i, "foo"//i)
}
scopy foo*r.* fftr1r.ec
scopy foo*i.* fftr1i.ec
imdel foo* ver-
---
The same type of logic could be used to take the 1D FFTs of lines (or columns)
in a 2D image. Something like the following could be used. This will
produce essentially the same result as the above script.
for (i=1; i<=115; i+=1)
forward ("myimage[*,"//i//"]", "foo"//i)
imstack foo*r.* fftmyimager
imstack foo*i.* fftmyimagei
imdel foo* ver-
Last post on Dec 04, 2000