Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Mar 5, 2021

Conversation

jucordero
Copy link
Contributor

@jucordero jucordero commented Mar 3, 2021

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
Copy link
Contributor

@rrjbca rrjbca left a comment

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?

skypy/power_spectrum/_eisenstein_hu.py Outdated Show resolved Hide resolved
skypy/power_spectrum/_eisenstein_hu.py Outdated Show resolved Hide resolved
skypy/power_spectrum/_eisenstein_hu.py Outdated Show resolved Hide resolved
@rrjbca rrjbca changed the title Fixed wavenumber definition in E&Hu model BUG: Fixed wavenumber definition and amplitude scaling in Eisenstein & Hu model Mar 4, 2021
skypy/power_spectrum/_eisenstein_hu.py Outdated Show resolved Hide resolved
@rrjbca rrjbca dismissed Lucia-Fonseca’s stale review March 4, 2021 13:03

Review does not request any changes

skypy/power_spectrum/_eisenstein_hu.py Outdated Show resolved Hide resolved
skypy/power_spectrum/_eisenstein_hu.py Outdated Show resolved Hide resolved
Copy link
Contributor

@rrjbca rrjbca left a comment

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

Copy link
Member

@Lucia-Fonseca Lucia-Fonseca left a comment

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent wavenumber units and power spectrum normalisations
4 participants