Skip to content

Commit b0bead9

Browse files
author
Andrew Hearin
committed
Added documentation deriving z-space distortion formula
1 parent 98efcce commit b0bead9

File tree

3 files changed

+82
-3
lines changed

3 files changed

+82
-3
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
:orphan:
2+
3+
.. _zspace_distortion_derivation:
4+
5+
****************************************************
6+
Derivation of z−space Distortions in Simulation Data
7+
****************************************************
8+
9+
In this section of the documentation we derive a simple expression for how to apply z-space distortions to the usual comoving Cartesian coordinates of a simulation. Suppose you have a set of :math:`x_{\rm com}, y_{\rm com}, z_{\rm com}` points in co-moving coordinates in a cosmological simulation. Let the redshift of the snapshot be :math:`z_{\rm true-redshift}`, and the peculiar velocity in the z-direction be :math:`v_{\rm z}`. Using the distant-observer approximation and treating the z-dimension as the line-of-sight, these notes derive the following expression for the z-coordinate in redshift-space:
10+
11+
.. math::
12+
13+
z^{z-{\rm space}}_{\rm com} = z_{\rm com} + \frac{(1+z_{\rm true-redshift})}{H(z_{\rm true-redshift})}v_{\rm z}
14+
15+
The first part of the derivation is repeated from the textbook Mo, van den Bosch and White (2010), section 3.1.4 on peculiar velocities. For an observer in the cosmic rest frame at :math:`z_{\rm true-redshift},` a galaxy at :math:`z_{\rm true-redshift}` moving with peculiar velocity :math:`v_{\rm z}` will be Doppler shifted according to :math:`1 + z_{\rm redshift}^{\rm pec} = \sqrt{\frac{1 + v_{\rm z}/c}{1 - v_{\rm z}/c}}.` On Earth we are observing that galaxy from the vantage of z=0, then we have:
16+
17+
.. math::
18+
1 + z_{\rm redshift}^{\rm obs} = (1 + z_{\rm redshift}^{\rm pec})(1 + z_{\rm true-redshift}).
19+
20+
Provided that the peculiar velocity of the galaxy is non-relativistic (which should be true even in cluster environments), then :math:`z_{\rm redshift}^{\rm pec}=v_{\rm z}/c`, and we have
21+
22+
.. math::
23+
z_{\rm redshift}^{\rm obs} = z_{\rm redshift}^{\rm true} + \frac{v_{\rm z}}{c}(1 + z_{\rm true-redshift}).
24+
25+
Now what we want to do is calculate how we should shift :math:`z_{\rm com}` in accord with
26+
27+
.. math::
28+
\delta z_{\rm redshift} \equiv z_{\rm redshift}^{\rm obs}-z_{\rm redshift}^{\rm true}.
29+
30+
To do that, we just take the difference in their comoving distances,
31+
32+
.. math::
33+
\delta D_{\rm com} = D_{\rm com}(z_{\rm redshift}^{\rm obs}) - D_{\rm com}(z_{\rm redshift}^{\rm true}),
34+
35+
where
36+
37+
.. math::
38+
D_{\rm com}(z) \equiv \frac{c}{H_0} \int_{0}^{z}\frac{dz'}{E(z')},
39+
40+
with :math:`H(z) \equiv H_0 E(z),` where :math:`H_0 = 100h{\rm km/s/Mpc}` is the Hubble constant and the function :math:`E(z)` is implemented by the `astropy.cosmology.FLRW.efunc` function.
41+
42+
Taking the difference gives
43+
44+
.. math::
45+
\delta D_{\rm com} = \frac{c}{H_0}\int_{0}^{z_{\rm redshift}^{\rm obs}}\frac{dz'}{H_0 E(z')} - \frac{c}{H_0}\int_{0}^{z_{\rm redshift}^{\rm true}}\frac{dz'}{H_0 E(z')}
46+
47+
.. math::
48+
\delta D_{\rm com} = \frac{c}{H_0}\int_{z_{\rm redshift}^{\rm true}}^{z_{\rm redshift}^{\rm obs}}\frac{dz'}{E(z')}
49+
50+
Since :math:`\delta z_{\rm redshift} = \frac{v_{\rm z}}{c}(1+z_{\rm redshift}^{\rm true})` is typically a very small interval for peculiar velocities relevant to galaxies at observable redshifts, then due to the smoothness of the Hubble rate :math:`E(z)` we can approximate the above integral by treating :math:`E(z)` as a constant-valued :math:`E(z_{\rm redshift})`:
51+
52+
.. math::
53+
\delta D_{\rm com} \approx c\delta z_{\rm redshift}/H(z_{\rm redshift}^{\rm true})
54+
55+
.. math::
56+
\delta D_{\rm com} \approx \frac{(1+z_{\rm redshift}^{\rm true})}{H(z_{\rm redshift}^{\rm true})}v_{\rm z}
57+
58+
Now that we have seen the analytical derivation, let's see how this maps onto Halotools source code. The line of code in the `~halotools.mock_observables.apply_zspace_distortion` function implementing this behavior appears as follows:
59+
60+
.. code-block:: python
61+
62+
pos_err = peculiar_velocity/100./cosmology.efunc(redshift)/scale_factor
63+
64+
The ``pos_err`` variable stores the value of :math:`\delta D_{\rm com}`, and ``1/scale_factor`` is equal to :math:`1+z_{\rm redshift}^{\rm true}`. The ``cosmology.efunc(redshift)`` variable stores the `astropy.cosmology.FLRW.efunc` implementation of :math:`E(z).` Since Halotools adopts the convention that :math:`h=1,` then :math:`H(z_{\rm redshift}^{\rm true}) = 100hE(z) = 100E(z).`
65+
66+
The `~halotools.mock_observables.return_xyz_formatted_array` function implements the result of the same expression stored in the ``spatial_distortion`` variable.
67+

