blob: 4c0d7e4197f50ed140d978c72e238eac8d556af2 (
plain)
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
|
#!/bin/sh
# set -x
# make sure we have minimum arg count
if [ $# -lt 3 ]; then
echo "funds9 [cmd] [xpa] [filename or filelist] [args ...]"
exit 1
fi
# don't use gnuplot by default
DOGP=0
# disable multi-file support -- it conflicts with spaced directory support
DOMULTI=0
# process standard arguments
CMD="$1"; shift;
XPA="$1"; shift;
FILES="$1"; shift;
if [ x$DOMULTI = x1 ]; then
if [ "GNUPLOT" != "NONE" ]; then
NFILES=`echo $FILES | AWK '{print NF}'`
if [ $NFILES -gt 1 ]; then
VERSION=`echo "show version" | gnuplot 2>&1 | grep version | AWK '{print $3*10}'`
if [ x"$VERSION" != x -a $VERSION -ge 37 ]; then
DOGP=1
fi
fi
fi
else
FILE="$FILES"
fi
# process commands
case $CMD in
funcnts)
if [ $# = 0 ]; then
echo "ERROR: funcnts filename [source] [bkgd]"
exit 1
fi
if [ x$DOMULTI = x1 ]; then
for FILE in $FILES; do
funcnts "$FILE" $* 2>&1
done
else
funcnts "$FILE" $* 2>&1
fi
exit 0
;;
funhist)
if [ $# != 3 ]; then
echo "ERROR: funhist filename [norm width] [column] [bin]"
exit 1
fi
ARGS=""
PARAM=$1; shift;
read NORM WIDTH <<EOF
$PARAM
EOF
if [ $NORM = 1 ]; then
ARGS="$ARGS -n"
fi
if [ $WIDTH = 1 ]; then
ARGS="$ARGS -w"
fi
if [ x$DOMULTI = x1 ]; then
for FILE in $FILES; do
funhist $ARGS "$FILE" $* 2>&1
done
else
funhist $ARGS "$FILE" $* 2>&1
fi
exit 0
;;
funcnts_plot)
if [ $# = 0 ]; then
echo "ERROR: funcnts filename [source] [bkgd]"
exit 1
fi
if [ x$DOMULTI = x1 ]; then
for FILE in $FILES; do
if [ $DOGP = 1 ]; then
funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" gnuplot
else
funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" ds9 2>&1
fi
done
else
if [ $DOGP = 1 ]; then
funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" gnuplot
else
funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" ds9 2>&1
fi
fi
exit 0
;;
funhist_plot)
if [ $# != 3 ]; then
echo "ERROR: funhist filename [norm width] [column] [bin]"
exit 1
fi
ARGS=""
PARAM=$1; shift;
read NORM WIDTH <<EOF
$PARAM
EOF
if [ $NORM = 1 ]; then
ARGS="$ARGS -n"
fi
if [ $WIDTH = 1 ]; then
ARGS="$ARGS -w"
fi
if [ x$DOMULTI = x1 ]; then
for FILE in $FILES; do
if [ $DOGP = 1 ]; then
funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" gnuplot
else
funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" ds9 2>&1
fi
done
else
if [ $DOGP = 1 ]; then
funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" gnuplot
else
funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" ds9 2>&1
fi
fi
exit 0
;;
funcen)
if [ $# != 5 ]; then
echo "ERROR: funcen filename region(s) niter tol disp ftype"
exit 1
fi
ARGS=""
REGION=$1; shift;
if [ x"$REGION" = x ]; then
echo "ERROR: no region(s) specified"
exit 1
fi
NITER=$1; shift;
TOL=$1; shift;
DISP=$1; shift;
FTYPE=$1; shift;
if [ "$FTYPE" = 1 ]; then
ARGS="$ARGS -i"
fi
VERB=1
TMP="/tmp/fun_${CMD}_$$.out"
if [ x$DOMULTI = x1 ]; then
for FILE in $FILES; do
funcen $ARGS -n $NITER -t $TOL -v $VERB "$FILE" "$REGION" $* 2>&1 > $TMP
cat $TMP
if [ $DISP = "1" ]; then
xpaset -p $XPA regions deleteall
grep final_region $TMP | AWK '{print $2}'| xpaset $XPA regions
fi
done
else
funcen $ARGS -n $NITER -t $TOL -v $VERB "$FILE" "$REGION" $* 2>&1 > $TMP
cat $TMP
if [ $DISP = "1" ]; then
xpaset -p $XPA regions deleteall
grep final_region $TMP | AWK '{print $2}'| xpaset $XPA regions
fi
fi
exit 0
;;
*)
echo "ERROR: unknown function: " "$CMD"
exit 1
;;
esac
|