Date: Fri, 27 Oct 2006 10:38:14 -0400 (EDT)
From: Hermine Landt <hlandt@head.cfa.harvard.edu ([email]hlandt@head.cfa.harvard.edu[/email])>
To: Mike Fitzpatrick <fitz@tucana.tuc.noao.edu ([email]fitz@tucana.tuc.noao.edu[/email])>
Subject: Re: adding two spectra in SPLOT
hi Mike,
I have problems using the ability of SPLOT to perform arithmetics with two
spectra. I send you attached the two spectra I am trying to add by typing
in SPLOT 'f' and then '+', specifying a second spectrum. Nothing happens.
The spectrum remains unchanged. With subtraction '-' is the same and '/'
gives me a straight line at zero intensity.
thank you in advance for a quick help on this,
Hermine
----------------------------------------------------------------
Hermine Landt
Harvard-Smithsonian E-mail: hlandt@cfa.harvard.edu ([email]hlandt@cfa.harvard.edu[/email])
Center for Astrophysics Phone: +1-617-496-7824
60 Garden Street, MS-70 Fax: +1-617-495-7356
Cambridge, MA 02138, USA
http://hea-www.harvard.edu/~hlandt/
----------------------------------------------------------------[b:e66374687e]From: [/b:e66374687e]Frank Valdes <valdes@noao.edu ([email]valdes@noao.edu[/email])>
[b:e66374687e]Date: [/b:e66374687e]October 27, 2006 9:52:41 AM MST
[b:e66374687e]To: [/b:e66374687e]hlandt@head.cfa.harvard.edu ([email]hlandt@head.cfa.harvard.edu[/email])
[b:e66374687e]Cc: [/b:e66374687e]Mike Fitzpatrick <fitz@tucana.tuc.noao.edu ([email]fitz@tucana.tuc.noao.edu[/email])>
[b:e66374687e]Subject: [/b:e66374687e][b:e66374687e]Re: adding two spectra in SPLOT[/b:e66374687e]
Hi Hermine,
Mike forwarded your problem to me. This turned out to be an interesting and subtle bug. Your spectra have a wavelength WCS which includes a directive that the spectra be displayed in Angstroms though the natural units of the WCS are microns. The bug in your case is that the second spectrum is being applied to the first spectrum using units of microns though the first spectrum is in units of Angstroms. This means that it appears the second spectrum does not overlap the first spectrum resulting in a zero spectrum being used; i.e. spec1 +-*/ 0. The division case gives you identically one because the error checking for division by zero is to substitute a value of 1.
This problem has been fixed and is documented in the bug log below. The workaround for you is when you are in SPLOT do ":units micron" before you enter the 'f' mode. There are other possiblities such as using DISPCOR to linearize both your spectra. This is how I discovered the
source of the problem because DISPCOR removed the display units and then SPLOTing this showed them in microns and not Angstroms.
Yours,
Frank Valdes
NUMBER: 556
MODULE: splot, sarith, scombine, standard
SYSTEM: -V2.13Beta
DATE: Fri Oct 27 09:33:16 MST 2006
FROM: valdes
BUG: When matching one spectrum to another, the reference spectrum,
for some operation (e.g. arithmetic, combining, standard star
calibration) the first spectrum is converted to its natural
WCS units. If the reference spectrum is in different units
the result will be wrong. This is rare but a particular case
is when SPLOT displays a spectrum in some units, possibly set
by the display units in the header or by the task parameter,
and then a binary arithmetic operation is performed using a
second spectrum. Even if the second spectrum has the same
display units it may be resampled to match the reference
spectrum in the wrong units. The code solution is to always
resample in the current units of the reference spectrum.
The workaround for the SPLOT example is to use the ":units"
command to put the initial spectrum into the natural units
of the second spectrum. After the arithmetic you can changes
the units back if desired.
STATUS: Fixed for a future release.