-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_paper_results.py
executable file
·1643 lines (1463 loc) · 75 KB
/
generate_paper_results.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
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# Place import files below
import copy
import h5py
import numpy as np
from scipy.optimize import curve_fit
from scipy.special import erfc
from common_functions import make_cumulative_function, survey_cone, v_sphere
from process_data import FattahiData, UDGData
from universal_settings import (
MV_bins, d_lg, des_mu_lim, fattahi_data_file, generated_data_file_template,
h, k08_mu_vs_d_file, k08_mv_vs_d_file, lsst_mu_lim, mass_in_lg_file, mu_e,
mu_e2, n_sightings, reff, reff2, sdss_mu_lim, sim_n_part, survey_data_file,
target_lg_masses, zoa_extent_list)
def main():
np.random.seed(50)
sim_ids = ['09_18', '17_11', '37_11']
# Load relevant simulation data
udg_data = UDGData()
data_list = [
'simulation_id', 'halo_ids', 'select_udgs_reff1_mu1',
'select_udgs_reff1_mu2', 'select_udgs_reff2_mu1',
'select_udgs_reff2_mu2', 'dist_from_mw', 'dist_from_m31',
'dist_from_midpoint', 'abs_mag_Vband', 'app_mag_Vband_rel_mw',
'app_mag_Vband_rel_m31', 'rband_mu_mag_arsec', 'position_rel_mw',
'position_rel_m31', 'n_los', 'los_simulation_id', 'los_halo_ids',
'los_re_rband', 'los_mue_rband', 'los_mue_Vband',
'select_gal_mstar_nstar'
]
(simulation_id, halo_ids, select_udgs_reff1_mu1, select_udgs_reff1_mu2,
select_udgs_reff2_mu1, select_udgs_reff2_mu2, dist_from_mw, dist_from_m31,
dist_from_midpoint, abs_mag_Vband, app_mag_Vband_rel_mw,
app_mag_Vband_rel_m31, rband_mu_mag_arsec, position_rel_mw,
position_rel_m31, n_los, los_simulation_id, los_halo_ids, los_re_rband,
los_mueff_rband, los_mueff_Vband,
select_gal_mstar_nstar) = udg_data.retrieve_data(data_list)
copy_mue_rband = copy.deepcopy(rband_mu_mag_arsec)
# Analysis settings
max_app_mv = 22
abs_lf_survey_names = ['SDSS', 'DES', 'LSST']
abs_lf_survey_mu_lims = [sdss_mu_lim, des_mu_lim, lsst_mu_lim]
reff_list = [reff, reff, reff2, reff2]
mu_list = [mu_e, mu_e2, mu_e, mu_e2]
selection_list = [
select_udgs_reff1_mu1, select_udgs_reff1_mu2, select_udgs_reff2_mu1,
select_udgs_reff2_mu2
]
# Universal output settings
mock_obs_attr_dict = {
'Meta':
np.string_('Each row provides N_UDG,SDSS for a given mock SDSS ' +
'observation'),
'Number of pointings':
n_sightings
}
lf_attr_dict = {
'Meta':
np.string_('Each row provides N_UDG(< M_V) for a given mock SDSS ' +
'observation'),
'Number of pointings':
n_sightings
}
zoa_attr_dict = {
'Meta':
np.string_(
'Each row provides N_UDG,ZoA / N_UDG,tot for a given disc ' +
'orientation'),
'Number of pointings':
n_sightings
}
zoa_attr_dict.update(
dict([('Column {:02d}'.format(c_i),
'ZoA extent: {:>4.1f} [deg]'.format(deg))
for c_i, deg in enumerate(zoa_extent_list)]))
####################################################################
# Load relevant data
####################################################################
# Koposov+(2008) detection efficiency
mag_v_d = np.genfromtxt(k08_mv_vs_d_file, delimiter=',')
mu_v_d = np.genfromtxt(k08_mu_vs_d_file, delimiter=',')
sdss_mag_popt, _ = curve_fit(straight_line, np.log10(mag_v_d[:, 0]),
mag_v_d[:, 1], [-4.769, 6.])
des_mag_popt, _ = curve_fit(straight_line, np.log10(mag_v_d[:, 0]),
mag_v_d[:, 1] + 1., [-4.769, 6.])
lsst_mag_popt, _ = curve_fit(straight_line, np.log10(mag_v_d[:, 0]),
mag_v_d[:, 1] + 2., [-4.769, 6.])
sdss_mu_popt, _ = curve_fit(straight_line, np.log10(mu_v_d[:, 0]),
mu_v_d[:, 1], [-0.6, 31.3])
des_mu_popt, _ = curve_fit(straight_line, np.log10(mu_v_d[:, 0]),
mu_v_d[:, 1] + 1., [-0.6, 31.3])
lsst_mu_popt, _ = curve_fit(straight_line, np.log10(mu_v_d[:, 0]),
mu_v_d[:, 1] + 2., [-0.6, 31.3])
####################################################################
# Extend K08 parameter fits to new space
####################################################################
# MW
sdss_M_Vlim_mw = straight_line(np.log10(dist_from_mw),
*sdss_mag_popt) # d in kpc
des_M_Vlim_mw = straight_line(np.log10(dist_from_mw),
*des_mag_popt) # d in kpc
lsst_M_Vlim_mw = straight_line(np.log10(dist_from_mw),
*lsst_mag_popt) # d in kpc
sdss_mu_lim_mw = straight_line(np.log10(dist_from_mw),
*sdss_mu_popt) # d in kpc
des_mu_lim_mw = straight_line(np.log10(dist_from_mw),
*des_mu_popt) # d in kpc
lsst_mu_lim_mw = straight_line(np.log10(dist_from_mw),
*lsst_mu_popt) # d in kpc
# M31
sdss_M_Vlim_m31 = straight_line(np.log10(dist_from_m31),
*sdss_mag_popt) # d in kpc
des_M_Vlim_m31 = straight_line(np.log10(dist_from_m31),
*des_mag_popt) # d in kpc
lsst_M_Vlim_m31 = straight_line(np.log10(dist_from_m31),
*lsst_mag_popt) # d in kpc
sdss_mu_lim_m31 = straight_line(np.log10(dist_from_m31),
*sdss_mu_popt) # d in kpc
des_mu_lim_m31 = straight_line(np.log10(dist_from_m31),
*des_mu_popt) # d in kpc
lsst_mu_lim_m31 = straight_line(np.log10(dist_from_m31),
*lsst_mu_popt) # d in kpc
####################################################################
# Read LG masses of HESTIA simulations
lg_mass_in_dlg = np.genfromtxt(mass_in_lg_file)
# Load LG mass-galaxy number density relation from Fattahi+(2020)
fattahi_data = FattahiData(fattahi_data_file)
# Load SDSS survey data
survey_data = np.genfromtxt(survey_data_file)
sdss_surveyArea, sdss_cos_surveyAngle = survey_cone(survey_data[:, 0][0])
des_surveyArea, des_cos_surveyAngle = survey_cone(survey_data[:, 2][0])
lsst_surveyArea, lsst_cos_surveyAngle = survey_cone(survey_data[:, 3][0])
# Generate uniformly-distributed mock survey pointing directions
surface_points = uniform_points_on_sphere_surface(n_sightings)
####################################################################
# Generate data
####################################################################
# Generate set of scale factors to rescale the simulations to
# various target masses
mass_idx = np.floor(np.log10(target_lg_masses))
mass_pf = target_lg_masses / 10**mass_idx
# M_LG in string format
mass_str = '{:0.1f}x10^{:d} Msun'
t_mass_strings = [
mass_str.format(pf, idx)
for pf, idx in zip(mass_pf, np.int64(mass_idx))
]
# Append t_mass_strings to mock_obs_attr_dict
for i, tm_str in enumerate(t_mass_strings):
mock_obs_attr_dict.update({'Column {:02d}'.format(i): tm_str})
m_density = lg_mass_in_dlg * h / v_sphere(d_lg * h)
n_gal_scale_factors = []
for target_mass in target_lg_masses:
target_mass_density = target_mass * h / v_sphere(d_lg * h)
n_gal_scale_factor = 10.**(
fattahi_data.interp_func(np.log10(target_mass_density)) -
fattahi_data.interp_func(np.log10(m_density)))
n_gal_scale_factors.append(n_gal_scale_factor)
n_gal_scale_factors = np.row_stack(n_gal_scale_factors)
scale_factor_data_to_write = np.column_stack(
(target_lg_masses, n_gal_scale_factors))
# Iterate over simulations
for s_i, (sim_id, sim_rescale_factor) in enumerate(
zip(sim_ids, n_gal_scale_factors.T)):
print("Processing: {}".format(sim_id))
galaxies_in_sim = simulation_id == sim_id
field_in_sim = (galaxies_in_sim * select_gal_mstar_nstar).sum()
select_sim_distance = dist_from_midpoint <= (d_lg * 1.e3) # kpc
# Select galaxies from the lines of sight data set
los_galaxies_in_sim = los_simulation_id == sim_id
unique_los_halo_ids = np.unique(los_halo_ids[los_galaxies_in_sim])
rescaled_n_field_out_data = np.around(field_in_sim *
sim_rescale_factor)
# Initialize variables to hold output data
tot_udg_abs_lf_lg_out_data = []
tot_udg_lf_mw_out_data = []
tot_udg_lf_m31_out_data = []
sdss_mw_out_data = []
sdss_m31_out_data = []
sdss_faceon_mw_out_data = []
sdss_faceon_m31_out_data = []
sdss_misclass_mw_out_data = []
sdss_misclass_m31_out_data = []
des_mw_out_data = []
des_m31_out_data = []
des_faceon_mw_out_data = []
des_faceon_m31_out_data = []
des_misclass_mw_out_data = []
des_misclass_m31_out_data = []
lsst_mw_out_data = []
lsst_m31_out_data = []
lsst_faceon_mw_out_data = []
lsst_faceon_m31_out_data = []
lsst_misclass_mw_out_data = []
lsst_misclass_m31_out_data = []
mw_udg_frac_zoa_out_data = []
m31_udg_frac_zoa_out_data = []
sdss_rescaled_mock_obs_mw_out_data = []
sdss_rescaled_mock_obs_m31_out_data = []
des_rescaled_mock_obs_mw_out_data = []
des_rescaled_mock_obs_m31_out_data = []
lsst_rescaled_mock_obs_mw_out_data = []
lsst_rescaled_mock_obs_m31_out_data = []
abs_lf_bins = np.sort(abs_mag_Vband[galaxies_in_sim *
(~np.isinf(abs_mag_Vband))])[::-1]
rescaled_n_udg_out_data = np.empty(
(len(target_lg_masses), len(selection_list)), dtype=np.uint32)
for sel_i, (r_eff, mu_eff, selection) in enumerate(
zip(reff_list, mu_list, selection_list)):
udgs_in_sim = selection * galaxies_in_sim * select_sim_distance
n_udgs_in_sim = udgs_in_sim.sum()
rescaled_n_udgs = np.around((n_udgs_in_sim * sim_rescale_factor))
# Prepare rescaled N_UDG(< d_lg Mpc) data to be written
rescaled_n_udg_out_data[:, sel_i] = rescaled_n_udgs
# LG UDG luminosity functions
abs_mv_udg_tot, n_abs_mv_udg_tot = make_cumulative_function(
abs_mag_Vband[udgs_in_sim], bins=abs_lf_bins)
udg_abs_lfs_lg = [abs_mv_udg_tot, n_abs_mv_udg_tot]
# for m_i, mu_lim in enumerate(abs_lf_survey_mu_lims):
for mu_lim in abs_lf_survey_mu_lims:
udgs_in_survey = udgs_in_sim * (rband_mu_mag_arsec <= mu_lim)
_, n_abs_mv_udg_survey = make_cumulative_function(
abs_mag_Vband[udgs_in_survey], bins=abs_lf_bins)
udg_abs_lfs_lg.append(n_abs_mv_udg_survey)
pass
udg_abs_lfs_lg = np.column_stack(udg_abs_lfs_lg)
app_mv_udg_tot_mw, n_udg_app_mv_mw = make_cumulative_function(
app_mag_Vband_rel_mw[udgs_in_sim],
min_val=6,
max_val=max_app_mv)
app_mv_udg_tot_m31, n_udg_app_mv_m31 = make_cumulative_function(
app_mag_Vband_rel_m31[udgs_in_sim],
min_val=6,
max_val=max_app_mv)
mw_udg_app_lfs_lg = np.column_stack(
(app_mv_udg_tot_mw, n_udg_app_mv_mw))
m31_udg_app_lfs_lg = np.column_stack(
(app_mv_udg_tot_m31, n_udg_app_mv_m31))
# Generate mock SDSS UDG luminosity functions
sdss_mw_lfs = np.empty(n_sightings).tolist()
sdss_m31_lfs = np.empty(n_sightings).tolist()
sdss_mw_misclass_lfs = np.empty(n_sightings).tolist()
sdss_m31_misclass_lfs = np.empty(n_sightings).tolist()
sdss_all_udg_mw_lfs = np.empty(n_sightings).tolist()
sdss_all_udg_m31_lfs = np.empty(n_sightings).tolist()
des_mw_lfs = np.empty(n_sightings).tolist()
des_m31_lfs = np.empty(n_sightings).tolist()
des_mw_misclass_lfs = np.empty(n_sightings).tolist()
des_m31_misclass_lfs = np.empty(n_sightings).tolist()
des_all_udg_mw_lfs = np.empty(n_sightings).tolist()
des_all_udg_m31_lfs = np.empty(n_sightings).tolist()
lsst_mw_lfs = np.empty(n_sightings).tolist()
lsst_m31_lfs = np.empty(n_sightings).tolist()
lsst_mw_misclass_lfs = np.empty(n_sightings).tolist()
lsst_m31_misclass_lfs = np.empty(n_sightings).tolist()
lsst_all_udg_mw_lfs = np.empty(n_sightings).tolist()
lsst_all_udg_m31_lfs = np.empty(n_sightings).tolist()
frac_udgs_in_mw_zoa = [
np.zeros(n_sightings) for _ in zoa_extent_list
]
frac_udgs_in_m31_zoa = [
np.empty(n_sightings) for _ in zoa_extent_list
]
halo_ids_to_match = halo_ids[udgs_in_sim]
udgs_in_sim_idx = np.where(udgs_in_sim)[0]
selected_los_mue_Vband = np.zeros(len(halo_ids))
selected_los_re_rband = np.zeros(len(halo_ids))
# Iterate over n_sightings
for i in np.arange(n_sightings):
# Select random orientation of each UDG from
# pre-computed data
los_selection = (
np.random.randint(n_los, size=len(unique_los_halo_ids)) +
(np.arange(len(unique_los_halo_ids)) * n_los))
# Cross-match random orientation data with face-on
# catalogue
if i == 0:
x_bool_match, y_idx_match = cross_match(
halo_ids_to_match,
los_halo_ids[los_galaxies_in_sim][los_selection])
# Cross-match relevant properties
# selected_los_mue_rband[
copy_mue_rband[
udgs_in_sim_idx[x_bool_match]] = los_mueff_rband[
los_galaxies_in_sim][los_selection][y_idx_match]
selected_los_mue_Vband[
udgs_in_sim_idx[x_bool_match]] = los_mueff_Vband[
los_galaxies_in_sim][los_selection][y_idx_match]
selected_los_re_rband[
udgs_in_sim_idx[x_bool_match]] = los_re_rband[
los_galaxies_in_sim][los_selection][y_idx_match]
########################################################
# Does the galaxy with random orientation appear as a
# UDG?
########################################################
# Yes
select_los_udg = ((selected_los_re_rband >= r_eff) *
(copy_mue_rband >= mu_eff))
# No
select_los_non_udgs = (~select_los_udg) * udgs_in_sim
########################################################
# Does galaxy pass SDSS surface brightness criterion?
all_udgs_in_mw = udgs_in_sim
all_udgs_in_m31 = udgs_in_sim
los_udgs_in_sdss_mw = (select_los_udg *
(copy_mue_rband <= sdss_mu_lim_mw) *
(abs_mag_Vband <= sdss_M_Vlim_mw))
los_udgs_in_sdss_m31 = (select_los_udg *
(copy_mue_rband <= sdss_mu_lim_m31) *
(abs_mag_Vband <= sdss_M_Vlim_m31))
los_udgs_in_des_mw = (select_los_udg *
(copy_mue_rband <= des_mu_lim_mw) *
(abs_mag_Vband <= des_M_Vlim_mw))
los_udgs_in_des_m31 = (select_los_udg *
(copy_mue_rband <= des_mu_lim_m31) *
(abs_mag_Vband <= des_M_Vlim_m31))
los_udgs_in_lsst_mw = (select_los_udg *
(copy_mue_rband <= lsst_mu_lim_mw) *
(abs_mag_Vband <= lsst_M_Vlim_mw))
los_udgs_in_lsst_m31 = (select_los_udg *
(copy_mue_rband <= lsst_mu_lim_m31) *
(abs_mag_Vband <= lsst_M_Vlim_m31))
# (Face-on) UDGs that pass SDSS criteria that are
# misclassified as non-UDGs
los_misclass_udgs_in_sdss_mw = (
select_los_non_udgs * (copy_mue_rband <= sdss_mu_lim_mw) *
(abs_mag_Vband <= sdss_M_Vlim_mw))
los_misclass_udgs_in_sdss_m31 = (
select_los_non_udgs * (copy_mue_rband <= sdss_mu_lim_m31) *
(abs_mag_Vband <= sdss_M_Vlim_m31))
los_misclass_udgs_in_des_mw = (
select_los_non_udgs * (copy_mue_rband <= des_mu_lim_mw) *
(abs_mag_Vband <= des_M_Vlim_mw))
los_misclass_udgs_in_des_m31 = (
select_los_non_udgs * (copy_mue_rband <= des_mu_lim_m31) *
(abs_mag_Vband <= des_M_Vlim_m31))
los_misclass_udgs_in_lsst_mw = (
select_los_non_udgs * (copy_mue_rband <= lsst_mu_lim_mw) *
(abs_mag_Vband <= lsst_M_Vlim_mw))
los_misclass_udgs_in_lsst_m31 = (
select_los_non_udgs * (copy_mue_rband <= lsst_mu_lim_m31) *
(abs_mag_Vband <= lsst_M_Vlim_m31))
# Calculate detection efficiencies of each UDG wrt the
# MW and M31, respectively
sdss_det_eff_mw = det_eff(abs_mag_Vband,
selected_los_mue_Vband,
sdss_M_Vlim_mw, sdss_mu_lim_mw, 1.,
1.)
sdss_det_eff_m31 = det_eff(abs_mag_Vband,
selected_los_mue_Vband,
sdss_M_Vlim_m31, sdss_mu_lim_m31,
1., 1.)
des_det_eff_mw = det_eff(abs_mag_Vband, selected_los_mue_Vband,
des_M_Vlim_mw, des_mu_lim_mw, 1., 1.)
des_det_eff_m31 = det_eff(abs_mag_Vband,
selected_los_mue_Vband,
des_M_Vlim_m31, des_mu_lim_m31, 1.,
1.)
lsst_det_eff_mw = det_eff(abs_mag_Vband,
selected_los_mue_Vband,
lsst_M_Vlim_mw, lsst_mu_lim_mw, 1.,
1.)
lsst_det_eff_m31 = det_eff(abs_mag_Vband,
selected_los_mue_Vband,
lsst_M_Vlim_m31, lsst_mu_lim_m31,
1., 1.)
# Select UDGs that pass the detection efficiency
# criterion
mw_rand_number = np.random.rand(len(selected_los_mue_Vband))
m31_rand_number = np.random.rand(len(selected_los_mue_Vband))
sdss_sub_select_mw_udgs = los_udgs_in_sdss_mw * (
sdss_det_eff_mw >= mw_rand_number)
sdss_sub_select_m31_udgs = los_udgs_in_sdss_m31 * (
sdss_det_eff_m31 >= m31_rand_number)
sdss_sub_select_mw_misclass_udgs = (
los_misclass_udgs_in_sdss_mw *
(sdss_det_eff_mw >= mw_rand_number))
sdss_sub_select_m31_misclass_udgs = (
los_misclass_udgs_in_sdss_m31 *
(sdss_det_eff_m31 >= m31_rand_number))
sdss_sub_select_mw_all_udgs = all_udgs_in_mw
sdss_sub_select_m31_all_udgs = all_udgs_in_m31
des_sub_select_mw_udgs = los_udgs_in_des_mw * (
des_det_eff_mw >= mw_rand_number)
des_sub_select_m31_udgs = los_udgs_in_des_m31 * (
des_det_eff_m31 >= m31_rand_number)
des_sub_select_mw_misclass_udgs = (
los_misclass_udgs_in_des_mw *
(des_det_eff_mw >= mw_rand_number))
des_sub_select_m31_misclass_udgs = (
los_misclass_udgs_in_des_m31 *
(des_det_eff_m31 >= m31_rand_number))
des_sub_select_mw_all_udgs = all_udgs_in_mw
des_sub_select_m31_all_udgs = all_udgs_in_m31
lsst_sub_select_mw_udgs = los_udgs_in_lsst_mw * (
lsst_det_eff_mw >= mw_rand_number)
lsst_sub_select_m31_udgs = los_udgs_in_lsst_m31 * (
lsst_det_eff_m31 >= m31_rand_number)
lsst_sub_select_mw_misclass_udgs = (
los_misclass_udgs_in_lsst_mw *
(lsst_det_eff_mw >= mw_rand_number))
lsst_sub_select_m31_misclass_udgs = (
los_misclass_udgs_in_lsst_m31 *
(lsst_det_eff_m31 >= m31_rand_number))
lsst_sub_select_mw_all_udgs = all_udgs_in_mw
lsst_sub_select_m31_all_udgs = all_udgs_in_m31
# Fraction of total face-on UDGs in ZoA
for z_i, z_extent in enumerate(zoa_extent_list):
udg_in_mw_zoa = object_in_zoa(position_rel_mw[udgs_in_sim],
surface_points[i],
zoa_extent=z_extent)
udg_in_m31_zoa = object_in_zoa(
position_rel_m31[udgs_in_sim],
surface_points[i],
zoa_extent=z_extent)
frac_udgs_in_mw_zoa[z_i][i] = (udg_in_mw_zoa.sum() /
udgs_in_sim.sum())
frac_udgs_in_m31_zoa[z_i][i] = (udg_in_m31_zoa.sum() /
udgs_in_sim.sum())
########################################################
# Generate a mock SDSS observation of the UDG population
sdss_mw_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[sdss_sub_select_mw_udgs],
sub_dis=dist_from_mw[sdss_sub_select_mw_udgs],
survey_direction=surface_points[i],
cos_survey_angle=sdss_cos_surveyAngle,
sub_MV=abs_mag_Vband[sdss_sub_select_mw_udgs],
MV_bins=MV_bins)
sdss_m31_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[sdss_sub_select_m31_udgs],
sub_dis=dist_from_m31[sdss_sub_select_m31_udgs],
survey_direction=surface_points[i],
cos_survey_angle=sdss_cos_surveyAngle,
sub_MV=abs_mag_Vband[sdss_sub_select_m31_udgs],
MV_bins=MV_bins)
# All UDGs with random orientation that are detectable
# but not identified as UDGs
sdss_mw_misclass_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[sdss_sub_select_mw_misclass_udgs],
sub_dis=dist_from_mw[sdss_sub_select_mw_misclass_udgs],
survey_direction=surface_points[i],
cos_survey_angle=sdss_cos_surveyAngle,
sub_MV=abs_mag_Vband[sdss_sub_select_mw_misclass_udgs],
MV_bins=MV_bins)
sdss_m31_misclass_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[
sdss_sub_select_m31_misclass_udgs],
sub_dis=dist_from_m31[sdss_sub_select_m31_misclass_udgs],
survey_direction=surface_points[i],
cos_survey_angle=sdss_cos_surveyAngle,
sub_MV=abs_mag_Vband[sdss_sub_select_m31_misclass_udgs],
MV_bins=MV_bins)
# All face-on UDGs that are detectable in SDSS
sdss_all_udg_mw_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[sdss_sub_select_mw_all_udgs],
sub_dis=dist_from_mw[sdss_sub_select_mw_all_udgs],
survey_direction=surface_points[i],
cos_survey_angle=sdss_cos_surveyAngle,
sub_MV=abs_mag_Vband[sdss_sub_select_mw_all_udgs],
MV_bins=MV_bins)
sdss_all_udg_m31_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[sdss_sub_select_m31_all_udgs],
sub_dis=dist_from_m31[sdss_sub_select_m31_all_udgs],
survey_direction=surface_points[i],
cos_survey_angle=sdss_cos_surveyAngle,
sub_MV=abs_mag_Vband[sdss_sub_select_m31_all_udgs],
MV_bins=MV_bins)
########################################################
# Generate a mock DES observation of the UDG population
des_mw_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[des_sub_select_mw_udgs],
sub_dis=dist_from_mw[des_sub_select_mw_udgs],
survey_direction=surface_points[i],
cos_survey_angle=des_cos_surveyAngle,
sub_MV=abs_mag_Vband[des_sub_select_mw_udgs],
MV_bins=MV_bins)
des_m31_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[des_sub_select_m31_udgs],
sub_dis=dist_from_m31[des_sub_select_m31_udgs],
survey_direction=surface_points[i],
cos_survey_angle=des_cos_surveyAngle,
sub_MV=abs_mag_Vband[des_sub_select_m31_udgs],
MV_bins=MV_bins)
# All UDGs with random orientation that are detectable
# but not identified as UDGs
des_mw_misclass_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[des_sub_select_mw_misclass_udgs],
sub_dis=dist_from_mw[des_sub_select_mw_misclass_udgs],
survey_direction=surface_points[i],
cos_survey_angle=des_cos_surveyAngle,
sub_MV=abs_mag_Vband[des_sub_select_mw_misclass_udgs],
MV_bins=MV_bins)
des_m31_misclass_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[des_sub_select_m31_misclass_udgs],
sub_dis=dist_from_m31[des_sub_select_m31_misclass_udgs],
survey_direction=surface_points[i],
cos_survey_angle=des_cos_surveyAngle,
sub_MV=abs_mag_Vband[des_sub_select_m31_misclass_udgs],
MV_bins=MV_bins)
# All face-on UDGs that are detectable in DES
des_all_udg_mw_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[des_sub_select_mw_all_udgs],
sub_dis=dist_from_mw[des_sub_select_mw_all_udgs],
survey_direction=surface_points[i],
cos_survey_angle=des_cos_surveyAngle,
sub_MV=abs_mag_Vband[des_sub_select_mw_all_udgs],
MV_bins=MV_bins)
des_all_udg_m31_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[des_sub_select_m31_all_udgs],
sub_dis=dist_from_m31[des_sub_select_m31_all_udgs],
survey_direction=surface_points[i],
cos_survey_angle=des_cos_surveyAngle,
sub_MV=abs_mag_Vband[des_sub_select_m31_all_udgs],
MV_bins=MV_bins)
########################################################
# Generate a mock DES observation of the UDG population
lsst_mw_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[lsst_sub_select_mw_udgs],
sub_dis=dist_from_mw[lsst_sub_select_mw_udgs],
survey_direction=surface_points[i],
cos_survey_angle=lsst_cos_surveyAngle,
sub_MV=abs_mag_Vband[lsst_sub_select_mw_udgs],
MV_bins=MV_bins)
lsst_m31_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[lsst_sub_select_m31_udgs],
sub_dis=dist_from_m31[lsst_sub_select_m31_udgs],
survey_direction=surface_points[i],
cos_survey_angle=lsst_cos_surveyAngle,
sub_MV=abs_mag_Vband[lsst_sub_select_m31_udgs],
MV_bins=MV_bins)
# All UDGs with random orientation that are detectable
# but not identified as UDGs
lsst_mw_misclass_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[lsst_sub_select_mw_misclass_udgs],
sub_dis=dist_from_mw[lsst_sub_select_mw_misclass_udgs],
survey_direction=surface_points[i],
cos_survey_angle=lsst_cos_surveyAngle,
sub_MV=abs_mag_Vband[lsst_sub_select_mw_misclass_udgs],
MV_bins=MV_bins)
lsst_m31_misclass_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[
lsst_sub_select_m31_misclass_udgs],
sub_dis=dist_from_m31[lsst_sub_select_m31_misclass_udgs],
survey_direction=surface_points[i],
cos_survey_angle=lsst_cos_surveyAngle,
sub_MV=abs_mag_Vband[lsst_sub_select_m31_misclass_udgs],
MV_bins=MV_bins)
# All face-on UDGs that are detectable in LSST
lsst_all_udg_mw_lfs[i] = generate_mock_lf(
sub_pos=position_rel_mw[lsst_sub_select_mw_all_udgs],
sub_dis=dist_from_mw[lsst_sub_select_mw_all_udgs],
survey_direction=surface_points[i],
cos_survey_angle=lsst_cos_surveyAngle,
sub_MV=abs_mag_Vband[lsst_sub_select_mw_all_udgs],
MV_bins=MV_bins)
lsst_all_udg_m31_lfs[i] = generate_mock_lf(
sub_pos=position_rel_m31[lsst_sub_select_m31_all_udgs],
sub_dis=dist_from_m31[lsst_sub_select_m31_all_udgs],
survey_direction=surface_points[i],
cos_survey_angle=lsst_cos_surveyAngle,
sub_MV=abs_mag_Vband[lsst_sub_select_m31_all_udgs],
MV_bins=MV_bins)
# Stack together all the data
sdss_mw_lfs = np.row_stack(sdss_mw_lfs)
sdss_m31_lfs = np.row_stack(sdss_m31_lfs)
sdss_mw_misclass_lfs = np.row_stack(sdss_mw_misclass_lfs)
sdss_m31_misclass_lfs = np.row_stack(sdss_m31_misclass_lfs)
sdss_all_udg_mw_lfs = np.row_stack(sdss_all_udg_mw_lfs)
sdss_all_udg_m31_lfs = np.row_stack(sdss_all_udg_m31_lfs)
des_mw_lfs = np.row_stack(des_mw_lfs)
des_m31_lfs = np.row_stack(des_m31_lfs)
des_mw_misclass_lfs = np.row_stack(des_mw_misclass_lfs)
des_m31_misclass_lfs = np.row_stack(des_m31_misclass_lfs)
des_all_udg_mw_lfs = np.row_stack(des_all_udg_mw_lfs)
des_all_udg_m31_lfs = np.row_stack(des_all_udg_m31_lfs)
lsst_mw_lfs = np.row_stack(lsst_mw_lfs)
lsst_m31_lfs = np.row_stack(lsst_m31_lfs)
lsst_mw_misclass_lfs = np.row_stack(lsst_mw_misclass_lfs)
lsst_m31_misclass_lfs = np.row_stack(lsst_m31_misclass_lfs)
lsst_all_udg_mw_lfs = np.row_stack(lsst_all_udg_mw_lfs)
lsst_all_udg_m31_lfs = np.row_stack(lsst_all_udg_m31_lfs)
# Obtain max value of LFs
sdss_max_mw_lf = sdss_mw_lfs[:, MV_bins <= -8.]
sdss_max_m31_lf = sdss_m31_lfs[:, MV_bins <= -8.]
des_max_mw_lf = des_mw_lfs[:, MV_bins <= -8.]
des_max_m31_lf = des_m31_lfs[:, MV_bins <= -8.]
lsst_max_mw_lf = lsst_mw_lfs[:, MV_bins <= -8.]
lsst_max_m31_lf = lsst_m31_lfs[:, MV_bins <= -8.]
# Median of maximum values of LFs
sdss_med_max_mw_lf = np.nanmedian(sdss_max_mw_lf[:, -1])
sdss_med_max_m31_lf = np.nanmedian(sdss_max_m31_lf[:, -1])
des_med_max_mw_lf = np.nanmedian(des_max_mw_lf[:, -1])
des_med_max_m31_lf = np.nanmedian(des_max_m31_lf[:, -1])
lsst_med_max_mw_lf = np.nanmedian(lsst_max_mw_lf[:, -1])
lsst_med_max_m31_lf = np.nanmedian(lsst_max_m31_lf[:, -1])
# Fraction of UDGs detectable in each survey
f_sdss_max_mw_lf = sdss_med_max_mw_lf / udgs_in_sim.sum()
f_sdss_max_m31_lf = sdss_med_max_m31_lf / udgs_in_sim.sum()
f_des_max_mw_lf = des_med_max_mw_lf / udgs_in_sim.sum()
f_des_max_m31_lf = des_med_max_m31_lf / udgs_in_sim.sum()
f_lsst_max_mw_lf = lsst_med_max_mw_lf / udgs_in_sim.sum()
f_lsst_max_m31_lf = lsst_med_max_m31_lf / udgs_in_sim.sum()
# Rescale N_UDG to different LG masses
sdss_rescaled_med_nudg_mw = round_to_nearest_multiple(
sdss_med_max_mw_lf * sim_rescale_factor,
0.5,
decimal_precision=1)
sdss_rescaled_med_nudg_m31 = round_to_nearest_multiple(
sdss_med_max_m31_lf * sim_rescale_factor,
0.5,
decimal_precision=1)
des_rescaled_med_nudg_mw = round_to_nearest_multiple(
des_med_max_mw_lf * sim_rescale_factor,
0.5,
decimal_precision=1)
des_rescaled_med_nudg_m31 = round_to_nearest_multiple(
des_med_max_m31_lf * sim_rescale_factor,
0.5,
decimal_precision=1)
lsst_rescaled_med_nudg_mw = round_to_nearest_multiple(
lsst_med_max_mw_lf * sim_rescale_factor,
0.5,
decimal_precision=1)
lsst_rescaled_med_nudg_m31 = round_to_nearest_multiple(
lsst_med_max_m31_lf * sim_rescale_factor,
0.5,
decimal_precision=1)
# Compile sets of rescaled mock observations
sdss_rescaled_mock_obs_mw = []
sdss_rescaled_mock_obs_m31 = []
des_rescaled_mock_obs_mw = []
des_rescaled_mock_obs_m31 = []
lsst_rescaled_mock_obs_mw = []
lsst_rescaled_mock_obs_m31 = []
for (r_med_mw, r_med_m31, des_r_med_mw, des_r_med_m31,
lsst_r_med_mw, lsst_r_med_m31) in zip(
sdss_rescaled_med_nudg_mw, sdss_rescaled_med_nudg_m31,
des_rescaled_med_nudg_mw, des_rescaled_med_nudg_m31,
lsst_rescaled_med_nudg_mw, lsst_rescaled_med_nudg_m31):
# Rescale mock observations
sdss_rescaled_mw_obs = rescale_observations(
sdss_max_mw_lf[:, -1], r_med_mw, sdss_surveyArea,
udgs_in_sim.sum() * f_sdss_max_mw_lf)
sdss_rescaled_m31_obs = rescale_observations(
sdss_max_m31_lf[:, -1], r_med_m31, sdss_surveyArea,
udgs_in_sim.sum() * f_sdss_max_m31_lf)
des_rescaled_mw_obs = rescale_observations(
des_max_mw_lf[:, -1], des_r_med_mw, des_surveyArea,
udgs_in_sim.sum() * f_des_max_mw_lf)
des_rescaled_m31_obs = rescale_observations(
des_max_m31_lf[:, -1], des_r_med_m31, des_surveyArea,
udgs_in_sim.sum() * f_des_max_m31_lf)
lsst_rescaled_mw_obs = rescale_observations(
lsst_max_mw_lf[:, -1], lsst_r_med_mw, lsst_surveyArea,
udgs_in_sim.sum() * f_lsst_max_mw_lf)
lsst_rescaled_m31_obs = rescale_observations(
lsst_max_m31_lf[:, -1], lsst_r_med_m31, lsst_surveyArea,
udgs_in_sim.sum() * f_lsst_max_m31_lf)
sdss_rescaled_mock_obs_mw.append(sdss_rescaled_mw_obs)
sdss_rescaled_mock_obs_m31.append(sdss_rescaled_m31_obs)
des_rescaled_mock_obs_mw.append(des_rescaled_mw_obs)
des_rescaled_mock_obs_m31.append(des_rescaled_m31_obs)
lsst_rescaled_mock_obs_mw.append(lsst_rescaled_mw_obs)
lsst_rescaled_mock_obs_m31.append(lsst_rescaled_m31_obs)
# Compile data to write to file
tot_udg_abs_lf_lg_out_data.append(udg_abs_lfs_lg)
tot_udg_lf_mw_out_data.append(mw_udg_app_lfs_lg)
tot_udg_lf_m31_out_data.append(m31_udg_app_lfs_lg)
sdss_mw_out_data.append(sdss_mw_lfs)
sdss_m31_out_data.append(sdss_m31_lfs)
sdss_misclass_mw_out_data.append(sdss_mw_misclass_lfs)
sdss_misclass_m31_out_data.append(sdss_m31_misclass_lfs)
sdss_faceon_mw_out_data.append(sdss_all_udg_mw_lfs)
sdss_faceon_m31_out_data.append(sdss_all_udg_m31_lfs)
mw_udg_frac_zoa_out_data.append(frac_udgs_in_mw_zoa)
m31_udg_frac_zoa_out_data.append(frac_udgs_in_m31_zoa)
des_mw_out_data.append(des_mw_lfs)
des_m31_out_data.append(des_m31_lfs)
des_misclass_mw_out_data.append(des_mw_misclass_lfs)
des_misclass_m31_out_data.append(des_m31_misclass_lfs)
des_faceon_mw_out_data.append(des_all_udg_mw_lfs)
des_faceon_m31_out_data.append(des_all_udg_m31_lfs)
lsst_mw_out_data.append(lsst_mw_lfs)
lsst_m31_out_data.append(lsst_m31_lfs)
lsst_misclass_mw_out_data.append(lsst_mw_misclass_lfs)
lsst_misclass_m31_out_data.append(lsst_m31_misclass_lfs)
lsst_faceon_mw_out_data.append(lsst_all_udg_mw_lfs)
lsst_faceon_m31_out_data.append(lsst_all_udg_m31_lfs)
sdss_rescaled_mock_obs_mw_out_data.append(
np.column_stack(sdss_rescaled_mock_obs_mw))
sdss_rescaled_mock_obs_m31_out_data.append(
np.column_stack(sdss_rescaled_mock_obs_m31))
des_rescaled_mock_obs_mw_out_data.append(
np.column_stack(des_rescaled_mock_obs_mw))
des_rescaled_mock_obs_m31_out_data.append(
np.column_stack(des_rescaled_mock_obs_m31))
lsst_rescaled_mock_obs_mw_out_data.append(
np.column_stack(lsst_rescaled_mock_obs_mw))
lsst_rescaled_mock_obs_m31_out_data.append(
np.column_stack(lsst_rescaled_mock_obs_m31))
# Write out data
with h5py.File(generated_data_file_template.format(sim_n_part, sim_id),
'w') as f:
############################################################
# Independent data sets
############################################################
rescaled_n_udg_dset = f.create_dataset(
'Rescaled N_UDG,tot', data=rescaled_n_udg_out_data)
rescaled_n_udg_dset.attrs.update({
'Meta':
'Number of field UDGs in the simulation rescaled to a ' +
'target M_LG'
})
rescaled_n_field_dset = f.create_dataset(
'Rescaled N_field', data=rescaled_n_field_out_data)
rescaled_n_field_dset.attrs.update({
'Meta':
'Number of field galaxies in the simulation rescaled to a ' +
'target M_LG'
})
scale_factor_dataset = f.create_dataset(
'LG mass rescale factors',
data=scale_factor_data_to_write[:, [0, s_i + 1]])
scale_factor_dataset.attrs.update({
'Column 00':
'Target LG mass [Msun]',
'Column 01':
'Scale factors (multiply by N_UDG to get rescaled number of ' +
'UDGs in a LG of given mass)'
})
############################################################
# LG Group
############################################################
lg_group = f.create_group('LG')
lg_group.attrs['Meta'] = np.string_('Data wrt. the LG analogue')
lg_tot_abs_vband_lf_subgrp = lg_group.create_group(
'UDG absolute V-band LFs')
lg_tot_abs_vband_lf_subgrp.attrs['Meta'] = np.string_(
'Absolute V-band magnitude luminosity functions of the ' +
'entire UDG population wrt. the centre of the Local Group ' +
'(the midpoint between the MW and M31 analogues)')
############################################################
# MW Group
############################################################
mw_group = f.create_group('MW')
mw_group.attrs['Meta'] = np.string_('Data wrt. the MW analogue')
mw_app_lf_subgroup = mw_group.create_group('Apparent UDG LF')
mw_app_lf_subgroup.attrs.update({
'Meta':
'Apparent V-band magnitude UDG luminosity functions wrt. ' +
'the Milky Way'
})
sdss_mw_lf_subgroup = mw_group.create_group('SDSS UDG LF')
sdss_mw_lf_subgroup.attrs.update({
'Meta':
'Mock SDSS UDG luminosity functions (absolute V-band ' +
'magnitude)',
'Number of pointings':
n_sightings
})
sdss_mw_misclass_lf_sgroup = mw_group.create_group(
'SDSS misclassified UDG LF')
sdss_mw_misclass_lf_sgroup.attrs.update({
'Meta':
'Mock SDSS luminosity functions of HESTIA UDGs that are ' +
'misclassified as non-UDGs (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
sdss_mw_all_lf_subgroup = mw_group.create_group('SDSS all UDG LF')
sdss_mw_all_lf_subgroup.attrs.update({
'Meta':
'Mock SDSS luminosity functions of HESTIA UDGs that are ' +
'face-on (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
des_mw_lf_subgroup = mw_group.create_group('DES UDG LF')
des_mw_lf_subgroup.attrs.update({
'Meta':
'Mock DES UDG luminosity functions (absolute V-band ' +
'magnitude)',
'Number of pointings':
n_sightings
})
des_mw_misclass_lf_sgroup = mw_group.create_group(
'DES misclassified UDG LF')
des_mw_misclass_lf_sgroup.attrs.update({
'Meta':
'Mock DES luminosity functions of HESTIA UDGs that are ' +
'misclassified as non-UDGs (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
des_mw_all_lf_subgroup = mw_group.create_group('DES all UDG LF')
des_mw_all_lf_subgroup.attrs.update({
'Meta':
'Mock DES luminosity functions of HESTIA UDGs that are ' +
'face-on (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
lsst_mw_lf_subgroup = mw_group.create_group('LSST UDG LF')
lsst_mw_lf_subgroup.attrs.update({
'Meta':
'Mock LSST UDG luminosity functions (absolute V-band ' +
'magnitude)',
'Number of pointings':
n_sightings
})
lsst_mw_misclass_lf_subgroup = mw_group.create_group(
'LSST misclassified UDG LF')
lsst_mw_misclass_lf_subgroup.attrs.update({
'Meta':
'Mock LSST luminosity functions of HESTIA UDGs that are ' +
'misclassified as non-UDGs (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
lsst_mw_all_lf_subgroup = mw_group.create_group('LSST all UDG LF')
lsst_mw_all_lf_subgroup.attrs.update({
'Meta':
'Mock LSST luminosity functions of HESTIA UDGs that are ' +
'face-on (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
mw_rs_nudg_subgroup = mw_group.create_group('Rescaled N_UDG,SDSS')
mw_rs_nudg_subgroup.attrs.update({
'Meta':
'Total number of UDGs in each mock SDSS observation ' +
'rescaled to a given LG mass',
'Number of pointings':
n_sightings
})
des_mw_rs_nudg_subgroup = mw_group.create_group(
'Rescaled N_UDG,DES')
des_mw_rs_nudg_subgroup.attrs.update({
'Meta':
'Total number of UDGs in each mock DES observation ' +
'rescaled to a given LG mass',
'Number of pointings':
n_sightings
})
lsst_mw_rs_nudg_subgroup = mw_group.create_group(
'Rescaled N_UDG,LSST')
lsst_mw_rs_nudg_subgroup.attrs.update({
'Meta':
'Total number of UDGs in each mock LSST observation ' +
'rescaled to a given LG mass',
'Number of pointings':
n_sightings
})
mw_zoa_subgroup = mw_group.create_group('f_UDG in ZoA')
mw_zoa_subgroup.attrs.update({
'Meta': 'Fraction of N_tot in the ZoA',
'Number of pointings': n_sightings
})
############################################################
# M31 Group
############################################################
m31_group = f.create_group('M31')
m31_group.attrs['Meta'] = np.string_('Data wrt. the M31 analogue')
m31_lf_subgroup = m31_group.create_group('SDSS UDG LF')
m31_lf_subgroup.attrs.update({
'Meta':
'Mock SDSS UDG luminosity functions (absolute V-band ' +
'magnitude)',
'Number of pointings':
n_sightings
})
sdss_m31_misclass_lf_subgroup = m31_group.create_group(
'SDSS misclassified UDG LF')
sdss_m31_misclass_lf_subgroup.attrs.update({
'Meta':
'Mock SDSS luminosity functions of HESTIA UDGs that are ' +
'misclassified as non-UDGs (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
sdss_m31_all_lf_subgroup = m31_group.create_group(
'SDSS all UDG LF')
sdss_m31_all_lf_subgroup.attrs.update({
'Meta':
'Mock SDSS luminosity functions of HESTIA UDGs that are ' +
'face-on (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
des_m31_lf_subgroup = m31_group.create_group('DES UDG LF')
des_m31_lf_subgroup.attrs.update({
'Meta':
'Mock DES UDG luminosity functions (absolute V-band ' +
'magnitude)',
'Number of pointings':
n_sightings
})
des_m31_misclass_lf_subgroup = m31_group.create_group(
'DES misclassified UDG LF')
des_m31_misclass_lf_subgroup.attrs.update({
'Meta':
'Mock DES luminosity functions of HESTIA UDGs that are ' +
'misclassified as non-UDGs (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
des_m31_all_lf_subgroup = m31_group.create_group('DES all UDG LF')
des_m31_all_lf_subgroup.attrs.update({
'Meta':
'Mock DES luminosity functions of HESTIA UDGs that are ' +
'face-on (absolute V-band magnitude)',
'Number of pointings':
n_sightings
})
lsst_m31_lf_subgroup = m31_group.create_group('LSST UDG LF')
lsst_m31_lf_subgroup.attrs.update({
'Meta':