-
Notifications
You must be signed in to change notification settings - Fork 1
/
bpz_script.sh
executable file
·109 lines (92 loc) · 4.27 KB
/
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
# 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 the CWW+SB4 trained templates
export NEl_8cw=1 # number of eliptical galaxy templates
export NSp_8cw=2 # number of spiral galaxy templates
export NIS_8cw=5 # number of irregular/star burst galaxy templates
# Number of each galaxy type in the naive set with 8 trained 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
# Number of each galaxy type in the naive set with 16 trained 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
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/
cp prior_calibrated.py $BPZPATH/
echo "Running BPZ on CWW+SB4 templates..."
export OUTFILE=$OUTDIR/cwwsb4_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 cwwsb4.list -INTERP $NINTERP -PRIOR calibrated -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/cwwsb4_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/cwwsb4_$BAND\_photoz.bpz
done
echo " "
echo "Running BPZ on trained CWW+SB4 templates..."
export OUTFILE=$OUTDIR/cwwsb4_trained_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 cwwsb4_trained.list -INTERP $NINTERP -PRIOR calibrated -NTYPES $NEl_8cw $NSp_8cw $NIS_8cw -NEW_AB no -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/cwwsb4_trained_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/cwwsb4_trained_$BAND\_photoz.bpz
done
echo " "
#echo "Running BPZ on the 8 trained naive templates..."
#export OUTFILE=$OUTDIR/N8_trained_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 -NEW_AB no -VERBOSE no &>> $OUTFILE
# python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
# echo "Saving" $OUTDIR"/N8_trained_"$BAND"_photoz.bpz..."
# mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N8_trained_$BAND\_photoz.bpz
#done
#echo " "
echo "Running BPZ on the 16 trained naive templates..."
export OUTFILE=$OUTDIR/N16_trained_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 -NEW_AB no -VERBOSE no &>> $OUTFILE
python $BPZPATH/bpzfinalize.py $OUTDIR/bpz_catalog_$BAND &>> $OUTFILE
echo "Saving" $OUTDIR"/N16_trained_"$BAND"_photoz.bpz..."
mv $OUTDIR/bpz_catalog_$BAND\_bpz.cat $OUTDIR/N16_trained_$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 " "