[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Author Index][Subject Index]

Possible bug in XCORRELATE/IMAGE

Hi there,

I have a question regarding the correlation task amongst the core
commands. I'm currently running MIDAS version 98NOV under Linux. My use of
XCORRELATE/IMAGE has resulted in some confusing results from the output
cross-correlation function. The correlation fraction should be no greater
than one and should have a peak of unity when a spectrum is
cross-correlated with itself (c.f. Equation 2.31 of the MIDAS manual Vol
B) but this is not the result that I obtain.

The fortran code for this task (flip.for) contains on line 955

            SUM = SUM + ( SPEC(J)*TEMP(J+I) )

Should this also be divided the square of the spectrum SPEC(J) as
described in Equation 2.31? This could be done by including the following
code at line 961:

      INC = 1
      DO 40, I=-NSH,NSH
         SUM = 0.D0
         DO 30, J=MPS,MPE
            SUM = SUM + ( SPEC(J)**2 )
30       CONTINUE
         RES(INC) = RES(INC) / SNGL(SUM)
         INC = INC + 1

I haven't been able to try this as I can't seem to compile the source code
under Linux.

Has anyone else had this problem with XCORRELATE/IMAGE?


Stephen Kane

 "I can picture in my mind a world without war, a world without 
 hate. And I can picture us attacking that world, because they'd
 never expect it."

   Stephen Kane                      Physics Department
   http://sol.stsci.edu/~skane/      University of Tasmania
   Email: skane@stsci.edu            GPO Box 252-21
   Ph: (03) 6226 2427                Hobart, TAS  7001
   Fax: (03) 6226 2410               Australia