I have been trying to cross correlate two spectra with the intent of finding the radial velocity of one relative to the other. I’ve been working on a Python code to do this for some time, but was having complications. Although there is clearly a shift between the two spectra, the numpy cross correlation function that the code uses kept coming up with a shift of zero. I recently came across the concept of “regularizing” data on a python help website. Someone was having a similar problem (coming up with a cross correlation result of a zero shift), and it was pointed out that they weren’t regularizing their data. To regularize data is to subtract off the mean, and divide by the standard deviation. I tried doing this in my code, and it actually started to work, and give me very nice answers! The problem is that I don’t particularly understand why this makes the cross correlation work.

Is anyone familiar with the concept of regularizing data? Or has anyone had a similar problem regarding cross correlations?