forked from deapplegate/wtgpipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply_RADIAL_MASK_para.sh
executable file
·77 lines (55 loc) · 1.65 KB
/
apply_RADIAL_MASK_para.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
#!/bin/bash -xv
########################
#$Id: apply_ringmask_para.sh,v 1.5 2009-07-17 02:54:49 anja Exp $
#######################
# Apply ring mask to weight files for coaddition
# Cuts out poorly calibrated outer area of chips.
########################
#$1 : subaru directory
#$2 : coadd directory (full path)
#$3 : extension
#$4 : chip numbers
########################
#adam-BL#. BonnLogger.sh
#adam-BL#. log_start
. progs.ini
subarudir=$1
coadddir=$2
ext=$3
CHIPS=$4
###################
# Loop over chips
for chip in $CHIPS; do
filebases=`find $coadddir/ -name \*_${chip}${ext}.fits -exec basename {} .fits \;`
#adam-BL#if [ -z "${filebases}" ]; then
#adam-BL# ./BonnLogger.py comment "apply_ringmask_parap.sh - No Files Found: Chip ${chip}"
#adam-BL#fi
for base in $filebases; do
config=`dfits ${coadddir}/${base}.fits | fitsort -d CONFIG | awk '{print $2}'`
maskdir=${subarudir}/RADIAL_MASKS/${INSTRUMENT}_${config}
ringmask=${maskdir}/RadialMask_${config}_${chip}.fits
if [ -f "${ringmask}" ]; then
weight=${coadddir}/${base}.weight.fits
flag=${coadddir}/${base}.flag.fits
newweight=${coadddir}/${base}.newweight.fits
${P_WW} -c lensconf/poly_flag.ww \
-WEIGHT_NAMES $weight,$ringmask \
-WEIGHT_MIN -1e12,.5 \
-WEIGHT_MAX 1e12,1.5 \
-WEIGHT_OUTFLAGS 0,0 \
-FLAG_NAMES "" \
-OUTWEIGHT_NAME ${newweight} \
-OUTFLAG_NAME ""
if [ $? -gt 0 ]; then
#adam-BL#log_status 2 "Weight watcher failed on $base"
exit 2
fi
mv ${newweight} $weight
if [ $? -gt 0 ]; then
#adam-BL#log_status 3 "Cannot move weight file $base"
exit 3
fi
fi
done
done
#adam-BL#log_status 0