Skip to content

Commit

Permalink
analysis doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarrison committed Nov 15, 2023
1 parent 8a7d7b2 commit 3bfe387
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
11 changes: 6 additions & 5 deletions abacusnbody/analysis/power_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
from .cic import cic_serial


__all__ = ['pk_to_xi',
'calc_power',
__all__ = ['calc_power',
'calc_pk_from_deltak',
'pk_to_xi',
'project_3d_to_poles',
'get_k_mu_edges',
'calc_pk_from_deltak',
]

MAX_THREADS = numba.config.NUMBA_NUM_THREADS
Expand Down Expand Up @@ -1093,15 +1093,16 @@ def calc_power(pos,
Returns
-------
power : astropy.Table
The power spectrum in an astropy Table of length ``nbins_k``.
The columns are:
The power spectrum in an astropy Table of length ``nbins_k``. The columns are:
- ``k_mid``: arithmetic bin centers of the k wavenumbers, shape ``(nbins_k,)``
- ``k_avg``: mean wavenumber per (k, mu) wedge, shape ``(nbins_k,nbins_mu)``
- ``mu_mid``: arithmetic bin centers of the mu angles, shape ``(nbins_k,nbins_mu)``
- ``power``: mean power spectrum per (k, mu) wedge, shape ``(nbins_k,nbins_mu)``
- ``N_mode``: number of modes per (k, mu) wedge, shape ``(nbins_k,nbins_mu)``
If multipoles are requested via ``poles``, the table includes:
- ``poles``: mean Legendre multipole coefficients, shape ``(nbins_k,len(poles))``
- ``N_mode_poles``: number of modes per pole, shape ``(nbins_k,len(poles))``
Expand Down
38 changes: 23 additions & 15 deletions abacusnbody/analysis/tpcf_corrfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,32 @@ def tpcf_multipole(s_mu_tcpf_result, mu_bins, order=0):
Examples
--------
For demonstration purposes we create a randomly distributed set of points within a
periodic cube of length 250 Mpc/h.
>>> Npts = 100
>>> Lbox = 250.
>>> x = np.random.uniform(0, Lbox, Npts)
>>> y = np.random.uniform(0, Lbox, Npts)
>>> z = np.random.uniform(0, Lbox, Npts)
periodic cube of length 250 Mpc/h.::
>>> Npts = 100
>>> Lbox = 250.
>>> x = np.random.uniform(0, Lbox, Npts)
>>> y = np.random.uniform(0, Lbox, Npts)
>>> z = np.random.uniform(0, Lbox, Npts)
We transform our *x, y, z* points into the array shape used by the pair-counter by
taking the transpose of the result of `numpy.vstack`. This boilerplate transformation
is used throughout the `~halotools.mock_observables` sub-package:
>>> sample1 = np.vstack((x,y,z)).T
is used throughout the `~halotools.mock_observables` sub-package: ::
>>> sample1 = np.vstack((x,y,z)).T
First, we calculate the correlation function using
`~halotools.mock_observables.s_mu_tpcf`.
>>> from halotools.mock_observables import s_mu_tpcf
>>> s_bins = np.linspace(0.01, 25, 10)
>>> mu_bins = np.linspace(0, 1, 15)
>>> xi_s_mu = s_mu_tpcf(sample1, s_bins, mu_bins, period=Lbox)
Then, we can calculate the quadrapole of the correlation function:
>>> xi_2 = tpcf_multipole(xi_s_mu, mu_bins, order=2)
`~halotools.mock_observables.s_mu_tpcf`.::
>>> from halotools.mock_observables import s_mu_tpcf
>>> s_bins = np.linspace(0.01, 25, 10)
>>> mu_bins = np.linspace(0, 1, 15)
>>> xi_s_mu = s_mu_tpcf(sample1, s_bins, mu_bins, period=Lbox)
Then, we can calculate the quadrapole of the correlation function: ::
>>> xi_2 = tpcf_multipole(xi_s_mu, mu_bins, order=2)
"""

# process inputs
Expand Down

0 comments on commit 3bfe387

Please sign in to comment.