summaryrefslogtreecommitdiffstats
path: root/funtools/funtest/funcones
blob: fcf2457312746dd9d80ec6ab0fe96efbb87ddeb7 (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
#!/bin/sh
# fundisp keyfile | funcones [datafile] [radius]
set -x

# first argument: input file name
if [ x$1 = x ]; then
  echo "usage: $0 file < keyfile"
  exit 1
else
  FILE=$1
  OBASE=`basename $FILE | awk -F. '{x=NF-1;print $x}'`
  shift
fi

# second argument: input file's RA column name and units
if [ x$1 = x ]; then
  RACOL="RA:h"
else
  RACOL=$1
  shift
fi

# third argument: input file's DEC column name and units
if [ x$1 = x ]; then
  DECCOL="DEC:d"
else
  DECCOL=$1
  shift
fi

# fourth optional arg: radius
if [ x$1 = x ]; then
  RAD=".1d"
else
  RAD=$1
fi

# make sure input file is available
if [ ! -r $FILE ]; then
  echo "ERROR: $FILE not found"
  exit 1
fi

# read column names
read COLS
# skip dashes
read DASHES

i=1
# read each line into its column names
while read $COLS
do
# output filename just has a number id
  OFILE=${OBASE}_${i}.mat
# display relationship between id and ra, dec
  echo "${OFILE}	${RA}	${DEC}	${SEP}"
# specific funcone command line goes here (add unit specifiers, etc.)
funcone -r ${RACOL} -d ${DECCOL} ${FILE}'[1]' ${OFILE} ${RA}d ${DEC} ${RAD}
# exit
  i=`echo "$i+1" | bc`
done