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: Overgeneration of galaxies #578

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skypy/galaxies/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def f(lnx, a):
gam[i], _ = scipy.integrate.quad(f, lnxmin[i], np.inf, args=(alpha[i],))

# comoving number density is normalisation times upper incomplete gamma
density = phi_star*gam
density = phi_star*gam*np.power(cosmology.h, 3)

# sample redshifts from the comoving density
return redshifts_from_comoving_density(redshift=redshift, density=density,
Expand Down
2 changes: 1 addition & 1 deletion skypy/galaxies/tests/test_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_schechter_lf_redshift():
x_min = 10.**(-0.4*(M_lim - M_star))

# density with factor from upper incomplete gamma function
density = phi_star*gamma(alpha+1)*gammaincc(alpha+1, x_min)
density = phi_star*gamma(alpha+1)*gammaincc(alpha+1, x_min)*np.power(cosmo.h, 3)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is the right place to account for h. The parameter phi_star has the same dimension [unit] as the luminosity function, which is 1/V/luminosity [commonly Mpc^-3 mag^-1]. That means phi_star must agree with these dimensions/units.

In your example, you are using the parameters of Tortorelli2020. In this work, they are giving phi_star in units of h_70 = H_0/70. So the input parameter must be corrected by this unit. However, as your defined cosmology includes H_0 = 70, h_70 is equal to 1. Therefore, the number that you have in your config files corresponds to units of Mpc^-3 mag^-1, which are as I said the physical units.

If we, however, want to enable phi_star to be given in units of h_0, we would also need to specify this in the documentation. But in this case, the parameter in your config file has the wrong value.


# turn into galaxies/surface area
density *= (sky_area * cosmo.differential_comoving_volume(z)).to_value('Mpc3')
Expand Down