Skip to content

[PHYSICS BUG][CRITICAL] Comoving volume formula wrong: exponent 2→3, prefactor 4π→4π/3 #1

@JasperSeehofer

Description

@JasperSeehofer

File: master_thesis_code/datamodels/galaxy.py:121

Current code:

cv_grid = 4 * np.pi * (SPEED_OF_LIGHT / h0) ** 3 * cumulative_integral**2

Correct formula (Hogg 1999, arXiv:astro-ph/9905116, Eq. 28):
179547V_c(z) = \frac{4\pi}{3} \left(\frac{c}{H_0}\right)^3 \left[\int_0^z \frac{dz'}{E(z')}\right]^3179547

Fix:

cv_grid = (4/3) * np.pi * (SPEED_OF_LIGHT / h0) ** 3 * cumulative_integral**3

Impact: Two compounding errors — the exponent is 2 instead of 3, and the prefactor is 4π instead of 4π/3. The comoving volume scales as z² at low redshift instead of the correct z³. Every downstream use is affected: galaxy sampling in get_samples_from_comoving_volume draws from the wrong redshift distribution, and the background weight p_background = comoving_volume(z) in evaluate_galaxy_distribution uses wrong normalisation, biasing the H₀ likelihood.

Physics Change Protocol: Present old/new formula + dimensional analysis + limiting case for approval before implementing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingphysicsPhysics formula or scientific correctness issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions