<p>I am trying to extract the kinematic parameters (rotation velocity, velocity dispersion, ...) of an elliptical galaxy by extracting the kinematical broadening function using the FCQ-Algortihm first described by Bender 1990: (<a href="https://ui.adsabs.harvard.edu/abs/1990A%26A...229..441B/abstract" rel="nofollow noreferrer">https://ui.adsabs.harvard.edu/abs/1990A%26A...229..441B/abstract</a>)</p>
<p>I am therefore using the central line spectra of the elliptical galaxy NGC 4697 and the 1D template spectra of the K2-III star HD 132345. After some preprocessing steps I calculated the cross correlation function between the galaxy and the template and extracted the peak of it.</p>
<p><a href="https://i.sstatic.net/mv4ho.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mv4ho.png" alt="enter image description here" /></a><a href="https://i.sstatic.net/Pk9ch.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Pk9ch.png" alt="enter image description here" /></a></p>
<p>I calculated the velocity spacing per pixel and the velscale is approximately 30 km/s per pixel. I</p>
<p>Now I have to transform the peak of the correlation function into fourierspace:</p>
<pre><code>from numpy.fft import fft as fourier, ifft as ifourier
corr_gal_tem_peak_fourier = np.fft.fftshift(fourier(corr_gal_tem_peak))
</code></pre>
<p>The plotted resulting powerspectrum (absolute square) in fourierspace has the expected gaussian form, plotting it leaving out the x-values like:<code>plt.plot(np.power(np.abs(corr_gal_tem_peak_fourier), 2))</code> results in:
<a href="https://i.sstatic.net/ReCQE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ReCQE.png" alt="enter image description here" /></a></p>
<p>I now need to fit a model for this powerspectrum to create an optimal Wienerfilter in fourierspace. I therefore need some x-values in fourierspace. I tried to create x-values using np.fft.fftfreq() with:
<code>n = corr_gal_tem_peak.size s = np.fft.fftfreq(n, d=velscale)</code>
Plotting this idea results in this:<a href="https://i.sstatic.net/0p1NM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0p1NM.png" alt="enter image description here" /></a>
Can anybody tell me how to properly create the array for the x-values in fourierspace, they would have unit of s/km ?</p>

CC BY-SA 4.0
2021-09-22T11:50:52.243Z
have you tried using [fftshift](https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html)? From the last plot it looks like your frequency array is sorted in a different way than your porwerspectrum array
Prallax
CC BY-SA 4.0
2021-09-22T12:54:42.990Z
Thank you very much with fftshift it is working.  But I am not sure if I approached it right in general ?
trynerror
<observational-astronomy><galaxy><spectra><python><velocity>
How to find x-values of fourier-transformed correlation functions in velocity space?
trynerror
# How to find x-values of fourier-transformed correlation functions in velocity space?

(Asked by: username_0 on 2021-09-22)

I am trying to extract the kinematic parameters (rotation velocity, velocity dispersion, ...) of an elliptical galaxy by extracting the kinematical broadening function using the FCQ-Algortihm first described by Bender 1990: (https://ui.adsabs.harvard.edu/abs/1990A%26A...229..441B/abstract)
I am therefore using the central line spectra of the elliptical galaxy NGC 4697 and the 1D template spectra of the K2-III star HD 132345. After some preprocessing steps I calculated the cross correlation function between the galaxy and the template and extracted the peak of it.

I calculated the velocity spacing per pixel and the velscale is approximately 30 km/s per pixel. I
Now I have to transform the peak of the correlation function into fourierspace:
from numpy.fft import fft as fourier, ifft as ifourier
corr_gal_tem_peak_fourier = np.fft.fftshift(fourier(corr_gal_tem_peak))

The plotted resulting powerspectrum (absolute square) in fourierspace has the expected gaussian form, plotting it leaving out the x-values like:plt.plot(np.power(np.abs(corr_gal_tem_peak_fourier), 2)) results in:

I now need to fit a model for this powerspectrum to create an optimal Wienerfilter in fourierspace. I therefore need some x-values in fourierspace. I tried to create x-values using np.fft.fftfreq() with:
n = corr_gal_tem_peak.size s = np.fft.fftfreq(n, d=velscale)
Plotting this idea results in this:
Can anybody tell me how to properly create the array for the x-values in fourierspace, they would have unit of s/km ?

**Tags:** observational-astronomy, galaxy, spectra, python, velocity
> **Comments:**
> **username_1**: have you tried using [fftshift](https://numpy.org/doc/stable/reference/generated/numpy.fft.fftshift.html)? From the last plot it looks like your frequency array is sorted in a different way than your porwerspectrum array  
> **username_0**: Thank you very much with fftshift it is working.  But I am not sure if I approached it right in general ?  

---

## 0 answers

