-
Notifications
You must be signed in to change notification settings - Fork 0
/
halo_mass_correction.py
652 lines (434 loc) · 40 KB
/
halo_mass_correction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
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
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
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
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
#!/usr/bin/python
import numpy as np
import warnings
def known_envs():
return ['all', 'high', 'low']
def known_halo_defs():
return ['200b', 'fof', 'vir', '200c', '500c']
def known_redshifts():
return [0, 1, 2]
def known_sims():
return['illustris', 'tng', 'eagle']
def correction(halo_masses=None, env=None, halo_def=None, redshift=None, sim=None):
if (type(halo_masses) is not np.ndarray):
raise ValueError("Halo masses must be ndarray")
if (env is not None) and (not(env in known_envs())):
raise ValueError("Unrecognized environment {}; not in {}".format(env,known_envs()))
if (halo_def is not None) and (not(halo_def in known_halo_defs())):
raise ValueError("Unrecognized halo definition {}; not in {}".format(halo_def,known_halo_defs()))
if (redshift is not None) and (not(redshift in known_redshifts())):
raise ValueError("Unrecognized redshift {}; not in {}".format(redshift,known_redshifts()))
if (sim is not None) and (not(sim in known_sims())):
raise ValueError("Unrecognized simulation {}; not in {}".format(sim,known_sims()))
# 7th order polynomial coefficients
# In order from lowest to highest order
# h,g,f,e,d,c,b,a
# Limits ------------------------------------------------------------------------------------------------
lower_lim = 0.0
illustris_200b_z0_lim = [4.506, 3.778] # 0.0
illustris_fof_z0_lim = [4.547, 3.732] # -0.02355
illustris_vir_z0_lim = [4.461722, 3.69] # -0.04699
illustris_200c_z0_lim = [4.31075, 3.544] # -0.11062
illustris_500c_z0_lim = [4.15312, 3.415] # -0.20723
illustris_200b_z1_lim = [3.894033, 3.079] # 0.0069116
illustris_fof_z1_lim = [3.99583, 3.079] # 0.0145398
illustris_vir_z1_lim = [3.8919, 3.079] # 0.00259
illustris_200c_z1_lim = [3.87593, 3.041] # -0.03139
illustris_500c_z1_lim = [3.77877, 2.892] # -0.164229
illustris_200b_z2_lim = [3.431504, 2.892] # -0.038117
illustris_fof_z2_lim = [3.454932, 2.929] # 0.0039616
illustris_vir_z2_lim = [3.440517, 2.914] # -0.026964
illustris_200c_z2_lim = [3.419901, 2.863] # -0.053446
illustris_500c_z2_lim = [3.283323, 2.556] # -0.216978
tng_200b_z0_lim = [4.5632, 3.851] # 0.0
tng_fof_z0_lim = [4.6137, 3.826] # -0.0126
tng_vir_z0_lim = [4.51233, 3.806] # -0.039742
tng_200c_z0_lim = [4.39229, 3.748] # -0.095739
tng_500c_z0_lim = [4.18853, 3.633] # -0.18644
tng_200b_z1_lim = [3.9420701, 3.146] # 0.0161748
tng_fof_z1_lim = [4.06121, 3.146] # 0.043418
tng_vir_z1_lim = [3.94139, 3.146] # 0.0149178
tng_200c_z1_lim = [3.927203, 3.114] # -0.015585
tng_500c_z1_lim = [3.83258, 2.968] # -0.14414
tng_200b_z2_lim = [3.479303, 2.929] # -0.018838
tng_fof_z2_lim = [3.53066, 3.000] # 0.047641
tng_vir_z2_lim = [3.48834, 2.954] # -0.0070274
tng_200c_z2_lim = [3.468753, 2.898] # -0.031539
tng_500c_z2_lim = [3.333151, 2.919] # -0.191271
eagle_200b_z0_lim = [4.6337, 3.462] # 0.0
eagle_fof_z0_lim = [4.64223, 3.431] # -0.02465
eagle_vir_z0_lim = [4.532972, 3.398] # -0.040708
eagle_200c_z0_lim = [4.41142, 3.322] # -0.097427
eagle_500c_z0_lim = [4.24821, 3.204] # -0.187506
eagle_200b_z1_lim = [3.963173, 3.041] # 0.016026
eagle_fof_z1_lim = [3.986902, 3.041] # 0.022825
eagle_vir_z1_lim = [3.96243, 3.041] # 0.014719
eagle_200c_z1_lim = [3.94511, 3.041] # -0.0150799
eagle_500c_z1_lim = [3.85444, 2.875] # -0.142949
eagle_200b_z2_lim = [3.307168, 2.826] # -0.018599
eagle_fof_z2_lim = [3.458173, 2.813] # 0.021538
eagle_vir_z2_lim = [3.3248951, 2.833] # -0.00640438
eagle_200c_z2_lim = [3.2873807, 2.813] # -0.031147
eagle_500c_z2_lim = [3.129049, 2.623] # -0.191171
# z = 0 fits -----------------------------------------------------------------------------------------------------
illustris_200b_z0_all = [-0.14617387744227295, 0.6542115908569455, -0.7597679365260338, 0.3226449176328757,
-0.051119616074891024, -0.004405899313613664, 0.0024375223640344824, -0.00021501871382708718]
illustris_200b_z0_high = [-0.13645933246854436, 0.5597792378991698, -0.49837348477938787, 0.08244069353697225,
0.05090254211679115, -0.02582918842488714, 0.004510033201996715, -0.00028207190427428555]
illustris_200b_z0_low = [-0.13212021519968087, 0.45108166035002434, 0.016646969855052617, -1.028145862709681,
1.0970968875374307, -0.5063766717865839, 0.11086054099315279, -0.00937054442416172]
tng_200b_z0_all = [-0.19175546885736067, 0.178005927903261, -0.45740775879650153, 0.9495674509627003,
-0.7913466658975902, 0.30054843069467346, -0.0529299272509516, 0.00352040495497844]
tng_200b_z0_high = [-0.19603831493372278, 0.23833081344155999, -0.63491841045392, 1.1918741068651137,
-0.9484417937125081, 0.3522995925314075, -0.06133001166815348, 0.004053605614719614]
tng_200b_z0_low = [-0.18390074479223587, 0.027276010479617613, 0.12559672679349831, 0.015843374173120907,
-0.07484878813935254, 0.01805088211442631, 0.0022651996424573927, -0.0007122055851257501]
eagle_200b_z0_all = [-0.2311995427385408, 0.06310593007103844, -0.3627839319316193, 0.6686102231295079,
-0.4914495821646675, 0.17485312562522662, -0.029909843049898622, 0.001969487510860234]
eagle_200b_z0_high = [-0.23137674309346185, 0.0690414708853592, -0.3446371700210964, 0.6417949520871051,
-0.48138045006289487, 0.1740060685910219, -0.030087316952308176, 0.0019950864650660543]
eagle_200b_z0_low = [-0.2227973724362608, -0.027582042949793273, -0.08944473257118872, 0.2606624789339742,
-0.17942038773178515, 0.050413493570263486, -0.005094942572776425, 6.1937720351502876e-06]
illustris_fof_z0_all = [-0.10679238398226269, 0.4707474379226831, -0.39730140951066517, -0.03320984820869885,
0.13949495265291526, -0.05997015914814677, 0.010774431113383224, -0.0007236687730890095]
illustris_fof_z0_high = [-0.10176261776810958, 0.3855689440519127, -0.08272922684420651, -0.40672354347233053,
0.3542606062226041, -0.12490194717572932, 0.020665884377778044, -0.0013216681370677877]
illustris_fof_z0_low = [-0.11029798420950317, 0.4426144319015116, -0.23470747256487146, -0.40376701784206676,
0.4855426172132668, -0.2149750269007879, 0.04391488790484054, -0.003437270439570747]
tng_fof_z0_all = [-0.1898245979391463, 0.1129375337798456, -0.2612408385583268, 0.6156499977956196,
-0.5439576320768931, 0.2133361715617764, -0.03839550372393726, 0.0025960041613136476]
tng_fof_z0_high = [-0.1917848532250287, 0.13638997957295593, -0.34240106080025956, 0.7575737875661643,
-0.6549524718358011, 0.256065429449158, -0.04631458753917691, 0.0031591338221689217]
tng_fof_z0_low = [-0.18229948528687984, -0.038197402441029024, 0.3945495188363177, -0.4975282328117368,
0.34500473439568086, -0.1470205883238103, 0.03310823937666671, -0.0029062718532688217]
eagle_fof_z0_all = [-0.20007158319785157, 0.007495059770208189, -0.20160431575081555, 0.4655654916166216,
-0.3701837844189986, 0.13730747525054202, -0.02409357280234005, 0.0016136887013015464]
eagle_fof_z0_high = [-0.19728407972548645, -0.014541499518332996, -0.08747834514077094, 0.32554434745695043,
-0.3034012387495678, 0.12344253411641586, -0.023018637694039796, 0.0016087992738078464]
eagle_fof_z0_low = [-0.1997060280642237, -0.011213061501152335, -0.15123456687087752, 0.32969618624715696,
-0.21389622984071752, 0.058548839440441064, -0.005997477123344184, 4.3826528295789246e-05]
illustris_vir_z0_all = [-0.12001121111140035, 0.6790441665105842, -0.8336504839648724, 0.36890411209850876,
-0.05971332208883271, -0.006643112116610182, 0.0035048733466904267, -0.00032517388927140776]
illustris_vir_z0_high = [-0.13658685553319372, 0.7842985861883908, -1.0518899623989328, 0.6426293027508886,
-0.2381310775015118, 0.053502502966015685, -0.006512853713024954, 0.0003274401643765194]
illustris_vir_z0_low = [-0.1253367655894976, 0.6096521963549291, -0.42138673845925256, -0.5089142603420744,
0.7667319342438377, -0.392276288128861, 0.09091507655898586, -0.00800023335529282]
tng_vir_z0_all = [-0.1969689087452731, 0.13287970772643712, -0.30528046694494176, 0.7855926206816709,
-0.711520425945494, 0.2808742891584246, -0.05052273523563357, 0.0034041660667029515]
tng_vir_z0_high = [-0.2062067451940429, 0.20723520680233762, -0.4929223759759362, 1.0218344493708094,
-0.85770046856314, 0.32688467709024777, -0.057633373906368114, 0.003833367772701171]
tng_vir_z0_low = [-0.18654371775130127, -0.09858391264369441, 0.775009747642314, -1.1416001965870186,
0.9177336519781242, -0.4241804600058812, 0.10013182370738903, -0.009156537880597452]
eagle_vir_z0_all = [-0.23903175331893076, 0.05753201531752248, -0.3423123787161001, 0.6622367331106922,
-0.5023132421865825, 0.18263707091350537, -0.031718147205809684, 0.00211154862694684]
eagle_vir_z0_high = [-0.24488048027422674, 0.10742677348953776, -0.4227033025744317, 0.7255841330425725,
-0.5319886506471857, 0.19068339995395184, -0.03284639991931692, 0.002173718246777437]
eagle_vir_z0_low = [-0.24129477934032662, 0.05921521197894987, -0.3522058012858875, 0.6578691611739569,
-0.4862957815477437, 0.1735818142922927, -0.02965580382530352, 0.0019361776464567135]
illustris_200c_z0_all = [-0.06949108466896864, 0.6531911342658848, -0.7317258137897483, 0.14681939681424117,
0.12920508175654405, -0.0849369779997166, 0.019281646067545243, -0.0015556346959994685]
illustris_200c_z0_high = [-0.10774757403375067, 0.9594144831665401, -1.4831012703838413, 1.088908187419765,
-0.49339249097676524, 0.1343248575050803, -0.019618353859768584, 0.0011725171475763332]
illustris_200c_z0_low = [-0.10244309640753685, 0.8207687680385262, -1.0022762456869792, 0.09730920665703484,
0.4538532503509365, -0.3107927311770897, 0.08120411033342087, -0.007622456675293305]
tng_200c_z0_all = [-0.20515269311310955, 0.07519312756431225, -0.07307134880715169, 0.548821023776795,
-0.6170568171003823, 0.26672207175047763, -0.05057577764916043, 0.0035389730662138894]
tng_200c_z0_high = [-0.2216745207445267, 0.2804645982795591, -0.6242073335719002, 1.213936042322707,
-1.0228307089865385, 0.39700599037026546, -0.07159585413842157, 0.004882130757234236]
tng_200c_z0_low = [-0.1989307518492572, -0.1497260111976448, 1.23949658894484, -2.083495084109326,
1.772929847245093, -0.8173926876364362, 0.189013087854002, -0.016975952466254267]
eagle_200c_z0_all = [-0.2483164984278586, 0.051157599420364026, -0.3364342139402906, 0.7046608510402496,
-0.5593382859696046, 0.20892671927718323, -0.036885102103561496, 0.0024824633463024315]
eagle_200c_z0_high = [-0.26261063816871116, 0.15460910333395678, -0.5575490272590042, 0.9163769465035149,
-0.6675804118755094, 0.23973944271849673, -0.04149049491889607, 0.0027637355889184516]
eagle_200c_z0_low = [-0.2548912650136272, 0.09469119934028249, -0.37903251126032045, 0.6040178028190446,
-0.3692247485831818, 0.09149192746387044, -0.00544104371239548, -0.0006259554946068391]
illustris_500c_z0_all = [0.02983597641894162, 0.7675667940860145, -1.3004231378109474, 0.9649435794845659,
-0.46590728483953325, 0.14306649098303056, -0.02424405855459025, 0.0016926533547197184]
illustris_500c_z0_high = [-0.03729914705992448, 1.2765167749945538, -2.444012331861864, 2.251444273765133,
-1.233559765139749, 0.3894318279909383, -0.06446374609610907, 0.004316157716366339]
illustris_500c_z0_low = [-0.04870323357464897, 1.2719538937138044, -2.683888193837139, 2.697764665180534,
-1.6365240559731813, 0.58452434013191, -0.11192093586599727, 0.00884262486341795]
tng_500c_z0_all = [-0.21708845368218602, 0.08891977476436731, 0.1456629040729511, 0.13573386031614804,
-0.30347110797673976, 0.14529367462441414, -0.026946832677484586, 0.0017185161014946046]
tng_500c_z0_high = [-0.24536412951471148, 0.41489885008529886, -0.7750197345493067, 1.3050070716085662,
-1.0649292245416584, 0.40920422267185863, -0.07324786789319684, 0.004951578182245643]
tng_500c_z0_low = [-0.24587385148930874, 0.34901933347461966, -0.08525650731053519, -0.42260527395354086,
0.6927356252988954, -0.45147051395232346, 0.12858348836063635, -0.013201331967944908]
eagle_500c_z0_all = [-0.26156498670344847, 0.013890110026594302, -0.22731488996132354, 0.6517402290316522,
-0.5759119252063023, 0.22567161970892985, -0.04072691199394799, 0.0027659525347239425]
eagle_500c_z0_high = [-0.2872546617107539, 0.3051577049648186, -1.090548679948901, 1.7959319133729887,
-1.3585493030217426, 0.5100029674466159, -0.09261166544541863, 0.006497045083607254]
eagle_500c_z0_low = [-0.2702427818979198, 0.08057655017614213, -0.3481283218150602, 0.6283431714009946,
-0.4123321602319992, 0.11020342249562345, -0.00896085210137087, -0.0003495363362264275]
# -----------------------------------------------------------------------------------------------------------------
# z = 1 fits ------------------------------------------------------------------------------------------------------
illustris_200b_z1_all = [0.029147057587328384, 0.05155931418402206, 0.8261394122237115, -1.8802180736782967,
1.5556114065414925, -0.6216445089961606, 0.12077525365838669, -0.009139355496602301]
illustris_200b_z1_high = [0.03674991642360348, 0.0990026960043859, 0.6641361018267878, -1.6049354314889845,
1.3246189607645882, -0.5234817810328249, 0.10030839051278563, -0.0074724925687878795]
illustris_200b_z1_low = [0.027386193313661, -0.030370500882775844, 1.0504259769277493, -2.225889159753577,
1.8343470721205386, -0.7340137460483032, 0.14107390180662804, -0.010226933038767623]
tng_200b_z1_all = [-0.18408065543605245, 0.09549332942909844, -0.036330756038256605, 0.28702680546258585,
-0.2778842979678821, 0.09552814073005429, -0.012751584736343243, 0.00045851097078880354]
tng_200b_z1_high = [-0.1814147346037916, 0.06785026786348684, 0.10118217982857386, 0.06183770154093521,
-0.10719045492028455, 0.029589203959780184, -0.000193798650971329, -0.00047503958513440194]
tng_200b_z1_low = [-0.18539007687984818, 0.11624246233136083, -0.18296891599795106, 0.6008351682134679,
-0.6128972362418519, 0.28860014869910355, -0.06945280003608734, 0.007072044591035196]
eagle_200b_z1_all = [-0.2562514288283843, 0.18134708123469964, -0.6135792519617913, 1.091951251781443,
-0.83424695338623, 0.310401484580847, -0.055802202222938004, 0.003891566127347595]
eagle_200b_z1_high = [-0.25409455095160116, 0.14893684963674367, -0.4819699140632346, 0.9043908020874585,
-0.7136032164399931, 0.27161575897081663, -0.049699496545146514, 0.0035169177637027777]
eagle_200b_z1_low = [-0.23898622006853154, -0.021421951910202276, 0.13850596897015988, -0.17733115268255648,
0.25838213754268086, -0.18329755809688544, 0.055582769187370304, -0.006006273234731432]
illustris_fof_z1_all = [-0.001736931138322853, 0.15201530743419972, 0.2527129693289776, -0.8487186458497473,
0.7295891450727126, -0.28931971333233153, 0.055164599779502936, -0.00408269377719892]
illustris_fof_z1_high = [0.009759200497420907, 0.14010975843867826, 0.30641090699961454, -0.9018829724188161,
0.743877738271951, -0.28691464382740123, 0.053565121281786574, -0.0038987009885942986]
illustris_fof_z1_low = [0.0015747274083314222, -0.007368743367191606, 0.8452128388458856, -1.8834706490079287,
1.6411777899282836, -0.7082729218579695, 0.15122578663521843, -0.012759207597474322]
tng_fof_z1_all = [-0.18654355018235452, 0.057663987567521495, -0.0026785827713399993, 0.15704586031564552,
-0.1712540263273953, 0.0657366335441655, -0.010626247354015789, 0.0006068653329560899]
tng_fof_z1_high = [-0.18334114308118166, 0.023398723969294603, 0.14645896195501795, -0.0674989888483402,
-0.0114791831231431, 0.007728432279016992, -0.000251942384625083, -0.00011803287748945393]
tng_fof_z1_low = [-0.18782368481142145, 0.07922793398589525, -0.09466762338187495, 0.26048338831217827,
-0.21262970074214071, 0.06816015368614046, -0.009242817481473731, 0.00047885555081362874]
eagle_fof_z1_all = [-0.2072573466041586, 0.10451930544858835, -0.33582305431202014, 0.6035083742638425,
-0.4525206421475703, 0.16367865046323626, -0.02851839363488886, 0.0019260753509478723]
eagle_fof_z1_high = [-0.20422775362453655, 0.0851875365715913, -0.2783004509317934, 0.5135646006370083,
-0.38237160646444635, 0.13515200809132838, -0.022737038217766285, 0.0014668349675046538]
eagle_fof_z1_low = [-0.20257791098252842, 0.05643389905127682, -0.1626245827350403, 0.27748441034754834,
-0.10183812807293006, -0.04154221673349907, 0.031292489569884716, -0.00481862198303972]
illustris_vir_z1_all = [0.0314287674878194, 0.05023974933502734, 0.8439593408797853, -1.9225586995214232,
1.5956361334591311, -0.6399584728587103, 0.12480593701447426, -0.009480798130801953]
illustris_vir_z1_high = [0.03967183600001003, 0.10432118080919449, 0.6360518867969611, -1.5603184896989881,
1.2918191504986372, -0.5114690404033768, 0.09817744809513522, -0.007326552948373046]
illustris_vir_z1_low = [0.03032117641865042, -0.043551343076471835, 1.1099299067611457, -2.3221771898552834,
1.8988144318529547, -0.7516303629576113, 0.14207040004988, -0.010028061003412601]
tng_vir_z1_all = [-0.18443230541616729, 0.09721971998962112, -0.04248913234095903, 0.29864405555971585,
-0.2877389197938149, 0.09954310554060476, -0.013529573498252422, 0.0005163804799812123]
tng_vir_z1_high = [-0.18125665426209359, 0.06577837554389306, 0.11078970395399698, 0.05043454264150988,
-0.10122358303070751, 0.027968174430897143, 3.797980609168896e-05, -0.000489266059205994]
tng_vir_z1_low = [-0.18631849797213768, 0.12265089157938712, -0.20755605455309362, 0.6398418685341651,
-0.6428521639019164, 0.30055214037285216, -0.07183032176097069, 0.007257279892642411]
eagle_vir_z1_all = [-0.25994841189491075, 0.21659557059026438, -0.7228233831631615, 1.240646156260516,
-0.9381708180092224, 0.3491113425407598, -0.06307114596419325, 0.0044310189726440045]
eagle_vir_z1_high = [-0.25642852122123977, 0.1674936124029912, -0.5299834665951271, 0.9569341972238437,
-0.7450650898048249, 0.2825698546564051, -0.05174642318778814, 0.00367303806805416]
eagle_vir_z1_low = [-0.24084715007001017, 0.0019658936582274945, 0.03911522962697557, 0.012294202774964383,
0.07332645140356776, -0.08805464054630419, 0.031089448168620002, -0.0035319775327960277]
illustris_200c_z1_all = [0.04602319350017323, 0.12018742011394498, 0.7163398461356696, -1.8951693555130278,
1.6674994192671582, -0.6967382158729805, 0.14050134881023624, -0.010985987838013338]
illustris_200c_z1_high = [0.05646303498600296, 0.18821530579118056, 0.41825020588079387, -1.3784186237600313,
1.2437141041805189, -0.5211318004987694, 0.10477972022509771, -0.008146893998482093]
illustris_200c_z1_low = [0.047557155036894054, -0.015322370647797815, 1.1505159166077432, -2.6254614468619093,
2.3062588432366313, -0.9870728083124746, 0.20508904651203733, -0.01643672039949275]
tng_200c_z1_all = [-0.189668010738932, 0.09871965838000511, -0.01938165534124216, 0.2864793155497054,
-0.29737227643401887, 0.10835850735987751, -0.015852407309438887, 0.0007218544013690075]
tng_200c_z1_high = [-0.18964200844843462, 0.10797796821922732, -0.0005205245775003915, 0.23287003919940896,
-0.25069659775430425, 0.08918678495959141, -0.012099742481044912, 0.00044151695838318513]
tng_200c_z1_low = [-0.1954086841261561, 0.19914752228160768, -0.58487549661703, 1.4723812885776093,
-1.505779870254175, 0.7494156446956711, -0.18577989265570416, 0.018483935424812657]
eagle_200c_z1_all = [-0.2609435154460945, 0.18489005772837136, -0.6277810387929077, 1.1290200088021134,
-0.8669983045087482, 0.3225810783078882, -0.05776505667158825, 0.004001128671680977]
eagle_200c_z1_high = [-0.26358194566299226, 0.17360237744644216, -0.5038263650716914, 0.8845463006669578,
-0.6708422370896616, 0.2463598898039282, -0.04344631171483906, 0.0029567811521699367]
eagle_200c_z1_low = [-0.2453811969528881, -0.010235750315749362, 0.14675944073217229, -0.2563180716581519,
0.4030403127831938, -0.2929156840264221, 0.09198963763581752, -0.01039648778587241]
illustris_500c_z1_all = [0.1468300608113333, 0.43536940112488, -0.31908943890332664, -0.6513100114637899,
0.8909603812620723, -0.42660586445555254, 0.09023275397056764, -0.0070729798445301586]
illustris_500c_z1_high = [0.15031173140838705, 0.6104444689590673, -0.897519128228984, 0.2105459027988286,
0.252705519228507, -0.18354357547604158, 0.04454371559241226, -0.003714570123987371]
illustris_500c_z1_low = [0.1319068744486204, 0.24289510567774067, 0.604612908695789, -2.565450550555706,
2.845320059481131, -1.4579692153691801, 0.35908420991754864, -0.034304804489398544]
tng_500c_z1_all = [-0.20366475707572335, 0.11683896887028253, 0.11428924055836305, 0.07965941216579057,
-0.14362943832610436, 0.03842654508313433, 0.001150681443846316, -0.0008956242271117282]
tng_500c_z1_high = [-0.21559774055249414, 0.24102975217658354, -0.2506118550022808, 0.6319909746860992,
-0.6035508131440337, 0.245893045769029, -0.04595763376804129, 0.0033027339780482188]
tng_500c_z1_low = [-0.18471393501053357, -0.1486609315620764, 1.121803953525317, -1.6061082359432168,
1.2578538333127092, -0.5541899126938955, 0.12009903789854652, -0.009472113488925397]
eagle_500c_z1_all = [-0.2708252066572316, 0.12878701170542275, -0.43779491935975473, 1.0062653688422896,
-0.852085293792356, 0.3262428116844268, -0.05773491410735771, 0.0038343177644794128]
eagle_500c_z1_high = [-0.2909080669109669, 0.29411319118942386, -0.8762872644018311, 1.5079119224248807,
-1.1444769786760918, 0.415508701971698, -0.0710838602565833, 0.004588077476487396]
eagle_500c_z1_low = [-0.2614265242925629, 0.014796005572430769, 0.10480117868099496, -0.06017406419027135,
0.17829174109696497, -0.19254043329895, 0.07328677552700735, -0.009275497322598553]
# -----------------------------------------------------------------------------------------------------------------
# z = 2 fits ------------------------------------------------------------------------------------------------------
illustris_200b_z2_all = [0.10298313044985147, 0.06083447101720786, 0.14959448663093897, -0.5473275158739067,
0.514172248590623, -0.22137820963347718, 0.045200368588424626, -0.003523257750903986]
illustris_200b_z2_high = [0.1302093296031715, 0.04648501307407643, 0.2147600872769969, -0.6448074532163149,
0.5759131041062486, -0.2413396401223905, 0.04844163818346727, -0.003730717084119796]
illustris_200b_z2_low = [0.08119762289053752, 0.07810634234097646, -0.14135430576866953, 0.3265244100800232,
-0.6344674248357473, 0.5190167654488285, -0.1828304704995996, 0.023188290861319176]
tng_200b_z2_all = [-0.16931955400901455, 0.2043114592099285, -0.36722396875905755, 0.7436276165335712,
-0.6256284075330834, 0.2403191455902925, -0.04324765144100854, 0.002991882746352161]
tng_200b_z2_high = [-0.1684849959819701, 0.24659036923736724, -0.4813370498118064, 0.9487927930275112,
-0.8215351907010415, 0.3359374292795917, -0.06603932610078214, 0.005096111560207596]
tng_200b_z2_low = [-0.17404162677302323, 0.22658793538337332, -0.5509572631335569, 1.158489254807051,
-1.0855909716783667, 0.4982357672183157, -0.11224508726670743, 0.009863622542185917]
eagle_200b_z2_all = [-0.2335358978830884, 0.06478337963214864, 0.08802471018053493, -0.12594017863179463,
0.1651790325676654, -0.1244238174376405, 0.0408135521694743, -0.004706728466895028]
eagle_200b_z2_high = [-0.23830260916493526, 0.10476881574188775, -0.13931857376526038, 0.33386981200191096,
-0.27045440142925337, 0.0835430307505942, -0.007503271673546382, -0.00036829342457970327]
eagle_200b_z2_low = [-0.2293634848422341, 0.08136244491126181, -0.08788666954484106, 0.4758536898439305,
-0.7283644183179953, 0.5158526021799058, -0.17532172794004078, 0.02276287828035854]
illustris_fof_z2_all = [0.04872520356011363, 0.016796560591113466, 0.27535107491870403, -0.7499800904849315,
0.7533139331037918, -0.3752436042721213, 0.09224217927516415, -0.008879829214555476]
illustris_fof_z2_high = [0.06768627786158524, -0.002468230859399324, 0.3947361044903716, -0.982938198857638,
0.9562227031647009, -0.46652007898839504, 0.11289996351753517, -0.01073478441929273]
illustris_fof_z2_low = [0.019683727601515308, 0.21530793146962343, -0.6981207311251794, 1.337160218404682,
-1.5452673135077208, 0.972865055225037, -0.30619705071770176, 0.03765002167711289]
tng_fof_z2_all = [-0.1853179217006942, 0.16692469893238224, -0.3123292161644534, 0.4925238562543422,
-0.3693399679668528, 0.13513676885796713, -0.02407952473017933, 0.001704729711265832]
tng_fof_z2_high = [-0.18052262918765746, 0.16074285046598974, -0.3123714998454217, 0.511509864267913,
-0.4017084040130225, 0.15702540122815362, -0.030458706536088526, 0.0023721101667419117]
tng_fof_z2_low = [-0.18023459812997414, 0.08072977032460414, -0.018068815660028402, -0.004630690389742732,
0.09468273422333842, -0.10105071847993469, 0.036515543116172756, -0.004453103222214249]
eagle_fof_z2_all = [-0.1742121200887811, -0.020679815811741966, 0.2379970140900072, -0.3434881882199366,
0.2962589948127496, -0.14904640895558155, 0.03816927579367056, -0.0037937522497821946]
eagle_fof_z2_high = [-0.17279796790022378, 0.00336316174239503, 0.08502637966496177, -0.02664660875551922,
-0.009285128017460332, -0.001252161218463488, 0.00349219362306114, -0.000654482200115364]
eagle_fof_z2_low = [-0.17438571432026448, -0.05012882459711583, 0.3699606985464895, -0.5441691975037896,
0.41671211217139675, -0.16361200548161026, 0.028574760417138308, -0.001431259854665295]
illustris_vir_z2_all = [0.09819887277116328, 0.04708446650519629, 0.16667198980593423, -0.5410861066953402,
0.49535176969849215, -0.2111204369261384, 0.04307769143383233, -0.0033820737007026693]
illustris_vir_z2_high = [0.12173019693343075, 0.049992330971116807, 0.19206798539967124, -0.5952827522728245,
0.5366158218861176, -0.22826365139159252, 0.04692034608973773, -0.003736758282834959]
illustris_vir_z2_low = [0.07359315883970696, 0.11432814665011987, -0.32675026990466294, 0.7385157555399053,
-1.0839228282036464, 0.7710389972565259, -0.25239350820920553, 0.030668397328927798]
tng_vir_z2_all = [-0.1681109164778433, 0.1924707502048483, -0.3167240716843121, 0.6423110778369667,
-0.5329000493212002, 0.19858614961505627, -0.03418309385640588, 0.002230944982560329]
tng_vir_z2_high = [-0.16850720117732212, 0.253279285600977, -0.5206937470245676, 1.0088682071074,
-0.8665450416481426, 0.354567702570715, -0.07002167909426912, 0.0054332879441484246]
tng_vir_z2_low = [-0.17024128964200108, 0.17328144106259266, -0.27227651149263665, 0.5435579067478931,
-0.4340936609209095, 0.14558336115890746, -0.01822450181229552, 8.613788752613999e-05]
eagle_vir_z2_all = [-0.23170505746358477, 0.06406703175053022, 0.0667106448199192, -0.07563816321912997,
0.11237032894932661, -0.09601166126956388, 0.033339947978224795, -0.003949946875333708]
eagle_vir_z2_high = [-0.23215671394116294, 0.07087250205081334, -0.0380443499281126, 0.1790430878132414,
-0.14905257698849259, 0.03390313471388164, 0.002568436278305894, -0.0011678546649737118]
eagle_vir_z2_low = [-0.22889725745158834, 0.07675747562252248, -0.08561256436997583, 0.4576760350279377,
-0.6779982389148922, 0.4668056114259181, -0.15534229726927695, 0.019864298716352133]
illustris_200c_z2_all = [0.11155266878223563, 0.07631716725797208, 0.10120906773445378, -0.48855654833566703,
0.4778708601393326, -0.2102948868452465, 0.04378975570932114, -0.003489505722500052]
illustris_200c_z2_high = [0.14862496966747132, -0.015380719562659066, 0.4487290768484293, -1.0434952448017738,
0.91642907724003, -0.39275497545170807, 0.08187655697861368, -0.0066262021281050035]
illustris_200c_z2_low = [0.08787100486235552, 0.06988306283085702, -0.08354913052441, 0.16161453910554022,
-0.4357410455062733, 0.4055599701237225, -0.15355402742912572, 0.02051636307943138]
tng_200c_z2_all = [-0.16962023420584316, 0.20234821462385166, -0.36117116537575356, 0.755269318421981,
-0.6500112216021887, 0.25559094977062113, -0.04736089693378809, 0.0034023918080500603]
tng_200c_z2_high = [-0.16882856354845313, 0.24783609786835994, -0.4772512903507912, 0.9607934645635922,
-0.8487479017709066, 0.35379944386014067, -0.0709367042176851, 0.005585053878649677]
tng_200c_z2_low = [-0.1773806698768854, 0.264302899676952, -0.7448576741425028, 1.5991713998069914,
-1.5637373340083887, 0.7635046713080481, -0.18518185136022894, 0.017738409229861085]
eagle_200c_z2_all = [-0.23506224591283037, 0.05981756913019981, 0.14118734789097342, -0.24769685876118627,
0.2953305117075062, -0.19540558796299873, 0.05972325820528785, -0.006651546115083537]
eagle_200c_z2_high = [-0.24072455972489618, 0.11165288708886685, -0.11970399526151237, 0.2604815998559103,
-0.18528724082927936, 0.038109803150048645, 0.0039017495680826295, -0.0014593531756012595]
eagle_200c_z2_low = [-0.22770373484615053, 0.020220957036236453, 0.2546867246277585, -0.29405416908229876,
0.13133079522775426, 0.016800304699008593, -0.03201306095268485, 0.006711949836164909]
illustris_500c_z2_all = [0.2229992989013483, 0.17876516015203445, -0.03361889352942191, -0.7125944346126333,
0.9689523575196453, -0.5361123234649428, 0.13530838312003415, -0.01284140850239575]
illustris_500c_z2_high = [0.26724018008916356, 0.22475074478244345, -0.189472501949019, -0.5505816865688753,
0.882913181474635, -0.5119649980507168, 0.13226186364193576, -0.012781328425385341]
illustris_500c_z2_low = [0.1894948689433535, 0.016232251234490548, 0.7352849951211887, -2.267573140429623,
2.5298251881430174, -1.350192109547698, 0.3453197752598526, -0.0338866149091873]
tng_500c_z2_all = [-0.16571189535277459, 0.15909697743870369, -0.08346904917754457, 0.5651051967670667,
-0.7024187233493147, 0.344838990327555, -0.0776935571267725, 0.006792935570364409]
tng_500c_z2_high = [-0.17019693064734706, 0.32919712907385784, -0.797459259235313, 1.847971049832458,
-1.845147406155588, 0.8738754166189594, -0.19951038683707684, 0.017809286154819706]
tng_500c_z2_low = [-0.18187282908150065, 0.39278937870857894, -1.2731854370994213, 3.015438031420505,
-3.2939866962092457, 1.8183752589662618, -0.5026424221580095, 0.055303531944640695]
eagle_500c_z2_all = [-0.24758730611634688, 0.16283588222031892, -0.1229077295444435, 0.2835085501504204,
-0.1937039834624915, 0.012512622132271296, 0.019661554603200612, -0.0039047216008080326]
eagle_500c_z2_high = [-0.24212969478129173, 0.07932387632494971, 0.13874000511581325, -0.08144705375025643,
0.05130015342896295, -0.06812504779254173, 0.03157017161424009, -0.004447711052571268]
eagle_500c_z2_low = [-0.23463750835337274, 0.0030017634018922714, 0.667403930630909, -1.36135142369259,
1.4932614251375114, -0.8752254585134844, 0.248610835339645, -0.026768106706416838]
# -----------------------------------------------------------------------------------------------------------------
upper_limits = {'limit_illustris_200b_z0': illustris_200b_z0_lim, 'limit_illustris_fof_z0': illustris_fof_z0_lim,
'limit_illustris_vir_z0': illustris_vir_z0_lim, 'limit_illustris_200c_z0': illustris_200c_z0_lim,
'limit_illustris_500c_z0': illustris_500c_z0_lim,
'limit_illustris_200b_z1': illustris_200b_z1_lim, 'limit_illustris_fof_z1': illustris_fof_z1_lim,
'limit_illustris_vir_z1': illustris_vir_z1_lim, 'limit_illustris_200c_z1': illustris_200c_z1_lim,
'limit_illustris_500c_z1': illustris_500c_z1_lim,
'limit_illustris_200b_z2': illustris_200b_z2_lim, 'limit_illustris_fof_z2': illustris_fof_z2_lim,
'limit_illustris_vir_z2': illustris_vir_z2_lim, 'limit_illustris_200c_z2': illustris_200c_z2_lim,
'limit_illustris_500c_z2': illustris_500c_z2_lim,
'limit_tng_200b_z0': tng_200b_z0_lim, 'limit_tng_fof_z0': tng_fof_z0_lim, 'limit_tng_vir_z0': tng_vir_z0_lim,
'limit_tng_200c_z0': tng_200c_z0_lim, 'limit_tng_500c_z0': tng_500c_z0_lim,
'limit_tng_200b_z1': tng_200b_z1_lim, 'limit_tng_fof_z1': tng_fof_z1_lim, 'limit_tng_vir_z1': tng_vir_z1_lim,
'limit_tng_200c_z1': tng_200c_z1_lim, 'limit_tng_500c_z1': tng_500c_z1_lim,
'limit_tng_200b_z2': tng_200b_z2_lim, 'limit_tng_fof_z2': tng_fof_z2_lim, 'limit_tng_vir_z2': tng_vir_z2_lim,
'limit_tng_200c_z2': tng_200c_z2_lim, 'limit_tng_500c_z2': tng_500c_z2_lim,
'limit_eagle_200b_z0': eagle_200b_z0_lim, 'limit_eagle_fof_z0': eagle_fof_z0_lim, 'limit_eagle_vir_z0': eagle_vir_z0_lim,
'limit_eagle_200c_z0': eagle_200c_z0_lim, 'limit_eagle_500c_z0': eagle_500c_z0_lim,
'limit_eagle_200b_z1': eagle_200b_z1_lim, 'limit_eagle_fof_z1': eagle_fof_z1_lim, 'limit_eagle_vir_z1': eagle_vir_z1_lim,
'limit_eagle_200c_z1': eagle_200c_z1_lim, 'limit_eagle_500c_z1': eagle_500c_z1_lim,
'limit_eagle_200b_z2': eagle_200b_z2_lim, 'limit_eagle_fof_z2': eagle_fof_z2_lim, 'limit_eagle_vir_z2': eagle_vir_z2_lim,
'limit_eagle_200c_z2': eagle_200c_z2_lim, 'limit_eagle_500c_z2': eagle_500c_z2_lim}
fits = {'coefs_illustris_200b_z0_all': illustris_200b_z0_all, 'coefs_tng_200b_z0_all': tng_200b_z0_all, 'coefs_eagle_200b_z0_all': eagle_200b_z0_all,
'coefs_illustris_200b_z0_high': illustris_200b_z0_high, 'coefs_tng_200b_z0_high': tng_200b_z0_high, 'coefs_eagle_200b_z0_high': eagle_200b_z0_high,
'coefs_illustris_200b_z0_low': illustris_200b_z0_low, 'coefs_tng_200b_z0_low': tng_200b_z0_low, 'coefs_eagle_200b_z0_low': eagle_200b_z0_low,
'coefs_illustris_fof_z0_all': illustris_fof_z0_all, 'coefs_tng_fof_z0_all': tng_fof_z0_all, 'coefs_eagle_fof_z0_all': eagle_fof_z0_all,
'coefs_illustris_fof_z0_high': illustris_fof_z0_high, 'coefs_tng_fof_z0_high': tng_fof_z0_high, 'coefs_eagle_fof_z0_high': eagle_fof_z0_high,
'coefs_illustris_fof_z0_low': illustris_fof_z0_low, 'coefs_tng_fof_z0_low': tng_fof_z0_low, 'coefs_eagle_fof_z0_low': eagle_fof_z0_low,
'coefs_illustris_vir_z0_all': illustris_vir_z0_all, 'coefs_tng_vir_z0_all': tng_vir_z0_all, 'coefs_eagle_vir_z0_all': eagle_vir_z0_all,
'coefs_illustris_vir_z0_high': illustris_vir_z0_high, 'coefs_tng_vir_z0_high': tng_vir_z0_high, 'coefs_eagle_vir_z0_high': eagle_vir_z0_high,
'coefs_illustris_vir_z0_low': illustris_vir_z0_low, 'coefs_tng_vir_z0_low': tng_vir_z0_low, 'coefs_eagle_vir_z0_low': eagle_vir_z0_low,
'coefs_illustris_200c_z0_all': illustris_200c_z0_all, 'coefs_tng_200c_z0_all': tng_200c_z0_all, 'coefs_eagle_200c_z0_all': eagle_200c_z0_all,
'coefs_illustris_200c_z0_high': illustris_200c_z0_high, 'coefs_tng_200c_z0_high': tng_200c_z0_high, 'coefs_eagle_200c_z0_high': eagle_200c_z0_high,
'coefs_illustris_200c_z0_low': illustris_200c_z0_low, 'coefs_tng_200c_z0_low': tng_200c_z0_low, 'coefs_eagle_200c_z0_low': eagle_200c_z0_low,
'coefs_illustris_500c_z0_all': illustris_500c_z0_all, 'coefs_tng_500c_z0_all': tng_500c_z0_all, 'coefs_eagle_500c_z0_all': eagle_500c_z0_all,
'coefs_illustris_500c_z0_high': illustris_500c_z0_high, 'coefs_tng_500c_z0_high': tng_500c_z0_high, 'coefs_eagle_500c_z0_high': eagle_500c_z0_high,
'coefs_illustris_500c_z0_low': illustris_500c_z0_low, 'coefs_tng_500c_z0_low': tng_500c_z0_low, 'coefs_eagle_500c_z0_low': eagle_500c_z0_low,
'coefs_illustris_200b_z1_all': illustris_200b_z1_all, 'coefs_tng_200b_z1_all': tng_200b_z1_all, 'coefs_eagle_200b_z1_all': eagle_200b_z1_all,
'coefs_illustris_200b_z1_high': illustris_200b_z1_high, 'coefs_tng_200b_z1_high': tng_200b_z1_high, 'coefs_eagle_200b_z1_high': eagle_200b_z1_high,
'coefs_illustris_200b_z1_low': illustris_200b_z1_low, 'coefs_tng_200b_z1_low': tng_200b_z1_low, 'coefs_eagle_200b_z1_low': eagle_200b_z1_low,
'coefs_illustris_fof_z1_all': illustris_fof_z1_all, 'coefs_tng_fof_z1_all': tng_fof_z1_all, 'coefs_eagle_fof_z1_all': eagle_fof_z1_all,
'coefs_illustris_fof_z1_high': illustris_fof_z1_high, 'coefs_tng_fof_z1_high': tng_fof_z1_high, 'coefs_eagle_fof_z1_high': eagle_fof_z1_high,
'coefs_illustris_fof_z1_low': illustris_fof_z1_low, 'coefs_tng_fof_z1_low': tng_fof_z1_low, 'coefs_eagle_fof_z1_low': eagle_fof_z1_low,
'coefs_illustris_vir_z1_all': illustris_vir_z1_all, 'coefs_tng_vir_z1_all': tng_vir_z1_all, 'coefs_eagle_vir_z1_all': eagle_vir_z1_all,
'coefs_illustris_vir_z1_high': illustris_vir_z1_high, 'coefs_tng_vir_z1_high': tng_vir_z1_high, 'coefs_eagle_vir_z1_high': eagle_vir_z1_high,
'coefs_illustris_vir_z1_low': illustris_vir_z1_low, 'coefs_tng_vir_z1_low': tng_vir_z1_low, 'coefs_eagle_vir_z1_low': eagle_vir_z1_low,
'coefs_illustris_200c_z1_all': illustris_200c_z1_all, 'coefs_tng_200c_z1_all': tng_200c_z1_all, 'coefs_eagle_200c_z1_all': eagle_200c_z1_all,
'coefs_illustris_200c_z1_high': illustris_200c_z1_high, 'coefs_tng_200c_z1_high': tng_200c_z1_high, 'coefs_eagle_200c_z1_high': eagle_200c_z1_high,
'coefs_illustris_200c_z1_low': illustris_200c_z1_low, 'coefs_tng_200c_z1_low': tng_200c_z1_low, 'coefs_eagle_200c_z1_low': eagle_200c_z1_low,
'coefs_illustris_500c_z1_all': illustris_500c_z1_all, 'coefs_tng_500c_z1_all': tng_500c_z1_all, 'coefs_eagle_500c_z1_all': eagle_500c_z1_all,
'coefs_illustris_500c_z1_high': illustris_500c_z1_high, 'coefs_tng_500c_z1_high': tng_500c_z1_high, 'coefs_eagle_500c_z1_high': eagle_500c_z1_high,
'coefs_illustris_500c_z1_low': illustris_500c_z1_low, 'coefs_tng_500c_z1_low': tng_500c_z1_low, 'coefs_eagle_500c_z1_low': eagle_500c_z1_low,
'coefs_illustris_200b_z2_all': illustris_200b_z2_all, 'coefs_tng_200b_z2_all': tng_200b_z2_all, 'coefs_eagle_200b_z2_all': eagle_200b_z2_all,
'coefs_illustris_200b_z2_high': illustris_200b_z2_high, 'coefs_tng_200b_z2_high': tng_200b_z2_high, 'coefs_eagle_200b_z2_high': eagle_200b_z2_high,
'coefs_illustris_200b_z2_low': illustris_200b_z2_low, 'coefs_tng_200b_z2_low': tng_200b_z2_low, 'coefs_eagle_200b_z2_low': eagle_200b_z2_low,
'coefs_illustris_fof_z2_all': illustris_fof_z2_all, 'coefs_tng_fof_z2_all': tng_fof_z2_all, 'coefs_eagle_fof_z2_all': eagle_fof_z2_all,
'coefs_illustris_fof_z2_high': illustris_fof_z2_high, 'coefs_tng_fof_z2_high': tng_fof_z2_high, 'coefs_eagle_fof_z2_high': eagle_fof_z2_high,
'coefs_illustris_fof_z2_low': illustris_fof_z2_low, 'coefs_tng_fof_z2_low': tng_fof_z2_low, 'coefs_eagle_fof_z2_low': eagle_fof_z2_low,
'coefs_illustris_vir_z2_all': illustris_vir_z2_all, 'coefs_tng_vir_z2_all': tng_vir_z2_all, 'coefs_eagle_vir_z2_all': eagle_vir_z2_all,
'coefs_illustris_vir_z2_high': illustris_vir_z2_high, 'coefs_tng_vir_z2_high': tng_vir_z2_high, 'coefs_eagle_vir_z2_high': eagle_vir_z2_high,
'coefs_illustris_vir_z2_low': illustris_vir_z2_low, 'coefs_tng_vir_z2_low': tng_vir_z2_low, 'coefs_eagle_vir_z2_low': eagle_vir_z2_low,
'coefs_illustris_200c_z2_all': illustris_200c_z2_all, 'coefs_tng_200c_z2_all': tng_200c_z2_all, 'coefs_eagle_200c_z2_all': eagle_200c_z2_all,
'coefs_illustris_200c_z2_high': illustris_200c_z2_high, 'coefs_tng_200c_z2_high': tng_200c_z2_high, 'coefs_eagle_200c_z2_high': eagle_200c_z2_high,
'coefs_illustris_200c_z2_low': illustris_200c_z2_low, 'coefs_tng_200c_z2_low': tng_200c_z2_low, 'coefs_eagle_200c_z2_low': eagle_200c_z2_low,
'coefs_illustris_500c_z2_all': illustris_500c_z2_all, 'coefs_tng_500c_z2_all': tng_500c_z2_all, 'coefs_eagle_500c_z2_all': eagle_500c_z2_all,
'coefs_illustris_500c_z2_high': illustris_500c_z2_high, 'coefs_tng_500c_z2_high': tng_500c_z2_high, 'coefs_eagle_500c_z2_high': eagle_500c_z2_high,
'coefs_illustris_500c_z2_low': illustris_500c_z2_low, 'coefs_tng_500c_z2_low': tng_500c_z2_low, 'coefs_eagle_500c_z2_low': eagle_500c_z2_low}
halo_masses = halo_masses/1.e10 # 1e10 Msun/h
log_halo_masses = np.log10(halo_masses) # log 1e10 Msun/h
coefficients = fits['coefs_'+str(sim)+'_'+str(halo_def)+'_z'+str(redshift)+'_'+str(env)]
factor = np.zeros(len(log_halo_masses))
for i in range(len(coefficients)):
factor += coefficients[i]*log_halo_masses**i
if len(np.where(log_halo_masses < lower_lim)[0]) > 0:
warnings.warn('Halo mass too low. No correction given.')
factor[np.where(log_halo_masses < lower_lim)[0]] = 0.
if str(env) == 'all':
upper_lim = upper_limits['limit_'+str(sim)+'_'+str(halo_def)+'_z'+str(redshift)][0]
if str(env) == 'high':
upper_lim = upper_limits['limit_'+str(sim)+'_'+str(halo_def)+'_z'+str(redshift)][0]
if str(env) == 'low':
upper_lim = upper_limits['limit_'+str(sim)+'_'+str(halo_def)+'_z'+str(redshift)][1]
if len(np.where(log_halo_masses > upper_lim)[0]) > 0:
warnings.warn('Halo mass too high. No correction given.')
factor[np.where(log_halo_masses > upper_lim)[0]] = 0.
corrected_halo_masses = (factor+1.0)*halo_masses*1.e10
return corrected_halo_masses