<p>But <span class="math-container">$\Delta \lambda$</span> <em>does</em> depend on <span class="math-container">$\lambda_0$</span>. The wavelength redshift is <em>not</em> a uniform value.</p>
<p>In order to (correctly) do the redshift estimation by cross-correlation, your spectra should have been binned into bins of constant <span class="math-container">$\Delta \log \lambda$</span>, such that the relation between bin number and wavelength is
<span class="math-container">$$ n = A \log \lambda  + B $$</span>
rather than
<span class="math-container">$$ n = A\lambda + B$$</span>
(see section III of the canonical <a href="https://ui.adsabs.harvard.edu/abs/1979AJ.....84.1511T/abstract" rel="nofollow noreferrer">Tonry &amp; Davis 1979</a>).</p>
<p>When binned in this way then you <em>can</em> apply a uniform velocity shift/redshift to all the pixels.</p>
<p>See <a href="https://astronomy.stackexchange.com/questions/16266/how-do-i-apply-a-velocity-shift-to-a-wavelength-array-with-uniform-logarithmic-s">How do I apply a velocity shift to a wavelength array with uniform logarithmic spacing?</a> and <a href="https://astronomy.stackexchange.com/questions/14518/why-do-linear-velocity-redshifts-correspond-to-linear-pixel-shifts-when-the-spec">Why do linear velocity redshifts correspond to linear pixel shifts when the spectra are binned in constant log wavelength?</a></p>

CC BY-SA 4.0
2022-06-15T08:32:10.967Z
First I am not quite sure if I really understand why the redshift is not the same over all the spectrum. The cosmological redshift due to expansion should act uniform on all wavelength areas right?
trynerror
CC BY-SA 4.0
2022-06-15T08:36:50.430Z
Second, I have added the function that computes the redshift to my question. The redshift I get agrees with observations. But if I want to shift my wavelength array to the restframe using: loglam_gal - delta_loglam. The peeks of the spectral lines of galaxy and template not match up. The delta_loglam I receive from my function seems to be to small. Can you spot any mistake ?
trynerror
CC BY-SA 4.0
2022-06-15T09:36:29.600Z
@trynerror The shift, $\Delta \lambda$ is not a constant. Redshift *multiplies* the wavelength by a fixed value.
ProfRob
CC BY-SA 4.0
2022-06-15T10:46:56.763Z
I guess my question for the application is then, how do I shift my galaxywavelengtharray to the rest frame so that for example the peaks of the MG-triplet match up with the peaks of my template star.
trynerror
CC BY-SA 4.0
2022-06-15T11:01:24.707Z
@trynerror you can't "shift" it by a uniform amount of you have adoped linear binning. You multiply each wavelength value by $1+z$.
ProfRob
CC BY-SA 4.0
2022-06-14T14:02:39.073Z
2022-06-15T09:43:58.527Z
2022-06-15T09:43:58.527Z
ProfRob
<p>I have the central line of the spectrum of an elliptical galaxy (NGC:4697) and a template K-star. I have calculated the redshift z by computing the crosscorrelation function between the galaxy and the template star(blue) and the auto-correlation function of the template (orange), the x-axis is velocity <span class="math-container">$v \approx c*z$</span>.<a href="https://i.sstatic.net/gBDko.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gBDko.png" alt="enter image description here" /></a>
In nonrelativistic approximation: <span class="math-container">$\Delta v \approx c*z$</span> giving me <span class="math-container">$z = 0.0041$</span>.
The redshift also is: <span class="math-container">$z = \frac{\Delta \lambda}{\lambda_{0}} = \frac{\Delta v}{c}$</span>. I want an expression for <span class="math-container">$\Delta \lambda = z* \lambda_{0}$</span> to be able to shift my galaxy spectrum to the restframe for a plot.The problem is which wavelength <span class="math-container">$\lambda{0}$</span> to use in this formula? I tried one case for taking <span class="math-container">$\lambda_{0} = 518.364 nm$</span> (one line of the Mg-triplet) and got almost matching peaks for galaxy(shifted to restframe) and template. How can I compute <span class="math-container">$\Delta \lambda$</span> in general without the need of a specific <span class="math-container">$\lambda_0$</span>?</p>
<p>Plot before shifting
<a href="https://i.sstatic.net/gx2QU.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gx2QU.png" alt="enter image description here" /></a></p>
<p>Edit: function for computing the redshift and wavelength shift</p>
<pre><code>   def calc_redshift(vel_corr, corr_gal_tem):
    &quot;&quot;&quot;calculate the galaxies redshift by looking at the shifted peaks from the correlation functions&quot;&quot;&quot;
    c = 299792.458                              # speed of light in km/s
    vel_rad = vel_corr[np.argmax(corr_gal_tem)] # velocity value of the peak from the ccf between galaxy and template
    delta_loglam = np.log(1 + (vel_rad/c))      # shift in logarithmic wavelength
    z = np.exp(delta_loglam)-1                  # redshift
    return z, delta_loglam
