Skip to content
Merged
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
4 changes: 4 additions & 0 deletions src/lightcurvelynx/astro_utils/redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def rest_to_obs_flux(flux_density, redshift):
flux_density : numpy.ndarray
The observer frame flux (in nJy).
"""
# Note that the multiplication by (1+z) is due to the fact we are working in f_nu units,
# instead of f_lambda units and may be unintuitive for users who are used to working in f_lambda
# units. This factor can be derived by equaling the integrated flux in f_nu unit before and after
# redshift is applied.
return flux_density * (1 + redshift)


Expand Down
4 changes: 4 additions & 0 deletions tests/lightcurvelynx/astro_utils/test_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def test_redshifted_flux_densities() -> None:

for i, time in enumerate(times):
if t0 <= time and time <= (t1 - t0) * (1 + redshift) + t0:
# Note that the multiplication by (1+z) is due to the fact we are working in f_nu
# units, instead of f_lambda units and may be unintuitive for users who are used to
# working in f_lambda units. This factor can be derived by equaling the integrated
# flux in f_nu unit before and after redshift is applied.
assert np.all(values_redshift[i] == brightness * (1 + redshift))
else:
assert np.all(values_redshift[i] == 0.0)
Expand Down