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-linear scipy interpolation. |
None
|
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: VelocityPDF
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
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 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 | |
Generalized hyperbolic¶
liulu.physics.velocity_pdf.GeneralizedHyperbolicPDF ¶
Bases: VelocityPDF
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
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
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: VelocityPDF
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
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 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 | |
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 |
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)^0.55 (Linder 2005).
D ¶
Linear growth factor D(z), normalised to D(0) = 1.
Uses the Carroll, Press & Turner (1992) fitting formula.