</code></pre>

<observational-astronomy><galaxy><redshift>
redshift puzzle
trynerror
# redshift puzzle

(Asked by: username_0 on 2022-06-14)

I have the central line of the spectrum of an elliptical galaxy (NGC:4697) and a template K-star. I have calculated the redshift z by computing the crosscorrelation function between the galaxy and the template star(blue) and the auto-correlation function of the template (orange), the x-axis is velocity $v \approx c*z$.
In nonrelativistic approximation: $\Delta v \approx c*z$ giving me $z = 0.0041$.
The redshift also is: $z = \frac{\Delta \lambda}{\lambda_{0}} = \frac{\Delta v}{c}$. I want an expression for $\Delta \lambda = z* \lambda_{0}$ to be able to shift my galaxy spectrum to the restframe for a plot.The problem is which wavelength $\lambda{0}$ to use in this formula? I tried one case for taking $\lambda_{0} = 518.364 nm$ (one line of the Mg-triplet) and got almost matching peaks for galaxy(shifted to restframe) and template. How can I compute $\Delta \lambda$ in general without the need of a specific $\lambda_0$?
Plot before shifting

Edit: function for computing the redshift and wavelength shift
   def calc_redshift(vel_corr, corr_gal_tem):
    """calculate the galaxies redshift by looking at the shifted peaks from the correlation functions"""
    c = 299792.458                              # speed of light in km/s
    vel_rad = vel_corr[np.argmax(corr_gal_tem)] # velocity value of the peak from the ccf between galaxy and template
    delta_loglam = np.log(1 + (vel_rad/c))      # shift in logarithmic wavelength
    z = np.exp(delta_loglam)-1                  # redshift
    return z, delta_loglam

**Tags:** observational-astronomy, galaxy, redshift

---

## 1 answers

### Answer by username_1 on 2022-06-14. Score: 3 | Accepted answer

But $\Delta \lambda$ *does* depend on $\lambda\_0$. The wavelength redshift is *not* a uniform value.

In order to (correctly) do the redshift estimation by cross-correlation, your spectra should have been binned into bins of constant $\Delta \log \lambda$, such that the relation between bin number and wavelength is
$$ n = A \log \lambda + B $$
rather than
$$ n = A\lambda + B$$
(see section III of the canonical [Tonry & Davis 1979](https://ui.adsabs.harvard.edu/abs/1979AJ.....84.1511T/abstract)).

When binned in this way then you *can* apply a uniform velocity shift/redshift to all the pixels.

See [How do I apply a velocity shift to a wavelength array with uniform logarithmic spacing?](https://astronomy.stackexchange.com/questions/16266/how-do-i-apply-a-velocity-shift-to-a-wavelength-array-with-uniform-logarithmic-s) and [Why do linear velocity redshifts correspond to linear pixel shifts when the spectra are binned in constant log wavelength?](https://astronomy.stackexchange.com/questions/14518/why-do-linear-velocity-redshifts-correspond-to-linear-pixel-shifts-when-the-spec)

> **Comments:**
> **username_0**: First I am not quite sure if I really understand why the redshift is not the same over all the spectrum. The cosmological redshift due to expansion should act uniform on all wavelength areas right?  
> **username_0**: Second, I have added the function that computes the redshift to my question. The redshift I get agrees with observations. But if I want to shift my wavelength array to the restframe using: loglam_gal - delta_loglam. The peeks of the spectral lines of galaxy and template not match up. The delta_loglam I receive from my function seems to be to small. Can you spot any mistake ?  
> **username_1**: @trynerror The shift, $\Delta \lambda$ is not a constant. Redshift *multiplies* the wavelength by a fixed value.  
> **username_0**: I guess my question for the application is then, how do I shift my galaxywavelengtharray to the rest frame so that for example the peaks of the MG-triplet match up with the peaks of my template star.  
> **username_1**: @trynerror you can't "shift" it by a uniform amount of you have adoped linear binning. You multiply each wavelength value by $1+z$.  

---

