# How to do logarithmic wavelength binning (in Python) in order to find redshift?

In Tonry and Davis (1979)(http://adsabs.harvard.edu/abs/1979AJ.....84.1511T), they formulated a cross-correlation method for extracting velocity redshifts. They bin the linear spectra into logarithmic wavelength scale. Similar work was done by Baldry et. al (2014) (https://arxiv.org/abs/1404.2626) and I have inserted relevant excerpt from TD79. I understand that log wavelength binning is a pre-requisite of cross-correlation procedure.

I have been trying to follow this approach and trying to rebin the linear spectra (3000 to 9000 Angstroms) in equal intervals of log wavelength. Could someone please give me a guidance about how to do this logarithmic re-binning in Python?

• I'm voting to close this question as off-topic because this belongs on StackOverflow. It's purely a Python code question – Carl Witthoft Jul 31 '19 at 15:39
• @CarlWitthoft there is no such thing as "closing because it belongs on..." You need to demonstrate that it is off-topic here. Which it is not. This question is about the mathematics of a standard astronomical calculation, and is therefore 100% on-topic. – uhoh Jul 31 '19 at 16:42
• I got as far as $$\frac{dS}{d\log(\lambda)} = \frac{dS}{\frac{1}{\lambda}d\lambda} = \lambda \frac{dS}{d\lambda}$$ but it's 1 AM, that may be the wrong way to go, and I've got to "close up shop" for the night. These days we may not need to re-bin the spectrum so much as we just need to adjust what's plotted. I'll look at this again tomorrow, but I have a hunch someone will be able to write an authoritative answer a lot faster than I, that is unless it gets closed and everyone has to wait for it to be reopened again. – uhoh Jul 31 '19 at 17:11
• @uhoh please just give it a rest. The question specifically says "in Python." Linking that to Astronomy is like claiming a link between jigsaw puzzles and bicycles because there's a puzzle with a picture of a bike. – Carl Witthoft Jul 31 '19 at 18:42
• @CarlWitthoft there are 228 posts that mention python here and 46 questions using the python tag, 16 tagged Astropy and 26 mention Skyfield and 34 mention PyEphem . The mentioning of python does not make a question off-topic. Let's leave it open and get this astronomy question answered! – uhoh Jul 31 '19 at 22:26