-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdo_it_all_template.sh
More file actions
executable file
·212 lines (174 loc) · 5.45 KB
/
Copy pathdo_it_all_template.sh
File metadata and controls
executable file
·212 lines (174 loc) · 5.45 KB
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
#!/bin/bash
# one script to rule them all, to be run from within the script with config options ...
ncores=2
if [ "$do_tracers" == "1" ]
then
if [ "$sysweight" != "" ]
then
sysweight="$base/data/$sysweight"
fi
##########################
echo "(1.1) convert Eli's redMaGiC mask to healpix mask map"
mkdir -p lenses
cd lenses
if [ "$incremental" == "0" ]
then
rm -f mask_zcut_*.fits
fi
for i in "${countredshift_max[@]}"
do
if [ ! -f mask_zcut_$i.fits ]
then
echo $helpers/mkhealpixmask $base/data/$mask mask_zcut_$i.fits $i ${mask_hpixcol} ${mask_fracgood} ${mask_zmax} ${mask_nside} ${sysweight}
$helpers/mkhealpixmask $base/data/$mask mask_zcut_$i.fits $i ${mask_hpixcol} ${mask_fracgood} ${mask_zmax} ${mask_nside} ${sysweight}
fi
done
cd ..
##########################
##########################
echo "(1.2) convert tracer catalog to txt file"
cd lenses
for(( i=0; i<${#countredshift_min[@]}; ++i ))
do
lowz=${countredshift_min[$i]}
highz=${countredshift_max[$i]}
if [ "$incremental" == "0" ]
then
rm -f tracers_${lowz}_${highz}.txt
fi
if [ ! -f tracers_${lowz}_${highz}.txt ]
then
echo $helpers/cut_mask_z $base/data/$tracers $tracers_racol $tracers_deccol $tracers_zcol $lowz $highz mask_zcut_$highz.fits
$helpers/cut_mask_z $base/data/$tracers $tracers_racol $tracers_deccol $tracers_zcol $lowz $highz mask_zcut_$highz.fits > tracers_${lowz}_${highz}.txt
fi
done
cd ..
##########################
##########################
echo "(1.3) convert tracer catalog to healpix map"
cd lenses
for(( i=0; i<${#countredshift_min[@]}; ++i ))
do
lowz=${countredshift_min[$i]}
highz=${countredshift_max[$i]}
if [ "$incremental" == "0" ]
then
rm -f tracers_${lowz}_${highz}.fits
fi
if [ ! -f tracers_${lowz}_${highz}.fits ]
then
echo $helpers/count_in_trough tracers_${lowz}_${highz}.txt 0 tracers_${lowz}_${highz}.fits
$helpers/count_in_trough tracers_${lowz}_${highz}.txt 0 tracers_${lowz}_${highz}.fits
fi
done
cd ..
##########################
##########################
echo "(1.4) create jackknife patches"
cd lenses
if [ "$incremental" == "0" ]
then
rm -f jackknife.fits
fi
if [ ! -f jackknife.fits ]
then
$helpers/healpix_resample.py mask_zcut_${jackkniferedshift_max}.fits 512 tmp.fits
$helpers/mkjackknife.py tmp.fits $npatch tmppatches.fits
$helpers/healpix_resample.py tmppatches.fits ${trough_nside} jackknife.fits
rm -f tmp.fits tmppatches.fits
fi
cd ..
##########################
fi
if [ "$do_counts" == "1" ]
then
##########################
echo "(2.1) generate count healpix map from tracer catalog"
cd lenses
for theta in $countradii
do
for(( i=0; i<${#countredshift_min[@]}; ++i ))
do
lowz=${countredshift_min[$i]}
highz=${countredshift_max[$i]}
if [ "$incremental" == "0" ]
then
rm -f trough_${theta}_${lowz}_${highz}_count.fits
fi
if [ ! -f trough_${theta}_${lowz}_${highz}_count.fits ]
then
echo $helpers/count_in_trough tracers_${lowz}_${highz}.txt $theta trough_${theta}_${lowz}_${highz}_count.fits
$helpers/count_in_trough tracers_${lowz}_${highz}.txt $theta trough_${theta}_${lowz}_${highz}_count.fits
fi
done
done
cd ..
##########################
##########################
echo "(2.2) generate trough-averaged z-cut mask healpix map"
cd lenses
for theta in $countradii
do
if [ "$incremental" == "0" ]
then
rm -f trough_${theta}_*_mask.fits
fi
for(( i=0; i<${#countredshift_min[@]}; ++i ))
do
highz=${countredshift_max[$i]}
if [ ! -f trough_${theta}_${highz}_mask.fits ]
then
echo $helpers/mask_trough mask_zcut_$highz.fits $theta trough_${theta}_${highz}_mask.fits ${trough_nside}
$helpers/mask_trough mask_zcut_${highz}.fits $theta trough_${theta}_${highz}_mask.fits ${trough_nside}
fi
done
done
cd ..
##########################
##########################
echo "(2.3) generate trough maps"
cd lenses
for theta in $countradii
do
for(( i=0; i<${#countredshift_min[@]}; ++i ))
do
lowz=${countredshift_min[$i]}
highz=${countredshift_max[$i]}
if [ "$incremental" == "0" ]
then
rm -f trough_${theta}_${lowz}_${highz}_map*.fits
fi
if [ ! -f trough_${theta}_${lowz}_${highz}_0.fits ]
then
echo $helpers/troughfinder trough_${theta}_${lowz}_${highz}_count.fits trough_${theta}_${highz}_mask.fits ${count_maxmaskfrac} trough_${theta}_${lowz}_${highz} $countpercentiles
$helpers/troughfinder trough_${theta}_${lowz}_${highz}_count.fits trough_${theta}_${highz}_mask.fits ${count_maxmaskfrac} trough_${theta}_${lowz}_${highz} $countpercentiles &> trough_${theta}_${lowz}_${highz}.log
fi
done
done
cd ..
##########################
##########################
echo "(2.4) calculate p(N) statistics"
mkdir -p pofn
mkdir -p pofn_jackknife
cd pofn
if [ "$incremental" == "0" ]
then
rm -f pofn_*.tab
fi
for theta in $countradii
do
for(( i=0; i<${#countredshift_min[@]}; ++i ))
do
lowz=${countredshift_min[$i]}
highz=${countredshift_max[$i]}
if [ ! -s pofn_${theta}_${lowz}_${highz}.tab ]
then
$helpers/pofn_bernoulli_jackknife ../lenses/trough_${theta}_${lowz}_${highz}_count.fits ../lenses/trough_${theta}_${highz}_mask.fits \
../lenses/jackknife.fits ${count_maxmaskfrac} ../pofn_jackknife/pofn_${theta}_${lowz}_${highz} > pofn_${theta}_${lowz}_${highz}.tab
fi
done
done
cd ..
##########################
fi