Skip to content

BUG: Fixed wavenumber definition and amplitude scaling in Eisenstein & Hu model#445

Merged
rrjbca merged 5 commits into
skypyproject:module/power_spectrumfrom
jucordero:eisenstein_hu
Mar 5, 2021
Merged

BUG: Fixed wavenumber definition and amplitude scaling in Eisenstein & Hu model#445
rrjbca merged 5 commits into
skypyproject:module/power_spectrumfrom
jucordero:eisenstein_hu

Conversation

@jucordero

@jucordero jucordero commented Mar 3, 2021

Copy link
Copy Markdown
Contributor

Description

The Eisenstein & Hu approximation for the linear matter power spectrum now assumes the input wavenumber vector to be in units of Mpc instead of Mpc/h (See ADR-2)

The overall amplitude was also missing factors of h. This has now been fixed such that multiplying eisenstein_hu by the square of growth_function_carroll gives a power spectrum that closely matches CAMB and CLASS.

This addresses issue #442

from astropy.cosmology import Planck18
from matplotlib import pyplot as plt
import numpy as np
from skypy.power_spectrum import camb, eisenstein_hu, growth_function_carroll

k = np.logspace(-3, -1, 50)
z, A_s, n_s = 0, 2.2E-9, 0.97

p_camb = camb(k, z, Planck18, A_s, n_s)
p_eh = eisenstein_hu(k, A_s, n_s, Planck18)
d = growth_function_carroll(z, Planck18)

plt.plot(k, p_camb, label='CAMB')
plt.plot(k, p_eh * d * d, label='Eisenstein-Hu')
plt.loglog()
plt.legend()
plt.show()

Returns a power spectrum which has the correct wavenumbers and amplitude
download

Checklist

  • Follow the Contributor Guidelines
  • Write unit tests
  • Write documentation strings
  • Assign someone from your working team to review this pull request
  • Assign someone from the infrastructure team to review this pull request
@jucordero jucordero closed this Mar 3, 2021
@jucordero jucordero reopened this Mar 3, 2021
@rrjbca rrjbca requested review from a team March 3, 2021 16:40
@rrjbca rrjbca added bug Something isn't working module: power spectrum labels Mar 3, 2021
@rrjbca rrjbca linked an issue Mar 3, 2021 that may be closed by this pull request

@rrjbca rrjbca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions for improved clarity. Could you also confirm where the updated numerical values for test_eisenstein_hu came from? Did you re-calculate them using cosmosis for the correct wavenumbers?

Comment thread skypy/power_spectrum/_eisenstein_hu.py Outdated
Comment thread skypy/power_spectrum/_eisenstein_hu.py Outdated
Comment thread skypy/power_spectrum/_eisenstein_hu.py Outdated
@rrjbca rrjbca changed the title Fixed wavenumber definition in E&Hu model Mar 4, 2021
Comment thread skypy/power_spectrum/_eisenstein_hu.py Outdated
@rrjbca rrjbca dismissed Lucia-Fonseca’s stale review March 4, 2021 13:03

Review does not request any changes

Comment thread skypy/power_spectrum/_eisenstein_hu.py Outdated
Comment thread skypy/power_spectrum/_eisenstein_hu.py Outdated

@rrjbca rrjbca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks @jucordero @Lucia-Fonseca @ntessore for working on this

@Lucia-Fonseca Lucia-Fonseca left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me too!

@rrjbca rrjbca merged commit 2e45160 into skypyproject:module/power_spectrum Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working module: power spectrum

4 participants