I am trying to implement a programm, that derives the kinematics (specifically the kinematic parameters: mean rotation velocity, velocity, dispersion, hermite coefficients h3 and h4) from an elliptical galaxy spectrum. I know this has been implemented in many ways, the most common one in recent times beeing ppxf, but I want to do it for educational purposes. I started by working with a spectrum(variablename = spec) of a K2III star (since they are quite common in early type galaxies), I removed the continuum of the spectrum and rebinned it to a logarithmic wavelength size. Then I created an artifical galaxy spectrum (variablename = spec_gal), by broadening my stellar spectrum with a gaussian losvd with a dispersion of 200 km/s. I therefore just calculated the convolution between the stellar spectrum and the losvd using np.convolve().

spec_gal = np.convolve(losvd_gauss, spec, mode='same')

enter image description here

enter image description here Why do the flux values become so small when I convolve the losvd with the spectrum, it should just broaden the absorption lines, shouldn't it ? I suppose that is because I multiply small values of my losvd with the spectral values.

As a small test, I know wanted to obtain back my losvd from the synthetic galaxy spectrum using fourier transformation. Since convolution is multiplicative in fourier space I thought, I could just calculate the fourier transforms of my spectra using scipy.fft().

spec_fourier = fft(spec)
spec_gal_fourier = fft(spec_gal)

And derive the losvd in fourier-space by dividing my galaxy spectrum in fourier space by the stellar spectrum.

 losvd_fourier = spec_gal_fourier/spec_fourier

I have plotted the np.abs() values of my fourier transformed spectraenter image description here I thought i could recover my losvd by just performing the inverse fourier transform using scipy.ifft().

losvd = ifft(losvd_fourier)

Which is not giving me the correct result (see last plot below) and i would be grateful for remarks, comments and hints on possible errors in theory and implementation.enter image description here

  • 1
    $\begingroup$ I'm sure you'll get an answer here, but just fyi there is also a Scientific Computing SE site as well which is great for numerical questions. By the way what happens if you first normalize your Gaussian convolution kernel to unit area? e.g. g = g / g.sum() I did a quick test on some simple data and that seems to be at least close to the right thing to do. $\endgroup$
    – uhoh
    Jun 11, 2021 at 10:04
  • 1
    $\begingroup$ I am actually wondering why my gaussian kernel is not normalized in the first place since I have defined my gaussian losvd with the standard gauss normalization N = 1/sqrt(2pi*sigma^2). Your suggestion resolves the question with the tiny values for my synthetic galaxy spectrum, but the final problem still stands. $\endgroup$
    – trynerror
    Jun 11, 2021 at 10:25
  • $\begingroup$ You may have accidentally just left the $\sigma^2$ outside of the square root. Anyway I am confident someone will be able to address your main question. $\endgroup$
    – uhoh
    Jun 11, 2021 at 10:31

1 Answer 1


There were a few mistakes in the treatment of my spectra before fourier transform in the first place. So missing steps were:

1.) The spectra should be averaged to 0 by subtracting the median.

2.) You should tap the spectra at the edges with a window function (e.g. np.blackman())

3.) Cut off pixels at both ends of spectra to avoid discontinuties

Then you recover the correct input LOSVD, using the simple division deconvolution method in fourier space.

  • 1
    $\begingroup$ Congratulations! It's always okay to answer your own question, and if say a week passes and no further answers show up (as is likely in this case) just go ahead and accept your own answer. $\endgroup$
    – uhoh
    Jun 23, 2021 at 1:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .