py-lfkit 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. lfkit/__init__.py +19 -0
  2. lfkit/_version.py +24 -0
  3. lfkit/api/__init__.py +0 -0
  4. lfkit/api/corrections.py +308 -0
  5. lfkit/api/lumfunc.py +914 -0
  6. lfkit/corrections/__init__.py +0 -0
  7. lfkit/corrections/color_anchors.py +176 -0
  8. lfkit/corrections/filters.py +185 -0
  9. lfkit/corrections/kcorrect_backend.py +149 -0
  10. lfkit/corrections/kcorrect_from_color.py +111 -0
  11. lfkit/corrections/kcorrect_grids.py +242 -0
  12. lfkit/corrections/poggianti1997.py +386 -0
  13. lfkit/corrections/responses.py +183 -0
  14. lfkit/cosmo/__init__.py +0 -0
  15. lfkit/cosmo/cosmology.py +211 -0
  16. lfkit/data/demo_catalogs/fake_magnitude_limited_catalog.csv +201 -0
  17. lfkit/data/kcorrect/grids/kcorrect__bessell__z0.0000_4.0__Nz801__bsnone.npz +0 -0
  18. lfkit/data/kcorrect/grids/kcorrect__decam__z0.0000_4.0__Nz801__bsnone.npz +0 -0
  19. lfkit/data/kcorrect/grids/kcorrect__sdss__z0.0000_4.0__Nz801__bsnone.npz +0 -0
  20. lfkit/data/kcorrect/grids/kcorrect__subaru_suprimecam__z0.0000_4.0__Nz801__bsnone.npz +0 -0
  21. lfkit/data/poggianti1997/__init__.py +0 -0
  22. lfkit/data/poggianti1997/ecorr.csv +603 -0
  23. lfkit/data/poggianti1997/filters.csv +516 -0
  24. lfkit/data/poggianti1997/kcorr.csv +490 -0
  25. lfkit/data/poggianti1997/kcorrv.csv +37 -0
  26. lfkit/data/poggianti1997/sed.csv +295 -0
  27. lfkit/photometry/__init__.py +0 -0
  28. lfkit/photometry/catalog_completeness.py +381 -0
  29. lfkit/photometry/lf_integrals.py +500 -0
  30. lfkit/photometry/lf_parameter_models.py +386 -0
  31. lfkit/photometry/lf_redshift_density.py +238 -0
  32. lfkit/photometry/luminosities.py +426 -0
  33. lfkit/photometry/luminosity_function.py +707 -0
  34. lfkit/photometry/magnitudes.py +214 -0
  35. lfkit/utils/__init__.py +0 -0
  36. lfkit/utils/download_poggianti97_data.py +70 -0
  37. lfkit/utils/evaluators.py +104 -0
  38. lfkit/utils/interpolation.py +216 -0
  39. lfkit/utils/io.py +240 -0
  40. lfkit/utils/types.py +27 -0
  41. lfkit/utils/units.py +160 -0
  42. lfkit/utils/validators.py +63 -0
  43. py_lfkit-0.1.4.dist-info/METADATA +94 -0
  44. py_lfkit-0.1.4.dist-info/RECORD +47 -0
  45. py_lfkit-0.1.4.dist-info/WHEEL +5 -0
  46. py_lfkit-0.1.4.dist-info/licenses/LICENSE +21 -0
  47. py_lfkit-0.1.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,295 @@
1
+ Lam,logF03,logF04,logF05,logF06,logF07,logF08,logF09,logF10
2
+ 101.2,-2.1050,-0.1970,0.5405,-2.3230,-2.0195,-1.4190,-0.9275,-0.4050
3
+ 103.7,-2.1080,-0.1750,0.5635,-2.3200,-2.0015,-1.3980,-0.9055,-0.3830
4
+ 106.2,-2.1320,-0.1840,0.5535,-2.3480,-2.0175,-1.4070,-0.9135,-0.3910
5
+ 108.7,-2.1300,-0.1840,0.5535,-2.3540,-2.0205,-1.4090,-0.9145,-0.3920
6
+ 111.2,-2.1010,-0.1810,0.5555,-2.3410,-2.0205,-1.4050,-0.9105,-0.3870
7
+ 113.7,-2.1270,-0.1950,0.5425,-2.3630,-2.0335,-1.4180,-0.9235,-0.4000
8
+ 116.2,-2.1570,-0.1990,0.5375,-2.3870,-2.0405,-1.4220,-0.9275,-0.4040
9
+ 118.7,-2.2360,-0.2610,0.4765,-2.4480,-2.0985,-1.4840,-0.9895,-0.4660
10
+ 121.0,-2.2940,-0.4020,0.3355,-2.5150,-2.2185,-1.6240,-1.1325,-0.6110
11
+ 122.9,-2.2590,-0.2730,0.4645,-2.4570,-2.1065,-1.4960,-1.0025,-0.4790
12
+ 125.4,-2.2320,-0.2460,0.4905,-2.4540,-2.0885,-1.4680,-0.9735,-0.4500
13
+ 128.5,-2.1730,-0.2470,0.4885,-2.4270,-2.0895,-1.4670,-0.9715,-0.4480
14
+ 131.2,-2.1800,-0.2960,0.4395,-2.4350,-2.1345,-1.5160,-1.0205,-0.4970
15
+ 133.7,-2.1610,-0.2950,0.4405,-2.4190,-2.1335,-1.5130,-1.0175,-0.4940
16
+ 136.2,-2.1790,-0.3250,0.4105,-2.4330,-2.1615,-1.5430,-1.0485,-0.5250
17
+ 138.7,-2.1930,-0.3680,0.3665,-2.4520,-2.2015,-1.5850,-1.0895,-0.5660
18
+ 141.0,-2.1960,-0.3710,0.3635,-2.4510,-2.2035,-1.5870,-1.0925,-0.5690
19
+ 143.3,-2.1930,-0.3640,0.3705,-2.4440,-2.1955,-1.5800,-1.0845,-0.5610
20
+ 145.7,-2.1960,-0.3770,0.3575,-2.4480,-2.2065,-1.5920,-1.0975,-0.5740
21
+ 148.2,-2.2090,-0.4000,0.3335,-2.4600,-2.2265,-1.6150,-1.1205,-0.5970
22
+ 150.7,-2.2170,-0.4390,0.2945,-2.4680,-2.2575,-1.6510,-1.1575,-0.6350
23
+ 153.2,-2.2120,-0.4800,0.2525,-2.4600,-2.2615,-1.6780,-1.1895,-0.6690
24
+ 155.7,-2.2670,-0.5480,0.1845,-2.5140,-2.3275,-1.7470,-1.2585,-0.7380
25
+ 158.2,-2.2330,-0.5100,0.2225,-2.4780,-2.2825,-1.7050,-1.2185,-0.6980
26
+ 160.8,-2.2240,-0.4990,0.2335,-2.4640,-2.2645,-1.6910,-1.2065,-0.6870
27
+ 163.5,-2.2430,-0.5140,0.2185,-2.4750,-2.2735,-1.7050,-1.2215,-0.7020
28
+ 166.3,-2.2680,-0.5300,0.2025,-2.4960,-2.2925,-1.7230,-1.2385,-0.7200
29
+ 168.8,-2.1200,-0.5240,0.2045,-2.2950,-2.1125,-1.6430,-1.1985,-0.6980
30
+ 171.2,-2.1210,-0.5520,0.1755,-2.2860,-2.1115,-1.6600,-1.2225,-0.7250
31
+ 173.7,-2.0750,-0.5430,0.1825,-2.2270,-2.0585,-1.6310,-1.2045,-0.7120
32
+ 176.2,-2.0680,-0.5520,0.1735,-2.2180,-2.0515,-1.6310,-1.2085,-0.7190
33
+ 178.7,-2.0160,-0.5640,0.1585,-2.1480,-1.9935,-1.6090,-1.2055,-0.7250
34
+ 181.5,-2.0810,-0.5990,0.1255,-2.2150,-2.0585,-1.6620,-1.2505,-0.7660
35
+ 184.0,-2.0520,-0.6180,0.1045,-2.1840,-2.0345,-1.6570,-1.2575,-0.7790
36
+ 186.2,-2.0100,-0.6220,0.0985,-2.1300,-1.9875,-1.6340,-1.2485,-0.7780
37
+ 189.2,-1.9760,-0.6310,0.0855,-2.0870,-1.9505,-1.6180,-1.2465,-0.7830
38
+ 192.0,-1.9320,-0.6510,0.0625,-2.0320,-1.9035,-1.6000,-1.2475,-0.7950
39
+ 194.0,-1.9520,-0.6460,0.0695,-2.0550,-1.9235,-1.6100,-1.2505,-0.7940
40
+ 196.4,-1.9360,-0.6530,0.0605,-2.0370,-1.9065,-1.6020,-1.2495,-0.7970
41
+ 198.9,-1.8860,-0.6620,0.0465,-1.9730,-1.8525,-1.5750,-1.2415,-0.8010
42
+ 201.2,-1.9260,-0.6720,0.0405,-2.0150,-1.8915,-1.6040,-1.2615,-0.8160
43
+ 203.7,-1.9000,-0.6820,0.0265,-1.9840,-1.8645,-1.5910,-1.2615,-0.8230
44
+ 206.3,-1.9060,-0.6930,0.0165,-1.9860,-1.8675,-1.5980,-1.2705,-0.8340
45
+ 208.8,-1.6290,-0.6650,0.0145,-1.6630,-1.5665,-1.3830,-1.1375,-0.7660
46
+ 211.2,-1.6710,-0.6770,0.0075,-1.7100,-1.6135,-1.4220,-1.1665,-0.7850
47
+ 213.7,-1.7000,-0.6970,-0.0105,-1.7390,-1.6445,-1.4510,-1.1935,-0.8100
48
+ 216.2,-1.7050,-0.7050,-0.0185,-1.7470,-1.6525,-1.4590,-1.2025,-0.8180
49
+ 218.7,-1.5620,-0.6860,-0.0195,-1.5870,-1.5015,-1.3440,-1.1265,-0.7800
50
+ 221.2,-1.5890,-0.7080,-0.0395,-1.6150,-1.5315,-1.3740,-1.1565,-0.8080
51
+ 223.7,-1.4750,-0.6940,-0.0455,-1.4910,-1.4145,-1.2810,-1.0945,-0.7780
52
+ 226.2,-1.6750,-0.7480,-0.0725,-1.7110,-1.6255,-1.4550,-1.2215,-0.8570
53
+ 228.7,-1.6070,-0.7400,-0.0765,-1.6390,-1.5565,-1.3990,-1.1835,-0.8360
54
+ 231.2,-1.5740,-0.7460,-0.0885,-1.6030,-1.5235,-1.3760,-1.1725,-0.8370
55
+ 233.7,-1.7800,-0.8080,-0.1225,-1.8210,-1.7345,-1.5560,-1.3095,-0.9310
56
+ 236.2,-1.7120,-0.8080,-0.1335,-1.7470,-1.6665,-1.5060,-1.2815,-0.9220
57
+ 238.7,-1.8340,-0.8470,-0.1585,-1.8750,-1.7885,-1.6070,-1.3565,-0.9730
58
+ 241.2,-1.7040,-0.8290,-0.1585,-1.7350,-1.6575,-1.5050,-1.2895,-0.9390
59
+ 243.7,-1.4810,-0.7740,-0.1455,-1.5010,-1.4345,-1.3170,-1.1495,-0.8540
60
+ 246.2,-1.5380,-0.7970,-0.1595,-1.5630,-1.4955,-1.3700,-1.1915,-0.8830
61
+ 248.7,-1.6500,-0.8470,-0.1915,-1.6850,-1.6125,-1.4710,-1.2715,-0.9390
62
+ 250.6,-1.5460,-0.8100,-0.1735,-1.5760,-1.5085,-1.3820,-1.2025,-0.8930
63
+ 251.9,-1.7250,-0.8560,-0.1865,-1.7710,-1.6915,-1.5300,-1.3075,-0.9540
64
+ 253.7,-1.5430,-0.8330,-0.2005,-1.5630,-1.4975,-1.3800,-1.2125,-0.9160
65
+ 256.2,-1.3180,-0.7620,-0.1785,-1.3230,-1.2675,-1.1820,-1.0595,-0.8230
66
+ 258.7,-1.4540,-0.8140,-0.1985,-1.4700,-1.4145,-1.3160,-1.1705,-0.8970
67
+ 261.2,-1.5060,-0.8400,-0.2155,-1.5260,-1.4705,-1.3690,-1.2155,-0.9300
68
+ 263.7,-1.1280,-0.7000,-0.1755,-1.1260,-1.0765,-1.0100,-0.9205,-0.7360
69
+ 266.2,-0.9710,-0.6240,-0.1565,-0.9630,-0.9165,-0.8600,-0.7895,-0.6430
70
+ 268.7,-1.0220,-0.6540,-0.1735,-1.0160,-0.9695,-0.9100,-0.8345,-0.6770
71
+ 271.2,-1.1290,-0.7140,-0.2005,-1.1280,-1.0805,-1.0140,-0.9255,-0.7450
72
+ 273.7,-1.3040,-0.8000,-0.2375,-1.3140,-1.2665,-1.1890,-1.0775,-0.8550
73
+ 276.2,-1.2480,-0.7830,-0.2405,-1.2570,-1.2135,-1.1440,-1.0445,-0.8390
74
+ 278.7,-1.3590,-0.8430,-0.2675,-1.3720,-1.3305,-1.2570,-1.1435,-0.9130
75
+ 281.2,-1.2320,-0.7830,-0.2465,-1.2410,-1.1995,-1.1330,-1.0355,-0.8340
76
+ 283.7,-1.1250,-0.7280,-0.2355,-1.1280,-1.0825,-1.0160,-0.9295,-0.7530
77
+ 286.2,-1.1520,-0.7410,-0.2425,-1.1530,-1.1015,-1.0300,-0.9385,-0.7590
78
+ 288.7,-0.9470,-0.6480,-0.2205,-0.9430,-0.9045,-0.8550,-0.7925,-0.6600
79
+ 291.2,-0.7880,-0.5540,-0.1855,-0.7810,-0.7475,-0.7080,-0.6595,-0.5570
80
+ 293.7,-0.8320,-0.5860,-0.2065,-0.8270,-0.7935,-0.7510,-0.6995,-0.5900
81
+ 296.2,-0.8550,-0.5970,-0.2115,-0.8500,-0.8135,-0.7680,-0.7125,-0.5970
82
+ 298.7,-0.8630,-0.6030,-0.2175,-0.8590,-0.8215,-0.7750,-0.7185,-0.6020
83
+ 301.2,-0.9070,-0.6290,-0.2285,-0.9060,-0.8685,-0.8190,-0.7555,-0.6250
84
+ 303.7,-0.8130,-0.5770,-0.2155,-0.8090,-0.7755,-0.7330,-0.6815,-0.5730
85
+ 306.2,-0.7590,-0.5480,-0.2105,-0.7550,-0.7255,-0.6870,-0.6415,-0.5460
86
+ 308.7,-0.7440,-0.5400,-0.2125,-0.7400,-0.7105,-0.6740,-0.6305,-0.5370
87
+ 311.2,-0.6460,-0.4820,-0.1965,-0.6400,-0.6155,-0.5870,-0.5545,-0.4820
88
+ 313.7,-0.6300,-0.4730,-0.1965,-0.6250,-0.6015,-0.5740,-0.5425,-0.4730
89
+ 316.2,-0.6030,-0.4550,-0.1915,-0.5980,-0.5755,-0.5500,-0.5205,-0.4550
90
+ 318.7,-0.6790,-0.5130,-0.2255,-0.6750,-0.6525,-0.6240,-0.5905,-0.5150
91
+ 321.2,-0.6440,-0.4850,-0.2125,-0.6390,-0.6145,-0.5860,-0.5525,-0.4820
92
+ 323.7,-0.6710,-0.5090,-0.2295,-0.6670,-0.6445,-0.6160,-0.5825,-0.5090
93
+ 326.2,-0.5920,-0.4490,-0.2045,-0.5850,-0.5605,-0.5340,-0.5045,-0.4440
94
+ 328.7,-0.5770,-0.4390,-0.2035,-0.5700,-0.5455,-0.5200,-0.4925,-0.4350
95
+ 331.2,-0.5800,-0.4410,-0.2065,-0.5730,-0.5485,-0.5220,-0.4945,-0.4360
96
+ 333.7,-0.5880,-0.4500,-0.2165,-0.5810,-0.5565,-0.5310,-0.5035,-0.4450
97
+ 336.2,-0.6070,-0.4660,-0.2285,-0.6010,-0.5775,-0.5510,-0.5235,-0.4620
98
+ 338.7,-0.5920,-0.4540,-0.2235,-0.5860,-0.5615,-0.5360,-0.5075,-0.4480
99
+ 341.2,-0.6110,-0.4690,-0.2325,-0.6050,-0.5815,-0.5540,-0.5245,-0.4620
100
+ 343.7,-0.6060,-0.4630,-0.2305,-0.6000,-0.5755,-0.5470,-0.5165,-0.4540
101
+ 346.2,-0.5910,-0.4530,-0.2305,-0.5840,-0.5595,-0.5330,-0.5045,-0.4450
102
+ 348.7,-0.6050,-0.4700,-0.2445,-0.6010,-0.5785,-0.5530,-0.5255,-0.4650
103
+ 351.2,-0.5940,-0.4620,-0.2425,-0.5890,-0.5665,-0.5420,-0.5145,-0.4560
104
+ 353.7,-0.5600,-0.4340,-0.2305,-0.5530,-0.5295,-0.5050,-0.4795,-0.4260
105
+ 356.2,-0.5880,-0.4580,-0.2455,-0.5820,-0.5585,-0.5320,-0.5045,-0.4460
106
+ 358.7,-0.6120,-0.4790,-0.2595,-0.6070,-0.5835,-0.5570,-0.5275,-0.4670
107
+ 361.2,-0.6010,-0.4720,-0.2585,-0.5960,-0.5745,-0.5480,-0.5195,-0.4600
108
+ 363.6,-0.5440,-0.4290,-0.2385,-0.5390,-0.5185,-0.4950,-0.4705,-0.4180
109
+ 366.1,-0.4970,-0.3950,-0.2225,-0.4910,-0.4725,-0.4530,-0.4325,-0.3890
110
+ 368.7,-0.4900,-0.3920,-0.2275,-0.4850,-0.4685,-0.4490,-0.4295,-0.3880
111
+ 371.2,-0.5230,-0.4190,-0.2395,-0.5210,-0.5035,-0.4830,-0.4595,-0.4100
112
+ 373.7,-0.5820,-0.4540,-0.2335,-0.5820,-0.5625,-0.5360,-0.5035,-0.4360
113
+ 376.2,-0.5330,-0.4150,-0.2165,-0.5310,-0.5105,-0.4860,-0.4575,-0.4000
114
+ 378.7,-0.4690,-0.3490,-0.1495,-0.4660,-0.4435,-0.4170,-0.3885,-0.3300
115
+ 381.2,-0.5030,-0.3640,-0.1325,-0.5020,-0.4775,-0.4470,-0.4115,-0.3390
116
+ 383.7,-0.6150,-0.4640,-0.2215,-0.6160,-0.5915,-0.5590,-0.5215,-0.4430
117
+ 386.2,-0.5150,-0.3530,-0.0975,-0.5130,-0.4825,-0.4460,-0.4045,-0.3220
118
+ 388.7,-0.5050,-0.3820,-0.1845,-0.5020,-0.4795,-0.4520,-0.4225,-0.3620
119
+ 391.2,-0.4910,-0.3480,-0.1045,-0.4920,-0.4685,-0.4380,-0.4015,-0.3240
120
+ 393.7,-0.6330,-0.4710,-0.1745,-0.6390,-0.6215,-0.5930,-0.5525,-0.4590
121
+ 396.2,-0.5400,-0.4250,-0.2095,-0.5420,-0.5265,-0.5040,-0.4755,-0.4130
122
+ 398.7,-0.3370,-0.2430,-0.0725,-0.3360,-0.3205,-0.3010,-0.2785,-0.2280
123
+ 401.2,-0.2690,-0.1830,-0.0195,-0.2680,-0.2535,-0.2350,-0.2135,-0.1670
124
+ 403.7,-0.2770,-0.1910,-0.0265,-0.2770,-0.2635,-0.2450,-0.2225,-0.1750
125
+ 406.2,-0.2750,-0.1920,-0.0305,-0.2750,-0.2625,-0.2440,-0.2235,-0.1760
126
+ 408.7,-0.2550,-0.1850,-0.0535,-0.2540,-0.2425,-0.2270,-0.2105,-0.1730
127
+ 411.2,-0.2540,-0.1950,-0.0855,-0.2530,-0.2425,-0.2300,-0.2165,-0.1860
128
+ 413.7,-0.2550,-0.1810,-0.0365,-0.2550,-0.2425,-0.2270,-0.2085,-0.1670
129
+ 416.2,-0.2370,-0.1640,-0.0245,-0.2360,-0.2225,-0.2070,-0.1885,-0.1490
130
+ 418.7,-0.2520,-0.1780,-0.0355,-0.2510,-0.2395,-0.2230,-0.2045,-0.1640
131
+ 421.2,-0.2390,-0.1660,-0.0295,-0.2370,-0.2245,-0.2080,-0.1905,-0.1500
132
+ 423.7,-0.2430,-0.1720,-0.0365,-0.2420,-0.2295,-0.2150,-0.1965,-0.1570
133
+ 426.2,-0.2410,-0.1710,-0.0395,-0.2400,-0.2285,-0.2130,-0.1945,-0.1560
134
+ 428.7,-0.2320,-0.1640,-0.0385,-0.2310,-0.2185,-0.2040,-0.1865,-0.1500
135
+ 431.2,-0.2170,-0.1570,-0.0415,-0.2160,-0.2045,-0.1910,-0.1765,-0.1430
136
+ 433.7,-0.1830,-0.1460,-0.0825,-0.1810,-0.1745,-0.1670,-0.1585,-0.1420
137
+ 436.2,-0.1450,-0.1020,-0.0165,-0.1440,-0.1365,-0.1260,-0.1155,-0.0920
138
+ 438.7,-0.1600,-0.1130,-0.0165,-0.1590,-0.1505,-0.1400,-0.1285,-0.1020
139
+ 441.2,-0.1540,-0.1090,-0.0165,-0.1540,-0.1465,-0.1360,-0.1255,-0.0990
140
+ 443.7,-0.1360,-0.0940,-0.0075,-0.1360,-0.1285,-0.1200,-0.1095,-0.0850
141
+ 446.2,-0.1200,-0.0820,-0.0015,-0.1200,-0.1145,-0.1060,-0.0965,-0.0740
142
+ 448.7,-0.0940,-0.0610,0.0115,-0.0940,-0.0885,-0.0810,-0.0725,-0.0530
143
+ 451.2,-0.0820,-0.0510,0.0155,-0.0820,-0.0775,-0.0700,-0.0625,-0.0450
144
+ 453.7,-0.1000,-0.0700,-0.0005,-0.1000,-0.0965,-0.0910,-0.0835,-0.0650
145
+ 456.2,-0.0800,-0.0520,0.0115,-0.0800,-0.0765,-0.0700,-0.0625,-0.0460
146
+ 458.7,-0.0670,-0.0410,0.0175,-0.0670,-0.0625,-0.0570,-0.0505,-0.0350
147
+ 461.2,-0.0640,-0.0380,0.0185,-0.0640,-0.0595,-0.0540,-0.0475,-0.0330
148
+ 463.7,-0.0600,-0.0360,0.0185,-0.0600,-0.0565,-0.0510,-0.0445,-0.0300
149
+ 466.2,-0.0590,-0.0340,0.0185,-0.0580,-0.0545,-0.0490,-0.0435,-0.0290
150
+ 468.7,-0.0550,-0.0320,0.0175,-0.0550,-0.0505,-0.0460,-0.0405,-0.0270
151
+ 471.2,-0.0580,-0.0360,0.0105,-0.0580,-0.0545,-0.0500,-0.0445,-0.0320
152
+ 473.7,-0.0520,-0.0310,0.0145,-0.0520,-0.0485,-0.0440,-0.0395,-0.0270
153
+ 476.2,-0.0460,-0.0250,0.0185,-0.0460,-0.0425,-0.0380,-0.0325,-0.0210
154
+ 478.7,-0.0420,-0.0220,0.0175,-0.0420,-0.0385,-0.0340,-0.0295,-0.0190
155
+ 481.2,-0.0440,-0.0240,0.0145,-0.0440,-0.0405,-0.0360,-0.0315,-0.0210
156
+ 483.7,-0.0470,-0.0280,0.0055,-0.0470,-0.0435,-0.0390,-0.0355,-0.0260
157
+ 486.2,-0.0620,-0.0530,-0.0435,-0.0610,-0.0605,-0.0590,-0.0575,-0.0560
158
+ 488.7,-0.0460,-0.0300,0.0015,-0.0460,-0.0425,-0.0390,-0.0355,-0.0270
159
+ 491.2,-0.0420,-0.0260,0.0075,-0.0410,-0.0385,-0.0350,-0.0315,-0.0220
160
+ 493.7,-0.0340,-0.0180,0.0125,-0.0330,-0.0305,-0.0270,-0.0245,-0.0150
161
+ 496.2,-0.0360,-0.0210,0.0105,-0.0360,-0.0335,-0.0300,-0.0265,-0.0170
162
+ 498.7,-0.0540,-0.0360,-0.0035,-0.0540,-0.0505,-0.0470,-0.0435,-0.0330
163
+ 502.5,-0.0590,-0.0410,-0.0095,-0.0590,-0.0555,-0.0520,-0.0485,-0.0380
164
+ 507.5,-0.0500,-0.0340,-0.0055,-0.0500,-0.0465,-0.0430,-0.0395,-0.0310
165
+ 512.5,-0.0630,-0.0460,-0.0175,-0.0620,-0.0585,-0.0550,-0.0505,-0.0420
166
+ 517.5,-0.0840,-0.0660,-0.0355,-0.0840,-0.0805,-0.0760,-0.0725,-0.0620
167
+ 522.5,-0.0650,-0.0500,-0.0265,-0.0640,-0.0615,-0.0580,-0.0545,-0.0470
168
+ 527.5,-0.0380,-0.0300,-0.0135,-0.0380,-0.0365,-0.0350,-0.0335,-0.0280
169
+ 532.5,-0.0140,-0.0110,-0.0015,-0.0140,-0.0135,-0.0130,-0.0125,-0.0100
170
+ 537.5,-0.0030,-0.0020,0.0045,-0.0030,-0.0025,-0.0020,-0.0015,0.0000
171
+ 542.5,-0.0080,-0.0070,-0.0025,-0.0080,-0.0085,-0.0080,-0.0075,-0.0060
172
+ 547.5,-0.0040,-0.0030,-0.0015,-0.0040,-0.0035,-0.0040,-0.0035,-0.0030
173
+ 552.5,0.0040,0.0030,0.0015,0.0040,0.0035,0.0040,0.0035,0.0030
174
+ 557.5,-0.0010,-0.0020,-0.0045,-0.0010,-0.0015,-0.0010,-0.0025,-0.0020
175
+ 562.5,0.0000,-0.0020,-0.0055,-0.0010,-0.0005,-0.0010,-0.0015,-0.0020
176
+ 567.5,0.0020,-0.0020,-0.0075,0.0020,0.0015,0.0000,-0.0005,-0.0020
177
+ 572.5,0.0100,0.0050,-0.0045,0.0100,0.0085,0.0080,0.0065,0.0040
178
+ 577.5,0.0170,0.0090,-0.0025,0.0160,0.0145,0.0130,0.0115,0.0080
179
+ 582.5,0.0210,0.0130,-0.0005,0.0210,0.0195,0.0180,0.0155,0.0120
180
+ 587.5,0.0010,-0.0040,-0.0155,0.0010,-0.0005,-0.0010,-0.0025,-0.0050
181
+ 592.5,-0.0010,-0.0060,-0.0195,-0.0020,-0.0025,-0.0030,-0.0055,-0.0080
182
+ 597.5,0.0100,0.0010,-0.0155,0.0100,0.0085,0.0060,0.0035,-0.0010
183
+ 602.5,0.0160,0.0050,-0.0135,0.0160,0.0135,0.0120,0.0085,0.0040
184
+ 607.5,0.0210,0.0080,-0.0125,0.0200,0.0185,0.0160,0.0125,0.0070
185
+ 612.5,0.0070,-0.0050,-0.0255,0.0070,0.0045,0.0030,-0.0005,-0.0060
186
+ 617.5,-0.0050,-0.0150,-0.0355,-0.0050,-0.0075,-0.0090,-0.0125,-0.0180
187
+ 622.5,-0.0160,-0.0250,-0.0465,-0.0160,-0.0185,-0.0200,-0.0235,-0.0290
188
+ 627.5,-0.0140,-0.0250,-0.0475,-0.0150,-0.0165,-0.0190,-0.0225,-0.0280
189
+ 632.5,-0.0030,-0.0170,-0.0425,-0.0040,-0.0065,-0.0090,-0.0125,-0.0200
190
+ 637.5,0.0070,-0.0090,-0.0365,0.0060,0.0035,0.0000,-0.0035,-0.0120
191
+ 642.5,0.0110,-0.0060,-0.0345,0.0100,0.0075,0.0040,0.0005,-0.0080
192
+ 647.5,0.0130,-0.0060,-0.0355,0.0130,0.0095,0.0060,0.0015,-0.0070
193
+ 652.5,0.0150,-0.0060,-0.0385,0.0140,0.0115,0.0080,0.0025,-0.0070
194
+ 657.5,0.0080,-0.0150,-0.0545,0.0070,0.0035,-0.0010,-0.0075,-0.0190
195
+ 662.5,0.0070,-0.0130,-0.0455,0.0060,0.0025,-0.0010,-0.0055,-0.0150
196
+ 667.5,0.0020,-0.0160,-0.0495,0.0010,-0.0015,-0.0050,-0.0095,-0.0190
197
+ 672.5,0.0000,-0.0180,-0.0515,0.0000,-0.0035,-0.0070,-0.0115,-0.0210
198
+ 677.5,0.0020,-0.0180,-0.0525,0.0010,-0.0025,-0.0060,-0.0115,-0.0210
199
+ 682.5,0.0070,-0.0150,-0.0515,0.0060,0.0025,-0.0010,-0.0065,-0.0170
200
+ 687.5,0.0110,-0.0130,-0.0505,0.0110,0.0065,0.0030,-0.0025,-0.0140
201
+ 692.5,0.0130,-0.0130,-0.0515,0.0130,0.0095,0.0040,-0.0015,-0.0130
202
+ 697.5,0.0130,-0.0150,-0.0545,0.0130,0.0085,0.0040,-0.0025,-0.0150
203
+ 702.5,0.0060,-0.0220,-0.0615,0.0060,0.0015,-0.0030,-0.0095,-0.0220
204
+ 707.5,-0.0110,-0.0360,-0.0755,-0.0120,-0.0155,-0.0210,-0.0265,-0.0380
205
+ 715.0,-0.0330,-0.0540,-0.0925,-0.0340,-0.0375,-0.0420,-0.0475,-0.0580
206
+ 725.0,-0.0110,-0.0410,-0.0835,-0.0110,-0.0155,-0.0210,-0.0275,-0.0410
207
+ 735.0,0.0180,-0.0220,-0.0695,0.0180,0.0125,0.0060,-0.0015,-0.0180
208
+ 745.0,0.0170,-0.0250,-0.0735,0.0170,0.0115,0.0040,-0.0035,-0.0210
209
+ 755.0,0.0110,-0.0290,-0.0775,0.0120,0.0055,-0.0010,-0.0085,-0.0250
210
+ 765.0,0.0030,-0.0370,-0.0865,0.0040,-0.0025,-0.0090,-0.0165,-0.0340
211
+ 775.0,-0.0030,-0.0420,-0.0925,-0.0030,-0.0085,-0.0150,-0.0225,-0.0400
212
+ 785.0,-0.0080,-0.0460,-0.0975,-0.0080,-0.0135,-0.0200,-0.0275,-0.0450
213
+ 795.0,-0.0090,-0.0530,-0.1055,-0.0090,-0.0155,-0.0230,-0.0305,-0.0490
214
+ 805.0,-0.0120,-0.0600,-0.1155,-0.0110,-0.0175,-0.0250,-0.0345,-0.0540
215
+ 815.2,-0.0110,-0.0650,-0.1215,-0.0100,-0.0165,-0.0250,-0.0345,-0.0560
216
+ 825.2,-0.0130,-0.0670,-0.1255,-0.0110,-0.0185,-0.0270,-0.0365,-0.0580
217
+ 835.0,-0.0170,-0.0710,-0.1285,-0.0160,-0.0235,-0.0320,-0.0405,-0.0620
218
+ 845.0,-0.0220,-0.0760,-0.1345,-0.0220,-0.0295,-0.0370,-0.0465,-0.0680
219
+ 855.0,-0.0500,-0.1030,-0.1615,-0.0490,-0.0565,-0.0640,-0.0735,-0.0950
220
+ 865.0,-0.0420,-0.0970,-0.1585,-0.0410,-0.0485,-0.0570,-0.0665,-0.0890
221
+ 875.0,-0.0180,-0.0780,-0.1405,-0.0170,-0.0245,-0.0340,-0.0445,-0.0680
222
+ 885.0,-0.0210,-0.0800,-0.1425,-0.0200,-0.0275,-0.0370,-0.0475,-0.0710
223
+ 895.0,-0.0240,-0.0820,-0.1425,-0.0230,-0.0305,-0.0400,-0.0495,-0.0720
224
+ 905.0,-0.0260,-0.0890,-0.1525,-0.0250,-0.0325,-0.0420,-0.0525,-0.0780
225
+ 915.0,-0.0510,-0.1160,-0.1795,-0.0490,-0.0575,-0.0670,-0.0775,-0.1030
226
+ 925.0,-0.0630,-0.1290,-0.1965,-0.0620,-0.0705,-0.0800,-0.0915,-0.1170
227
+ 935.0,-0.0620,-0.1260,-0.1905,-0.0610,-0.0695,-0.0790,-0.0895,-0.1150
228
+ 945.0,-0.0610,-0.1270,-0.1935,-0.0590,-0.0685,-0.0780,-0.0895,-0.1150
229
+ 955.0,-0.0640,-0.1320,-0.2015,-0.0620,-0.0705,-0.0810,-0.0925,-0.1190
230
+ 965.0,-0.0720,-0.1410,-0.2085,-0.0700,-0.0795,-0.0900,-0.1005,-0.1280
231
+ 975.0,-0.0790,-0.1480,-0.2155,-0.0770,-0.0855,-0.0960,-0.1075,-0.1340
232
+ 985.0,-0.0760,-0.1460,-0.2135,-0.0740,-0.0825,-0.0930,-0.1045,-0.1320
233
+ 995.0,-0.0770,-0.1470,-0.2155,-0.0750,-0.0835,-0.0940,-0.1055,-0.1330
234
+ 1005.0,-0.0800,-0.1510,-0.2225,-0.0770,-0.0865,-0.0970,-0.1095,-0.1370
235
+ 1015.0,-0.0830,-0.1550,-0.2245,-0.0810,-0.0905,-0.1010,-0.1125,-0.1400
236
+ 1025.0,-0.0870,-0.1600,-0.2305,-0.0850,-0.0935,-0.1050,-0.1165,-0.1450
237
+ 1035.0,-0.0910,-0.1660,-0.2365,-0.0890,-0.0985,-0.1090,-0.1215,-0.1500
238
+ 1045.0,-0.0950,-0.1710,-0.2425,-0.0930,-0.1025,-0.1130,-0.1255,-0.1540
239
+ 1055.0,-0.1000,-0.1760,-0.2485,-0.0970,-0.1065,-0.1180,-0.1295,-0.1590
240
+ 1065.0,-0.1040,-0.1820,-0.2545,-0.1020,-0.1115,-0.1230,-0.1355,-0.1650
241
+ 1075.0,-0.1090,-0.1870,-0.2605,-0.1060,-0.1155,-0.1270,-0.1395,-0.1690
242
+ 1085.0,-0.1130,-0.1930,-0.2665,-0.1110,-0.1205,-0.1320,-0.1445,-0.1750
243
+ 1095.0,-0.1180,-0.1990,-0.2755,-0.1150,-0.1255,-0.1370,-0.1495,-0.1810
244
+ 1105.0,-0.1210,-0.2020,-0.2775,-0.1180,-0.1285,-0.1400,-0.1525,-0.1830
245
+ 1115.0,-0.1260,-0.2080,-0.2835,-0.1230,-0.1325,-0.1450,-0.1575,-0.1880
246
+ 1125.0,-0.1310,-0.2140,-0.2895,-0.1270,-0.1375,-0.1500,-0.1625,-0.1940
247
+ 1135.0,-0.1350,-0.2190,-0.2955,-0.1320,-0.1425,-0.1540,-0.1675,-0.1990
248
+ 1145.0,-0.1400,-0.2250,-0.3015,-0.1360,-0.1465,-0.1590,-0.1715,-0.2040
249
+ 1155.0,-0.1440,-0.2300,-0.3075,-0.1410,-0.1515,-0.1630,-0.1765,-0.2090
250
+ 1165.0,-0.1490,-0.2360,-0.3145,-0.1460,-0.1565,-0.1690,-0.1815,-0.2150
251
+ 1175.0,-0.1540,-0.2410,-0.3205,-0.1500,-0.1605,-0.1730,-0.1865,-0.2190
252
+ 1185.0,-0.1590,-0.2470,-0.3265,-0.1550,-0.1665,-0.1790,-0.1915,-0.2250
253
+ 1195.0,-0.1630,-0.2530,-0.3325,-0.1600,-0.1705,-0.1830,-0.1965,-0.2300
254
+ 1205.0,-0.1680,-0.2580,-0.3385,-0.1640,-0.1755,-0.1880,-0.2015,-0.2350
255
+ 1215.0,-0.1730,-0.2640,-0.3445,-0.1690,-0.1795,-0.1920,-0.2065,-0.2400
256
+ 1225.0,-0.1770,-0.2690,-0.3505,-0.1740,-0.1845,-0.1970,-0.2115,-0.2450
257
+ 1235.0,-0.1820,-0.2750,-0.3565,-0.1780,-0.1895,-0.2020,-0.2165,-0.2510
258
+ 1245.0,-0.1870,-0.2800,-0.3625,-0.1830,-0.1945,-0.2070,-0.2215,-0.2560
259
+ 1255.0,-0.1920,-0.2860,-0.3685,-0.1880,-0.1995,-0.2120,-0.2265,-0.2610
260
+ 1265.0,-0.1970,-0.2920,-0.3745,-0.1930,-0.2045,-0.2170,-0.2315,-0.2670
261
+ 1275.0,-0.2020,-0.2970,-0.3805,-0.1980,-0.2085,-0.2220,-0.2365,-0.2720
262
+ 1285.0,-0.2080,-0.3050,-0.3905,-0.2040,-0.2155,-0.2290,-0.2435,-0.2800
263
+ 1295.0,-0.2120,-0.3090,-0.3925,-0.2080,-0.2185,-0.2320,-0.2465,-0.2830
264
+ 1305.0,-0.2170,-0.3150,-0.3985,-0.2120,-0.2235,-0.2370,-0.2515,-0.2880
265
+ 1315.0,-0.2220,-0.3200,-0.4055,-0.2180,-0.2295,-0.2420,-0.2565,-0.2930
266
+ 1325.0,-0.2270,-0.3260,-0.4115,-0.2230,-0.2345,-0.2480,-0.2625,-0.2990
267
+ 1335.0,-0.2320,-0.3320,-0.4175,-0.2280,-0.2395,-0.2530,-0.2675,-0.3040
268
+ 1345.0,-0.2370,-0.3380,-0.4235,-0.2320,-0.2445,-0.2580,-0.2725,-0.3100
269
+ 1355.0,-0.2420,-0.3430,-0.4295,-0.2380,-0.2495,-0.2630,-0.2775,-0.3150
270
+ 1365.0,-0.2470,-0.3490,-0.4355,-0.2430,-0.2545,-0.2680,-0.2835,-0.3210
271
+ 1375.0,-0.2530,-0.3550,-0.4425,-0.2480,-0.2595,-0.2730,-0.2885,-0.3260
272
+ 1385.0,-0.2580,-0.3610,-0.4485,-0.2530,-0.2645,-0.2790,-0.2935,-0.3320
273
+ 1395.0,-0.2630,-0.3670,-0.4545,-0.2580,-0.2705,-0.2840,-0.2995,-0.3370
274
+ 1405.0,-0.2680,-0.3720,-0.4605,-0.2630,-0.2745,-0.2890,-0.3045,-0.3430
275
+ 1415.0,-0.2730,-0.3780,-0.4665,-0.2680,-0.2805,-0.2940,-0.3095,-0.3480
276
+ 1425.0,-0.2790,-0.3840,-0.4735,-0.2730,-0.2855,-0.3000,-0.3145,-0.3540
277
+ 1435.0,-0.2830,-0.3890,-0.4785,-0.2780,-0.2905,-0.3040,-0.3195,-0.3590
278
+ 1445.0,-0.2890,-0.3960,-0.4855,-0.2830,-0.2955,-0.3100,-0.3255,-0.3650
279
+ 1454.4,-0.2870,-0.3960,-0.4875,-0.2820,-0.2945,-0.3090,-0.3245,-0.3650
280
+ 1464.4,-0.2950,-0.4040,-0.4945,-0.2900,-0.3015,-0.3160,-0.3325,-0.3720
281
+ 1475.0,-0.3010,-0.4100,-0.5015,-0.2950,-0.3075,-0.3220,-0.3385,-0.3780
282
+ 1485.0,-0.3000,-0.4100,-0.5025,-0.2940,-0.3065,-0.3210,-0.3375,-0.3780
283
+ 1495.0,-0.2990,-0.4100,-0.5025,-0.2940,-0.3065,-0.3210,-0.3365,-0.3780
284
+ 1510.0,-0.3030,-0.4140,-0.5075,-0.2970,-0.3095,-0.3250,-0.3405,-0.3820
285
+ 1530.0,-0.3040,-0.4190,-0.5135,-0.2980,-0.3115,-0.3270,-0.3425,-0.3850
286
+ 1550.0,-0.3100,-0.4240,-0.5195,-0.3040,-0.3165,-0.3320,-0.3485,-0.3900
287
+ 1570.0,-0.3140,-0.4300,-0.5255,-0.3070,-0.3205,-0.3360,-0.3525,-0.3950
288
+ 1590.0,-0.3260,-0.4430,-0.5385,-0.3190,-0.3325,-0.3480,-0.3645,-0.4070
289
+ 1610.0,-0.3340,-0.4520,-0.5485,-0.3270,-0.3405,-0.3560,-0.3725,-0.4160
290
+ 1630.0,-0.3360,-0.4550,-0.5525,-0.3300,-0.3435,-0.3590,-0.3755,-0.4190
291
+ 1650.0,-0.3430,-0.4630,-0.5605,-0.3360,-0.3495,-0.3660,-0.3825,-0.4260
292
+ 1670.0,-0.3420,-0.4630,-0.5615,-0.3360,-0.3495,-0.3650,-0.3825,-0.4260
293
+ 1690.0,-0.3450,-0.4680,-0.5685,-0.3380,-0.3525,-0.3680,-0.3855,-0.4310
294
+ 1800.0,-0.3990,-0.5230,-0.6245,-0.3930,-0.4065,-0.4230,-0.4405,-0.4860
295
+ 2700.0,-0.9360,-1.0890,-1.2015,-0.9270,-0.9425,-0.9620,-0.9815,-1.0340
File without changes
@@ -0,0 +1,381 @@
1
+ r"""Catalog completeness utilities for luminosity-function models.
2
+
3
+ This module provides helpers for estimating the observed and missing galaxy
4
+ population implied by a magnitude-limited catalog. These functions are useful
5
+ for applications that need an out-of-catalog correction, such as galaxy-catalog
6
+ priors for gravitational-wave cosmology.
7
+
8
+ The utilities convert an apparent magnitude limit into an absolute-magnitude
9
+ limit and call the generic LF integration helpers to return number densities
10
+ or fractions.
11
+
12
+ The core API accepts a luminosity-function callable with signature
13
+
14
+ lf(absolute_mag, z)
15
+
16
+ where ``absolute_mag`` and ``z`` are NumPy arrays that can be broadcast
17
+ together. This keeps the completeness machinery independent of any specific
18
+ luminosity-function parameterization.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import numpy as np
24
+
25
+ from lfkit.photometry.lf_integrals import (
26
+ integrated_number_density as _integrated_number_density,
27
+ )
28
+ from lfkit.photometry.magnitudes import absolute_magnitude
29
+ from lfkit.utils.types import (
30
+ Cosmology,
31
+ FloatArray,
32
+ FloatInput,
33
+ LuminosityFunction,
34
+ )
35
+ from lfkit.utils.validators import validate_array, validate_magnitude_range
36
+
37
+
38
+ __all__ = [
39
+ "absolute_magnitude_limit",
40
+ "observed_number_density",
41
+ "missing_number_density",
42
+ "catalog_completeness_fraction",
43
+ "out_of_catalog_fraction",
44
+ ]
45
+
46
+
47
+ def absolute_magnitude_limit(
48
+ cosmo_obj: Cosmology,
49
+ z: FloatInput,
50
+ *,
51
+ m_lim: float,
52
+ h: float | None = None,
53
+ k_correction: FloatInput | None = None,
54
+ e_correction: FloatInput | None = None,
55
+ ) -> FloatArray:
56
+ r"""Return the absolute-magnitude limit of an apparent-magnitude catalog cut.
57
+
58
+ This converts an apparent magnitude limit into the corresponding limiting
59
+ absolute magnitude at each redshift,
60
+
61
+ .. math::
62
+
63
+ M_{\mathrm{lim}}(z) = m_{\mathrm{lim}} - \mu(z) - K(z) + E(z).
64
+
65
+ Args:
66
+ cosmo_obj: A PyCCL cosmology object.
67
+ z: Redshift value or array-like of redshift values.
68
+ m_lim: Apparent magnitude limit of the catalog.
69
+ h: Optional dimensionless Hubble parameter used in the
70
+ distance-modulus convention. If not provided, this is read from
71
+ ``cosmo_obj["h"]``.
72
+ k_correction: Optional k-correction term(s).
73
+ e_correction: Optional evolution-correction term(s).
74
+
75
+ Returns:
76
+ NumPy array of limiting absolute magnitudes.
77
+ """
78
+ z_arr = validate_array(z, name="z")
79
+
80
+ if np.any(z_arr < 0):
81
+ raise ValueError("Redshift z must be >= 0.")
82
+
83
+ if not np.isfinite(m_lim):
84
+ raise ValueError("m_lim must be finite.")
85
+
86
+ h_resolved = _resolve_h(cosmo_obj, h)
87
+
88
+ return absolute_magnitude(
89
+ cosmo_obj,
90
+ z_arr,
91
+ m_lim,
92
+ h=h_resolved,
93
+ k_correction=k_correction,
94
+ e_correction=e_correction,
95
+ )
96
+
97
+
98
+ def observed_number_density(
99
+ cosmo_obj: Cosmology,
100
+ z: FloatInput,
101
+ lf: LuminosityFunction,
102
+ *,
103
+ m_lim: float,
104
+ m_bright: float,
105
+ m_faint: float,
106
+ n_m: int = 512,
107
+ h: float | None = None,
108
+ k_correction: FloatInput | None = None,
109
+ e_correction: FloatInput | None = None,
110
+ ) -> FloatArray:
111
+ r"""Return number density observable in a magnitude-limited catalog.
112
+
113
+ This integrates the luminosity function over galaxies brighter than the
114
+ catalog limit,
115
+
116
+ .. math::
117
+
118
+ n_{\mathrm{obs}}(z) =
119
+ \int_{M_{\mathrm{bright}}}^{\min[M_{\lim}(z), M_{\mathrm{faint}}]}
120
+ \phi(M, z) \, dM.
121
+
122
+ Args:
123
+ cosmo_obj: A PyCCL cosmology object.
124
+ z: Redshift value or array-like of redshift values.
125
+ lf: Luminosity-function callable with signature ``lf(M, z)``.
126
+ m_lim: Apparent magnitude limit of the catalog.
127
+ m_bright: Bright absolute-magnitude bound of the LF model.
128
+ m_faint: Faint absolute-magnitude bound of the LF model.
129
+ n_m: Number of magnitude-grid points used for the integral.
130
+ h: Optional dimensionless Hubble parameter used in the
131
+ distance-modulus convention.
132
+ k_correction: Optional k-correction term(s).
133
+ e_correction: Optional evolution-correction term(s).
134
+
135
+ Returns:
136
+ NumPy array of observed number densities.
137
+ """
138
+ validate_magnitude_range(m_bright=m_bright, m_faint=m_faint)
139
+
140
+ z_arr = validate_array(z, name="z")
141
+ m_abs_lim = absolute_magnitude_limit(
142
+ cosmo_obj,
143
+ z_arr,
144
+ m_lim=m_lim,
145
+ h=h,
146
+ k_correction=k_correction,
147
+ e_correction=e_correction,
148
+ )
149
+
150
+ observed_upper = np.minimum(m_abs_lim, m_faint)
151
+
152
+ return _integrated_number_density(
153
+ z_arr,
154
+ lf,
155
+ m_bright=m_bright,
156
+ m_faint=observed_upper,
157
+ n_m=n_m,
158
+ )
159
+
160
+
161
+ def missing_number_density(
162
+ cosmo_obj: Cosmology,
163
+ z: FloatInput,
164
+ lf: LuminosityFunction,
165
+ *,
166
+ m_lim: float,
167
+ m_bright: float,
168
+ m_faint: float,
169
+ n_m: int = 512,
170
+ h: float | None = None,
171
+ k_correction: FloatInput | None = None,
172
+ e_correction: FloatInput | None = None,
173
+ ) -> FloatArray:
174
+ r"""Return number density missing from a magnitude-limited catalog.
175
+
176
+ This integrates the luminosity function over galaxies fainter than the
177
+ catalog limit,
178
+
179
+ .. math::
180
+
181
+ n_{\mathrm{miss}}(z) =
182
+ \int_{\max[M_{\lim}(z), M_{\mathrm{bright}}]}^{M_{\mathrm{faint}}}
183
+ \phi(M, z) \, dM.
184
+
185
+ Args:
186
+ cosmo_obj: A PyCCL cosmology object.
187
+ z: Redshift value or array-like of redshift values.
188
+ lf: Luminosity-function callable with signature ``lf(M, z)``.
189
+ m_lim: Apparent magnitude limit of the catalog.
190
+ m_bright: Bright absolute-magnitude bound of the LF model.
191
+ m_faint: Faint absolute-magnitude bound of the LF model.
192
+ n_m: Number of magnitude-grid points used for the integral.
193
+ h: Optional dimensionless Hubble parameter used in the
194
+ distance-modulus convention.
195
+ k_correction: Optional k-correction term(s).
196
+ e_correction: Optional evolution-correction term(s).
197
+
198
+ Returns:
199
+ NumPy array of missing number densities.
200
+ """
201
+ validate_magnitude_range(m_bright=m_bright, m_faint=m_faint)
202
+
203
+ z_arr = validate_array(z, name="z")
204
+ m_abs_lim = absolute_magnitude_limit(
205
+ cosmo_obj,
206
+ z_arr,
207
+ m_lim=m_lim,
208
+ h=h,
209
+ k_correction=k_correction,
210
+ e_correction=e_correction,
211
+ )
212
+
213
+ missing_lower = np.maximum(m_abs_lim, m_bright)
214
+
215
+ return _integrated_number_density(
216
+ z_arr,
217
+ lf,
218
+ m_bright=missing_lower,
219
+ m_faint=m_faint,
220
+ n_m=n_m,
221
+ )
222
+
223
+
224
+ def catalog_completeness_fraction(
225
+ cosmo_obj: Cosmology,
226
+ z: FloatInput,
227
+ lf: LuminosityFunction,
228
+ *,
229
+ m_lim: float,
230
+ m_bright: float,
231
+ m_faint: float,
232
+ n_m: int = 512,
233
+ h: float | None = None,
234
+ k_correction: FloatInput | None = None,
235
+ e_correction: FloatInput | None = None,
236
+ ) -> FloatArray:
237
+ r"""Return the LF fraction observable in a magnitude-limited catalog.
238
+
239
+ This returns
240
+
241
+ .. math::
242
+
243
+ f_{\mathrm{obs}}(z) =
244
+ \frac{n_{\mathrm{obs}}(z)}
245
+ {n_{\mathrm{obs}}(z) + n_{\mathrm{miss}}(z)}.
246
+
247
+ Args:
248
+ cosmo_obj: A PyCCL cosmology object.
249
+ z: Redshift value or array-like of redshift values.
250
+ lf: Luminosity-function callable with signature ``lf(M, z)``.
251
+ m_lim: Apparent magnitude limit of the catalog.
252
+ m_bright: Bright absolute-magnitude bound of the LF model.
253
+ m_faint: Faint absolute-magnitude bound of the LF model.
254
+ n_m: Number of magnitude-grid points used for the integral.
255
+ h: Optional dimensionless Hubble parameter used in the
256
+ distance-modulus convention.
257
+ k_correction: Optional k-correction term(s).
258
+ e_correction: Optional evolution-correction term(s).
259
+
260
+ Returns:
261
+ NumPy array of catalog completeness fractions.
262
+ """
263
+ observed = observed_number_density(
264
+ cosmo_obj,
265
+ z,
266
+ lf,
267
+ m_lim=m_lim,
268
+ m_bright=m_bright,
269
+ m_faint=m_faint,
270
+ n_m=n_m,
271
+ h=h,
272
+ k_correction=k_correction,
273
+ e_correction=e_correction,
274
+ )
275
+
276
+ missing = missing_number_density(
277
+ cosmo_obj,
278
+ z,
279
+ lf,
280
+ m_lim=m_lim,
281
+ m_bright=m_bright,
282
+ m_faint=m_faint,
283
+ n_m=n_m,
284
+ h=h,
285
+ k_correction=k_correction,
286
+ e_correction=e_correction,
287
+ )
288
+
289
+ return _fraction(observed, observed + missing)
290
+
291
+
292
+ def out_of_catalog_fraction(
293
+ cosmo_obj: Cosmology,
294
+ z: FloatInput,
295
+ lf: LuminosityFunction,
296
+ *,
297
+ m_lim: float,
298
+ m_bright: float,
299
+ m_faint: float,
300
+ n_m: int = 512,
301
+ h: float | None = None,
302
+ k_correction: FloatInput | None = None,
303
+ e_correction: FloatInput | None = None,
304
+ ) -> FloatArray:
305
+ r"""Return the LF fraction missing from a magnitude-limited catalog.
306
+
307
+ This returns
308
+
309
+ .. math::
310
+
311
+ f_{\mathrm{miss}}(z) = 1 - f_{\mathrm{obs}}(z).
312
+
313
+ Args:
314
+ cosmo_obj: A PyCCL cosmology object.
315
+ z: Redshift value or array-like of redshift values.
316
+ lf: Luminosity-function callable with signature ``lf(M, z)``.
317
+ m_lim: Apparent magnitude limit of the catalog.
318
+ m_bright: Bright absolute-magnitude bound of the LF model.
319
+ m_faint: Faint absolute-magnitude bound of the LF model.
320
+ n_m: Number of magnitude-grid points used for the integral.
321
+ h: Optional dimensionless Hubble parameter used in the
322
+ distance-modulus convention.
323
+ k_correction: Optional k-correction term(s).
324
+ e_correction: Optional evolution-correction term(s).
325
+
326
+ Returns:
327
+ NumPy array of out-of-catalog fractions.
328
+ """
329
+ completeness = catalog_completeness_fraction(
330
+ cosmo_obj,
331
+ z,
332
+ lf,
333
+ m_lim=m_lim,
334
+ m_bright=m_bright,
335
+ m_faint=m_faint,
336
+ n_m=n_m,
337
+ h=h,
338
+ k_correction=k_correction,
339
+ e_correction=e_correction,
340
+ )
341
+
342
+ return np.asarray(1.0 - completeness, dtype=float)
343
+
344
+
345
+ def _resolve_h(
346
+ cosmo_obj: Cosmology,
347
+ h: float | None,
348
+ ) -> float:
349
+ """Return explicit h or read it from a PyCCL-style cosmology object."""
350
+ if h is not None:
351
+ if not np.isfinite(h):
352
+ raise ValueError("h must be finite.")
353
+ return float(h)
354
+
355
+ try:
356
+ h_from_cosmo = cosmo_obj["h"]
357
+ except (KeyError, TypeError, AttributeError) as exc:
358
+ raise ValueError(
359
+ "h was not provided and could not be read from cosmo_obj['h']."
360
+ ) from exc
361
+
362
+ if not np.isfinite(h_from_cosmo):
363
+ raise ValueError("cosmo_obj['h'] must be finite.")
364
+
365
+ return float(h_from_cosmo)
366
+
367
+
368
+ def _fraction(
369
+ numerator: FloatArray,
370
+ denominator: FloatArray,
371
+ ) -> FloatArray:
372
+ r"""Return a clipped fraction with safe zero-denominator handling."""
373
+ with np.errstate(divide="ignore", invalid="ignore"):
374
+ result = np.divide(
375
+ numerator,
376
+ denominator,
377
+ out=np.zeros_like(numerator, dtype=float),
378
+ where=denominator > 0.0,
379
+ )
380
+
381
+ return np.asarray(np.clip(result, 0.0, 1.0), dtype=float)