Physics¶
Astrophysical content only — concrete models inherit the ABCs in
liulu.physics.base. See Architecture.
Base classes¶
Real-space correlation¶
liulu.physics.base.RealSpaceCorrelation ¶
Pairwise velocity moments¶
liulu.physics.base.PairwiseVelocityMoments ¶
Bases: ABC
Radial-tangential pairwise velocity moments as functions of r.
Naming convention
m_ij(r): moment about the origin, i-th radial order, j-th tangential order.c_ij(r): central moment, i-th radial order, j-th tangential order.
Odd tangential orders vanish by isotropy and are handled automatically.
Required for Gaussian PDF: m_10, c_20, c_02 Required for skew-t PDF: additionally c_30, c_12, c_40, c_04, c_22
Source code in liulu/physics/base.py
m_10
abstractmethod
¶
c_20
abstractmethod
¶
c_02
abstractmethod
¶
c_30 ¶
c_12 ¶
c_40 ¶
c_04 ¶
c_22 ¶
get_moment ¶
Retrieve a moment by radial/tangential order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
Pair separation. |
required |
r_order
|
int
|
Radial and tangential orders. |
required |
t_order
|
int
|
Radial and tangential orders. |
required |
mode
|
str
|
|
required |
Source code in liulu/physics/base.py
Velocity PDF¶
liulu.physics.base.VelocityPDF ¶
Bases: ABC
Line-of-sight pairwise velocity PDF P(v_los | r_perp, r_par).
Source code in liulu/physics/base.py
__call__
abstractmethod
¶
Evaluate the PDF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v_los
|
ndarray
|
Line-of-sight pairwise velocity (km/s). |
required |
r_perp
|
ndarray
|
Transverse pair separation (Mpc/h). |
required |
r_par
|
ndarray
|
Parallel pair separation (Mpc/h), non-negative. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
PDF values, (km/s)^{-1}. |
Source code in liulu/physics/base.py
Real-space correlation providers¶
TabulatedXi¶
liulu.physics.real_space.TabulatedXi ¶
Bases: RealSpaceCorrelation
Interpolate xi(r) from tabulated data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_table
|
array_like
|
Separation values, Mpc/h. |
required |
xi_table
|
array_like
|
Correlation function values. |
required |
interpolator
|
callable
|
Interpolation factory with signature (r, xi) -> callable.
Defaults to log-log interpolation (:func: |
None
|
tail
|
(zero, power)
|
Large-r extrapolation above the last tabulated point (ignored when a
custom |
"zero"
|
Notes
Interpolation is the hybrid :func:~liulu.numerics.interpolation.loglog_interp:
linear in (log r, log xi) across intervals where both tabulated values are
positive (exact for power laws), and linear in (log r, xi) across any
interval touching xi <= 0 -- so tabulated negative values (BAO zero
crossing, halo-exclusion dip) are honoured exactly, never bridged over or
zeroed. The streaming integral needs xi bounded as r -> 0; the
constant edge fill below r_min guarantees this for tabulated input.
Source code in liulu/physics/real_space.py
Linear-theory / Halofit¶
liulu.physics.real_space.LinearTheoryXi ¶
Bases: RealSpaceCorrelation
xi(r) from linear theory power spectrum via Hankel transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
array_like
|
Wavenumbers, h/Mpc. |
required |
pk
|
array_like
|
Linear power spectrum P(k), (Mpc/h)^3. |
required |
hankel_transform
|
callable
|
Transform function with signature (k, pk, r) -> xi. Defaults to numerics.hankel.pk_to_xi. |
None
|
Source code in liulu/physics/real_space.py
liulu.physics.real_space.HalofitXi ¶
Bases: RealSpaceCorrelation
xi(r) from Halofit/HMCode nonlinear P(k) via Hankel transform.
Same interface as LinearTheoryXi but expects nonlinear P(k).
Source code in liulu/physics/real_space.py
Pairwise velocity moments¶
TabulatedMoments¶
liulu.physics.pairwise_velocity.TabulatedMoments ¶
Bases: PairwiseVelocityMoments
Interpolate pairwise velocity moments from tabulated data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_table
|
array_like
|
Separation values, Mpc/h. |
required |
v_r
|
array_like
|
Mean radial pairwise velocity, km/s (negative = infall). |
required |
sigma_r
|
array_like
|
Radial pairwise velocity dispersion, km/s. |
required |
sigma_t
|
array_like
|
Tangential pairwise velocity dispersion (per component), km/s. |
required |
gamma_r
|
array_like
|
Radial standardised skewness. Defaults to zero. |
None
|
kappa_r
|
array_like
|
Radial excess kurtosis. Defaults to zero (Gaussian). |
None
|
kappa_t
|
array_like
|
Tangential excess kurtosis. Defaults to zero (Gaussian). |
None
|
c_12_table
|
array_like
|
Cross central moment <(v_r - |
None
|
c_22_table
|
array_like
|
Cross central moment <(v_r - |
None
|
interpolator
|
callable
|
Interpolation factory with signature (r, y) -> callable. |
None
|
Source code in liulu/physics/pairwise_velocity.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
Velocity PDFs¶
Gaussian¶
liulu.physics.velocity_pdf.GaussianPDF ¶
Bases: VelocityPDF
Gaussian LOS pairwise velocity PDF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moments
|
PairwiseVelocityMoments
|
Radial-tangential moment functions. |
required |
Source code in liulu/physics/velocity_pdf.py
Skew-t¶
liulu.physics.velocity_pdf.SkewTPDF ¶
Bases: _FourMomentPDF
Skew-t LOS pairwise velocity PDF (Azzalini & Capitanio 2003).
Constructed from PairwiseVelocityMoments. Projects radial-tangential moments to the four LOS moments (mean, variance, skewness, kurtosis), then converts to skew-t parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moments
|
PairwiseVelocityMoments
|
Radial-tangential moment functions. |
required |
tabulate
|
bool
|
If True (default), pre-compute (alpha, nu) on a (gamma1, gamma2)
grid for fast vectorised evaluation. If False, use per-point
|
True
|
table_kw
|
dict
|
Keyword arguments forwarded to |
{}
|
Source code in liulu/physics/velocity_pdf.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
Generalized hyperbolic¶
liulu.physics.velocity_pdf.GeneralizedHyperbolicPDF ¶
Bases: _FourMomentPDF
Generalised hyperbolic LOS pairwise-velocity PDF (Kuruvilla & Porciani 2018). A normal variance-mean (Gaussian) mixture; strictly generalises the skew-t.
The four projected LOS moments (mean, variance, skewness, excess kurtosis)
are matched to the GH parameters at class index lam:
lam == -0.5(NIG) uses the analytic, fully vectorised inversion (fast; the recommended default -- see :class:NIGPDF);- any other scalar
lamuses a vectorised damped-Newton shape solve; lammay also be a callablelam(r_perp, r_par)returning a per-separation class index -- this realises the scale-dependent GHD of Kuruvilla & Porciani (2018), in which the fifth (shape) parameter drifts with pair separation. Calibrate such alam(r)from a measured velocity PDF (e.g. via :func:calibrate_gh_lambdainscripts/calibrate_gh_lambda.py).
Points whose (skewness, excess kurtosis) fall outside the attainable region fall back to a Gaussian with the same first two moments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moments
|
PairwiseVelocityMoments
|
|
required |
lam
|
float or callable
|
GH class index (default -0.5 = NIG), or |
-0.5
|
Source code in liulu/physics/velocity_pdf.py
NIG¶
liulu.physics.velocity_pdf.NIGPDF ¶
Bases: GeneralizedHyperbolicPDF
Normal-inverse-Gaussian LOS pairwise-velocity PDF (GH with lambda=-1/2).
Analytic, vectorised four-moment matching with Gaussian fallback; the recommended fast default among the generalised-hyperbolic family.
Source code in liulu/physics/velocity_pdf.py
Tabulated GH¶
liulu.physics.velocity_pdf.TabulatedGHPDF ¶
Bases: _FourMomentPDF
Generalised-hyperbolic LOS velocity PDF with scale-dependent shape, its parameters tabulated over pair separation (Kuruvilla & Porciani 2018).
The expensive GH shape solve is done once on a coarse (r_perp, r_par)
grid (the GH invariant shape (zeta, rho) is smooth in separation) and
interpolated thereafter; the first two moments (location, scale) are taken
from the exact local projected moments, so only the higher-order shape is
interpolated. The class index lam may vary with separation -- pass a
callable lam(r_perp, r_par) (e.g. the calibrated lam(r) of
:func:calibrate_gh_lambda) to realise the scale-dependent GHD.
Outside the tabulation grid, or where the shape solve fails, it falls back to the analytic NIG (and then Gaussian), so it is always well defined.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moments
|
PairwiseVelocityMoments
|
|
required |
lam
|
float or callable
|
Class index, scalar or |
-0.5
|
rp_max
|
float
|
Extent of the tabulation grid in r_perp, r_par (Mpc/h). |
60.0
|
rpar_max
|
float
|
Extent of the tabulation grid in r_perp, r_par (Mpc/h). |
60.0
|
n_rp
|
int
|
Grid resolution. |
48
|
n_rpar
|
int
|
Grid resolution. |
48
|
Source code in liulu/physics/velocity_pdf.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
Scale-dependent¶
liulu.physics.velocity_pdf.scale_dependent_lambda ¶
Build a callable lam(r_perp, r_par) interpolating a calibrated
lambda(separation) table, for :class:TabulatedGHPDF. Outside the grid it
returns fill (default -0.5 = NIG), so the model degrades gracefully to
NIG on scales where no calibration exists.
Source code in liulu/physics/velocity_pdf.py
LOS projection¶
liulu.physics.los_projection.project_to_los ¶
Project the n-th order r-t moment onto the line of sight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moments
|
PairwiseVelocityMoments
|
Object providing |
required |
n
|
int
|
Order of the LOS moment. |
required |
mode
|
str
|
|
'c'
|
Returns:
| Type | Description |
|---|---|
callable
|
|
Source code in liulu/physics/los_projection.py
Cosmology¶
liulu.physics.cosmology.Cosmology ¶
Bases: FlatLambdaCDM
Background cosmology based on :class:astropy.cosmology.FlatLambdaCDM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Om0
|
float
|
Present-day matter density parameter. |
required |
H0
|
float
|
Hubble constant in km/s/Mpc. |
required |
z
|
float
|
Redshift of evaluation. |
required |
gamma_growth
|
float
|
Growth index gamma in |
0.55
|
Source code in liulu/physics/cosmology.py
Hz ¶
aH ¶
a * H(z) in km/s/(Mpc/h).
For distances in Mpc/h: v[km/s] = a*H(z)[km/s/Mpc] * delta_r[Mpc/h] * (1/h)[Mpc/(Mpc/h)]
So aH in km/s/(Mpc/h) = a * H(z) / h.
f ¶
Linear growth rate f = d ln D / d ln a.
Uses the approximation f ~ Omega_m(z)**gamma_growth (Linder 2005); gamma_growth defaults to 0.55 (GR/LCDM, ~0.2% accurate) and can be overridden at construction for modified-gravity growth.
Source code in liulu/physics/cosmology.py
D ¶
Linear growth factor D(z), normalised to D(0) = 1.
Uses the Carroll, Press & Turner (1992) fitting formula (~1-2% accurate for LCDM; not valid for modified gravity).