-
Notifications
You must be signed in to change notification settings - Fork 0
/
parameters_ms_gadget.py
629 lines (562 loc) · 27.9 KB
/
parameters_ms_gadget.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
from __future__ import print_function, division
from collections import namedtuple, OrderedDict
import numpy as np
from parameters import SimOpts
from lsstools.cosmo_model import CosmoModel
from lsstools.gen_cosmo_fcns import calc_f_log_growth_rate, generate_calc_Da
class MSGadgetSimOpts(SimOpts):
def __init__(self, boxsize, sim_scale_factor, cosmo_params, **kwargs):
"""
Simulations options for ms_gadget sims.
"""
super(MSGadgetSimOpts, self).__init__(
boxsize,
sim_scale_factor,
cosmo_params,
**kwargs
)
@staticmethod
def load_default_opts(**kwargs):
"""See parent class.
"""
# L=500,1500 ms_gadget sims produced with MP-Gadget, 1536^3 particles,
# 64^3 test data.
default = {}
default['sim_name'] = 'ms_gadget'
default['boxsize'] = 500.0
default['sim_scale_factor'] = 0.6250
default['sim_irun'] = 4
default['sim_seed'] = 403
# seed used to draw subsample
#default['ssseed'] = 40000 + default['sim_seed']
default['ssseed'] = None
# Nbody, so used thousands of time steps
default['sim_Ntimesteps'] = None
default['sim_Nptcles'] = 1536
default['sim_wig_now_string'] = 'wig'
# halo mass
default['halo_mass_string'] = '13.8_15.1'
default['hod_model_name'] = 'Zheng07_HandSeljak17'
# cosmology
# omega_m = 0.307494
# omega_bh2 = 0.022300
# omega_ch2 = 0.118800
# h = math.sqrt((omega_bh2 + omega_ch2) / omega_m) = 0.6774
default['cosmo_params'] = dict(Om_m=0.307494,
Om_L=1.0 - 0.307494,
Om_K=0.0,
Om_r=0.0,
h0=0.6774)
# update with kwargs and return
default.update(kwargs)
# calculate D and f given cosmo and sim_scale_factor
# don't allow it to be given by kwargs
assert 'f_log_growth' not in kwargs.keys()
cosmo = CosmoModel(**default['cosmo_params'])
calc_Da = generate_calc_Da(cosmo=cosmo)
f_log_growth = calc_f_log_growth_rate(
a=default['sim_scale_factor'],
calc_Da=calc_Da,
cosmo=cosmo,
do_test=True
)
# save in opts so we can easily access it throughout code (although strictly
# speaking it is not a free option but derived from cosmo_params)
default['f_log_growth'] = f_log_growth
return MSGadgetSimOpts(**default)
def get_default_ext_grids_to_load(self,
Ngrid,
include_shifted_fields=True,
shifted_fields_RPsi=0.23,
shifted_fields_Np=1536,
shifted_fields_Nmesh=1536,
include_2LPT_shifted_fields=False,
include_3LPT_shifted_fields=False,
include_minus_3LPT_shifted_fields=False,
include_div_shifted_PsiDot1=False,
include_div_shifted_PsiDot2=False,
include_shifted_PsiDot1=False,
RSDstrings=None):
"""See parent class.
"""
ext_grids = OrderedDict()
if RSDstrings is None:
RSDstrings = [('','')]
if False:
# Linear density (ICs of the sims).
# This is deltalin from mesh (created on mesh, without particles).
# This has no RSD.
ext_grids['deltalin'] = {
'dir': 'IC_LinearMesh_z0_Ng%d' % Ngrid,
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': 1.0,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
if False:
# deltalin from ptcles (created from particle snapshot so
# includes CIC artifacts)
# on 64^3, noise curves looked the same as with linearMesh
ext_grids['deltalin_PtcleDens'] = {
'dir': 'IC_PtcleDensity_Ng%d' % Ngrid,
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': 1.0 / (1.0 + 99.0), # ICs are at z=99
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
if False:
# delta_ZA, created by moving 1536^3 ptcles with NGenic
# (includes CIC artifacts, small shot noise)
ext_grids['deltaZA_NORSD'] = {
'dir':
'ZA_%.4f_PtcleDensity_Ng%d' %
(self.sim_scale_factor, Ngrid),
'file_format':
'nbkit_BigFileGrid',
'dataset_name':
'Field',
'scale_factor':
self.sim_scale_factor,
'nbkit_normalize':
True,
'nbkit_setMean':
0.0
}
if False:
# deltanonl painted from all 1536^3 DM particles (includes CIC
# artifacts, small shot noise).
# This has no RSD.
ext_grids['delta_m'] = {
'dir':
'snap_%.4f_PtcleDensity_Ng%d' %
(self.sim_scale_factor, Ngrid),
'file_format':
'nbkit_BigFileGrid',
'dataset_name':
'Field',
'scale_factor':
self.sim_scale_factor,
'nbkit_normalize':
True,
'nbkit_setMean':
0.0
}
if (include_shifted_fields
or include_2LPT_shifted_fields
or include_3LPT_shifted_fields):
## Shifted fields
psi_type_strings = ['']
if include_2LPT_shifted_fields:
psi_type_strings.append('Psi2LPT_')
if include_3LPT_shifted_fields:
psi_type_strings.append('Psi3LPT_')
for psi_type_str in psi_type_strings:
for target_RSDstring, model_RSDstring in RSDstrings:
# 1 shifted by deltalin_Zeldovich displacement (using nbkit0.3;
# same as delta_ZA)
ext_grids['1_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring
)] = {
'dir':
'1_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# deltalin shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids['deltalin_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring
)] = {
'dir':
'IC_LinearMesh_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# deltalin^2 shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids[
'deltalin_growth-mean_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring
)] = {
'dir':
'IC_LinearMesh_growth-mean_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# G2[deltalin] shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids['deltalin_G2_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring)] = {
'dir':
'IC_LinearMesh_tidal_G2_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# G2_parallel[deltalin] shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
for los_string in ['001']:
ext_grids['deltalin_G2_par_LOS%s_SHIFTEDBY_%sdeltalin%s' % (
los_string, psi_type_str, model_RSDstring)] = {
'dir':
'IC_LinearMesh_tidal_G2_par_LOS%s_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (los_string, psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# deltalin^3 shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids['deltalin_cube-mean_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring)] = {
'dir':
'IC_LinearMesh_cube-mean_intR0.00_0.50_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
if False:
# additional cubic fields
# G2*deltalin shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids['deltalin_G2_delta_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring)] = {
'dir':
'IC_LinearMesh_G2_delta_intR0.00_0.50_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# G3 shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids['deltalin_G3_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring)] = {
'dir':
'IC_LinearMesh_tidal_G3_intR0.00_0.50_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
# Gamma3 shifted by deltalin_Zeldovich displacement (using
# nbkit0.3)
ext_grids['deltalin_Gamma3_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring)] = {
'dir':
'IC_LinearMesh_Gamma3_intR0.00_0.50_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': True,
'nbkit_setMean': 0.0
}
if include_div_shifted_PsiDot1:
psi_type_str = ''
for target_RSDstring, model_RSDstring in RSDstrings:
# div of PsiDot1 shifted by deltalin_Zeldovich displacement
ext_grids['div_PsiDot1_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring
)] = {
'dir':
'div_IC_LinearMesh_PsiDot1_0_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': False, # not sure
'nbkit_setMean': 0.0
}
if include_div_shifted_PsiDot2:
psi_type_str = ''
for target_RSDstring, model_RSDstring in RSDstrings:
# div of PsiDot2 shifted by deltalin_Zeldovich displacement
ext_grids['div_PsiDot2_SHIFTEDBY_%sdeltalin%s' % (
psi_type_str, model_RSDstring
)] = {
'dir':
'div_IC_LinearMesh_PsiDot2_0_intR0.00_extR0.00_SHIFTEDBY_%sIC_LinearMeshR%.2f_a%.4f_Np%d_Nm%d_Ng%d_CICsum%s'
% (psi_type_str, shifted_fields_RPsi, self.sim_scale_factor,
shifted_fields_Np, shifted_fields_Nmesh, Ngrid,
model_RSDstring),
'file_format': 'nbkit_BigFileGrid',
'dataset_name': 'Field',
'scale_factor': self.sim_scale_factor,
'nbkit_normalize': False, # not sure
'nbkit_setMean': 0.0
}
return ext_grids
def get_default_catalogs(self, RSDstrings=None):
"""Default catalogs to load for ms_gadget sims.
"""
cats = OrderedDict()
if RSDstrings is None:
RSDstrings = [('', '')]
target_RSDstrings = [ tup[0] for tup in RSDstrings ]
# FOF halos, mass given by number of particles in halo
halo_dir = 'nbkit_fof_%.4f/ll_0.200_nmin25' % (
self.sim_scale_factor)
for RSDstring in target_RSDstrings:
if RSDstring == '':
RSDfilestr = ''
else:
RSDfilestr = '%s.hdf5' % RSDstring
## nonuniform catalogs without ptcle masses
if True:
# halos without mass weight, narrow mass cuts: 10.8..11.8..12.8
# ..13.8..15.1
cats['delta_h%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_BOUNDS_log10M_%s.hdf5%s" %
(halo_dir, self.halo_mass_string, RSDfilestr),
'weight_ptcles_by':
None
}
if False:
# Halo momentum divergence theta_pi = div[(1+delta)v]/(faH).
# narrow mass cuts: 10.8..11.8..12.8..13.8..15.1
# Halo catalog has v/(aH), which is velocity in Mpc/h. We divide by f.
# Expect \theta_\pi = div pi/(faH) ~ div v/(faH) = -\delta on large scales (in absence of velocity bias).
# Then, \theta_pi = div center_velocity/f = -\delta.
# So expect P_{theta_\pi}/Plin = 1. Looks ok in ms_gadget.
cats['thetapi_h%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_BOUNDS_log10M_%s.hdf5%s" %
(halo_dir, self.halo_mass_string, RSDfilestr),
'weight_ptcles_by':
None,
'paint_mode':
'momentum_divergence',
'velocity_column':
'Velocity'
}
if True:
# Halo velocity divergence theta_v = div v/(faH).
# narrow mass cuts: 10.8..11.8..12.8..13.8..15.1
# Halo catalog has v/(aH), which is velocity in Mpc/h. We divide by f in paint_utils.py.
# Expect \theta_v = div v/(faH) = -\delta on large scales (in absence of velocity bias).
# Then, \theta_v = div center_velocity/f = -\delta.
# So expect P_theta/Plin = 1. Looks ok in ms_gadget sims.
# TODO: should just specify Painter dict here and don't copy in combine_fields...
cats['thetav_h%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_BOUNDS_log10M_%s.hdf5%s" %
(halo_dir, self.halo_mass_string, RSDfilestr),
'weight_ptcles_by':
None,
'paint_mode':
'velocity_divergence',
'velocity_column':
'Velocity',
'fill_empty_cells':
'RandNeighbReadout', # RandNeighb or RandNeighbReadout
'randseed_for_fill_empty_cells':
1000 + self.sim_seed,
'raise_exception_if_too_many_empty_cells':
False,
'save_to_disk': True,
'out_fname':
"%s/fof_nbkfmt.hdf5_BOUNDS_log10M_%s.hdf5%s_thetav%s" %
(halo_dir, self.halo_mass_string, RSDfilestr, RSDstring),
}
if False:
# halos not weighted by mass but including mass info in file,
# broad mass cut
# TODO: looks like nbodykit 0.3 does not read this properly b/c
# of hdf5. Should switch all files to bigfile at some point.
cats['delta_h%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_WithMassCols.hdf5_BOUNDS_log10M_%s.hdf5%s" %
(halo_dir, self.halo_mass_string, RSDfilestr),
'weight_ptcles_by':
None
}
if False:
# halos in narrow mass bins, no mass weights
cats['delta_h_M10.8-11.8%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_WithMassCols_BOUNDS_log10M_10.8_11.8.hdf5%s" %
(halo_dir, RSDfilestr),
'weight_ptcles_by':
None
}
cats['delta_h_M11.8-12.8%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_WithMassCols_BOUNDS_log10M_11.8_12.8.hdf5%s" %
(halo_dir, RSDfilestr),
'weight_ptcles_by':
None
}
cats['delta_h_M12.8-13.8%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_WithMassCols_BOUNDS_log10M_12.8_13.8.hdf5%s" %
(halo_dir, RSDfilestr),
'weight_ptcles_by':
None
}
cats['delta_h_M13.8-15.1%s' % RSDstring] = {
'in_fname':
"%s/fof_nbkfmt.hdf5_WithMassCols_BOUNDS_log10M_13.8_15.1.hdf5%s" %
(halo_dir, RSDfilestr),
'weight_ptcles_by':
None
}
# FOF halos, virial mass (used for HOD)
hod_dir = 'nbkit_fof_%.4f/ll_0.200_nmin25_mvir' % (
self.sim_scale_factor)
for RSDstring in target_RSDstrings:
## nonuniform catalogs without ptcle masses
if True:
# HOD galaxies
hod_model_name = self.hod_model_name
cats['delta_g%s' % RSDstring] = {
'in_fname':
"%s/HOD_%s%s.hdf5" %
(hod_dir, hod_model_name, RSDstring),
'weight_ptcles_by':
None
}
# HOD central galaxies
hod_model_name = self.hod_model_name + '_centrals'
cats['delta_gc%s' % RSDstring] = {
'in_fname':
"%s/HOD_%s%s.hdf5" %
(hod_dir, hod_model_name, RSDstring),
'weight_ptcles_by':
None
}
# HOD satellite galaxies
hod_model_name = self.hod_model_name + '_sats'
cats['delta_gs%s' % RSDstring] = {
'in_fname':
"%s/HOD_%s%s.hdf5" %
(hod_dir, hod_model_name, RSDstring),
'weight_ptcles_by':
None
}
# HOD parent halos of centrals
hod_model_name = self.hod_model_name + '_parent_halos'
cats['delta_gp%s' % RSDstring] = {
'in_fname':
"%s/HOD_%s%s.hdf5" %
(hod_dir, hod_model_name, RSDstring),
'weight_ptcles_by':
None
}
for RSDstring in target_RSDstrings:
if True:
# PT Challenge galaxies from rockstar halos.
# Rockstar gives core positions and velocities.
# Units: 1/(aH) = 1./(a * H0*np.sqrt(Om_m/a**3+Om_L)) * (H0/100.) in Mpc/h / (km/s)
# = 1/(100*a*sqrt(Om_m/a**3+Om_L)).
# For ms_gadget, get 1/(aH) = 0.01145196 Mpc/h/(km/s) = 0.0183231*0.6250 Mpc/h/(km/s).
# Note that our MP-Gadget files have RSDFactor=1/(a^2H)=0.0183231 for a=0.6250 b/c they use a^2\dot x for Velocity.
# Rockstar 'Velocity' column is v=a\dot x in km/s ("Velocities in
# km / s (physical, peculiar)")
#
# Minimum mass in L=1500, Np=1536 sims is Mmin_1500 = 15.9e10 = 10**11.2
from perr.model_target_pair import Target
from sim_galaxy_catalog_creator import PTChallengeGalaxiesFromRockstarHalos
a = self.sim_scale_factor
RSDFactor_rockstar = 1./(100.*a * np.sqrt(
self.cosmo_params['Om_m']/a**3
+ self.cosmo_params['Om_K']/a**2
+ self.cosmo_params['Om_L']))
# for a=0.625 get RSDFactor_rockstar=0.01145196
assert np.isclose(RSDFactor_rockstar, 0.01145196)
if RSDstring == '':
apply_RSD_to_position = False
RSD_los = None
elif RSDstring == '_RSD001':
apply_RSD_to_position = True
RSD_los = [0,0,1]
cats['delta_gPTC%s' % RSDstring] = Target(
name='delta_gPTC%s' % RSDstring,
in_fname='snap_%.4f.gadget3/rockstar_out_0.list.bigfile' % (
self.sim_scale_factor),
position_column='Position',
velocity_column='Velocity',
apply_RSD_to_position=apply_RSD_to_position,
RSD_los=RSD_los,
RSDFactor=RSDFactor_rockstar, # to convert velocity to RSD displacement in Mpc/h
cuts=[PTChallengeGalaxiesFromRockstarHalos(
log10M_column='log10Mvir', log10Mmin=12.97, sigma_log10M=0.35, RSD=False)
]
)
cats['delta_gPTC_11.5%s' % RSDstring] = Target(
name='delta_gPTC%s' % RSDstring,
in_fname='snap_%.4f.gadget3/rockstar_out_0.list.bigfile' % (
self.sim_scale_factor),
position_column='Position',
velocity_column='Velocity',
apply_RSD_to_position=apply_RSD_to_position,
RSD_los=RSD_los,
RSDFactor=RSDFactor_rockstar, # to convert velocity to RSD displacement in Mpc/h
cuts=[PTChallengeGalaxiesFromRockstarHalos(
log10M_column='log10Mvir', log10Mmin=11.5, sigma_log10M=0.35, RSD=False)
]
)
if False:
# god sample
assert RSD_los in [None, [0,0,1]]
cats['delta_gPTC_GodPsiDot1%s' % RSDstring] = Target(
name='delta_gPTC_GodPsiDot1%s' % RSDstring,
in_fname='snap_%.4f.gadget3/rockstar_out_0.list.bigfile_RESID_PsiDot1_D2.bf' % (
self.sim_scale_factor),
position_column='Position',
velocity_column='Velocity',
apply_RSD_to_position=apply_RSD_to_position,
RSD_los=RSD_los,
RSDFactor=RSDFactor_rockstar, # to convert velocity to RSD displacement in Mpc/h
cuts=[('residual_D2', 'min', -2.0), # script already applied galaxy selection, only need to cut on residual
('residual_D2', 'max', 2.0)
]
)
return cats