halotools/mock_observables/catalog_analysis_helpers.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ def return_xyz_formatted_array(x, y, z, period=np.inf,
180180
181181
>>> pos = return_xyz_formatted_array(x, y, z, period=Lbox, velocity=velocity, velocity_distortion_dimension='z', redshift=1.5)
182182
183+
Notes
184+
-----
185+
See :ref:`zspace_distortion_derivation`.
183186
184187
"""
185188
period = np.atleast_1d(period)
@@ -234,9 +237,17 @@ def return_xyz_formatted_array(x, y, z, period=np.inf,
234237

235238

236239
def apply_zspace_distortion(true_pos, peculiar_velocity, redshift, cosmology, Lbox=None):
237-
""" Apply redshift-space distortions to the comoving simulation coordinate,
240+
r""" Apply redshift-space distortions to the comoving simulation coordinate,
238241
optionally accounting for periodic boundary conditions.
239242
243+
This function implements the following formula:
244+
245+
.. math::
246+
247+
s_{\rm com}^{\rm z-space} = s_{\rm com}^{\rm true} + \frac{1 + z}{H(z)}v_{\rm pec}
248+
249+
See :ref:`zspace_distortion_derivation` to see where this formula comes from.
250+
240251
Parameters
241252
----------
242253
true_pos : ndarray

halotools/mock_observables/tests/test_catalog_analysis_helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,9 @@ def test_return_xyz_formatted_array3():
289289

290290

291291
def test_return_xyz_formatted_array4():
292-
""" Verify that the internals of return_xyz_formatted_array agree with the
293-
results returned by the standalone implementation
292+
""" Verify consistent behavior between
293+
the `~halotools.mock_observables.return_xyz_formatted_array` function and the
294+
independently-written `~halotools.mock_observables.return_xyz_formatted_array` function.
294295
"""
295296
npts = int(1e4)
296297
x = np.linspace(0.001, 0.999, npts)

0 commit comments

Comments
 (0)