-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ntemplate_bpz_script.sh
executable file
·224 lines (188 loc) · 9.52 KB
/
Ntemplate_bpz_script.sh
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
# settings
export CONDALOC=/home/jfcrenshaw/miniconda3/etc/profile.d/conda.sh
export PY2ENV=py2
export BPZPATH=$HOME/documents/bpz-1.99.3
export OUTDIR=bpz_files
export IBANDS=('i' 'i2' 'Icfh12k' 'i+')
export NINTERP=0 # number of templates to interpolate for BPZ
# Number of each galaxy type in various sets
export NEl_6=1 # number of eliptical galaxy templates
export NSp_6=2 # number of spiral galaxy templates
export NIS_6=3 # number of irregular/star burst galaxy templates
export NEl_7=1 # number of eliptical galaxy templates
export NSp_7=3 # number of spiral galaxy templates
export NIS_7=3 # number of irregular/star burst galaxy templates
export NEl_8=1 # number of eliptical galaxy templates
export NSp_8=4 # number of spiral galaxy templates
export NIS_8=3 # number of irregular/star burst galaxy templates
export NEl_9=1 # number of eliptical galaxy templates
export NSp_9=4 # number of spiral galaxy templates
export NIS_9=4 # number of irregular/star burst galaxy templates
export NEl_10=1 # number of eliptical galaxy templates
export NSp_10=5 # number of spiral galaxy templates
export NIS_10=4 # number of irregular/star burst galaxy templates
export NEl_11=1 # number of eliptical galaxy templates
export NSp_11=5 # number of spiral galaxy templates
export NIS_11=5 # number of irregular/star burst galaxy templates
export NEl_12=1 # number of eliptical galaxy templates
export NSp_12=5 # number of spiral galaxy templates
export NIS_12=6 # number of irregular/star burst galaxy templates
export NEl_13=1 # number of eliptical galaxy templates
export NSp_13=6 # number of spiral galaxy templates
export NIS_13=6 # number of irregular/star burst galaxy templates
export NEl_14=1 # number of eliptical galaxy templates
export NSp_14=7 # number of spiral galaxy templates
export NIS_14=6 # number of irregular/star burst galaxy templates
export NEl_16=2 # number of eliptical galaxy templates
export NSp_16=8 # number of spiral galaxy templates
export NIS_16=6 # number of irregular/star burst galaxy templates
export NEl_18=2 # number of eliptical galaxy templates
export NSp_18=8 # number of spiral galaxy templates
export NIS_18=8 # number of irregular/star burst galaxy templates
export NEl_20=2 # number of eliptical galaxy templates
export NSp_20=9 # number of spiral galaxy templates
export NIS_20=9 # number of irregular/star burst galaxy templates
export NEl_22=2 # number of eliptical galaxy templates
export NSp_22=10 # number of spiral galaxy templates
export NIS_22=10 # number of irregular/star burst galaxy templates
export NEl_24=3 # number of eliptical galaxy templates
export NSp_24=10 # number of spiral galaxy templates
export NIS_24=11 # number of irregular/star burst galaxy templates
STARTTIME=$(date +%s)
# print reminders
echo " "
echo "NOTE:"
echo "Make sure the settings at the top of the script are correct."
echo "This includes:"
echo " -location of the conda bash function"
echo " -name of the python 2 environment"
echo " -location of BPZ"
echo " -where to save BPZ results"
echo " -list of i-bands used for the magnitude prior"
echo " -number of templates to interpolate in BPZ"
echo " -number of each spectral type in the trained naive template set (determined"
echo " in color_classify.ipynb)"
echo " "
# switch to environment with python 2
source $CONDALOC
conda activate $PY2ENV
# copy templates and filters to the BPZ folders
cp templates/* $BPZPATH/SED/
cp filters/*res $BPZPATH/FILTER/
#echo "Running BPZ on the 6 trained templates..."
#export OUTFILE=$OUTDIR/N6_Ntemplate_output.txt
#rm $OUTFILE 2> /dev/null
#echo "Saving output to" $OUTFILE"..."
#for BAND in "${IBANDS[@]}"; do
# python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N6_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_6 $NSp_6 $NIS_6 -VERBOSE no &>> $OUTFILE
# python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
# echo "Saving" $OUTDIR"/N6_Ntemplates_"$BAND"_photoz.bpz..."
# mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N6_Ntemplates_$BAND\_photoz.bpz
#done
#echo " "
echo "Running BPZ on the 8 trained templates..."
export OUTFILE=$OUTDIR/N8_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N8_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_8 $NSp_8 $NIS_8 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N8_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N8_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 10 trained templates..."
export OUTFILE=$OUTDIR/N10_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N10_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_10 $NSp_10 $NIS_10 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N10_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N10_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 12 trained templates..."
export OUTFILE=$OUTDIR/N12_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N12_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_12 $NSp_12 $NIS_12 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N12_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N12_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 14 trained templates..."
export OUTFILE=$OUTDIR/N14_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N14_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_14 $NSp_14 $NIS_14 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N14_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N14_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 16 trained templates..."
export OUTFILE=$OUTDIR/N16_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N16_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_16 $NSp_16 $NIS_16 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N16_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N16_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 18 trained templates..."
export OUTFILE=$OUTDIR/N18_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N18_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_18 $NSp_18 $NIS_18 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N18_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N18_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 20 trained templates..."
export OUTFILE=$OUTDIR/N20_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N20_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_20 $NSp_20 $NIS_20 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N20_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N20_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 22 trained templates..."
export OUTFILE=$OUTDIR/N22_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N22_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_22 $NSp_22 $NIS_22 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N22_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N22_Ntemplates_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on the 24 trained templates..."
export OUTFILE=$OUTDIR/N24_Ntemplate_output.txt
rm $OUTFILE 2> /dev/null
echo "Saving output to" $OUTFILE"..."
for BAND in "${IBANDS[@]}"; do
python $BPZPATH/bpz.py $OUTDIR/bpz_catalog_$BAND.cat -SPECTRA N24_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_24 $NSp_24 $NIS_24 -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N24_Ntemplates_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N24_Ntemplates_$BAND\_photoz.bpz
done
echo " "
rm $OUTDIR/*catalog*bpz 2> /dev/null
rm $OUTDIR/*bak 2> /dev/null
rm $OUTDIR/*flux_comparison 2> /dev/null
rm $OUTDIR/*probs 2> /dev/null
ENDTIME=$(date +%s)
echo "Duration $(($ENDTIME - $STARTTIME)) seconds"
echo " "