summaryrefslogtreecommitdiffstats
path: root/funtools/funtest
diff options
context:
space:
mode:
Diffstat (limited to 'funtools/funtest')
-rw-r--r--funtools/funtest/Makefile.in274
-rw-r--r--funtools/funtest/arg3.inc1
-rw-r--r--funtools/funtest/asc2fits.c85
-rw-r--r--funtools/funtest/ascii2fits.c99
-rw-r--r--funtools/funtest/avg2
-rw-r--r--funtools/funtest/bigfits.c87
-rw-r--r--funtools/funtest/bpix.ev3
-rw-r--r--funtools/funtest/cat.ls3
-rw-r--r--funtools/funtest/cat.txt102
-rw-r--r--funtools/funtest/comm15
-rw-r--r--funtools/funtest/conf.h.in56
-rw-r--r--funtools/funtest/evcol.c130
-rw-r--r--funtools/funtest/evcre.c115
-rw-r--r--funtools/funtest/evmerge.c77
-rw-r--r--funtools/funtest/evmerge2.c124
-rw-r--r--funtools/funtest/evnext.c116
-rw-r--r--funtools/funtest/evread.c363
-rw-r--r--funtools/funtest/evreplace.c96
-rw-r--r--funtools/funtest/evtest.c82
-rwxr-xr-xfuntools/funtest/fctest4
-rw-r--r--funtools/funtest/filt.c147
-rw-r--r--funtools/funtest/funcalc.sed11
-rwxr-xr-xfuntools/funtest/funcheck10
-rwxr-xr-xfuntools/funtest/funchecks6
-rwxr-xr-xfuntools/funtest/funcones61
-rw-r--r--funtools/funtest/fundisp1out0
-rw-r--r--funtools/funtest/funsky.c238
-rwxr-xr-xfuntools/funtest/funstack86
-rwxr-xr-xfuntools/funtest/funtest195
-rwxr-xr-xfuntools/funtest/funtesti18
-rwxr-xr-xfuntools/funtest/funtests127
-rwxr-xr-xfuntools/funtest/funtexts14
-rw-r--r--funtools/funtest/funtools1.vu10
-rw-r--r--funtools/funtest/funtools2.vu11
-rw-r--r--funtools/funtest/goo.ls0
-rw-r--r--funtools/funtest/group.calc125
-rw-r--r--funtools/funtest/imblank.c107
-rw-r--r--funtools/funtest/imtest.c156
-rwxr-xr-xfuntools/funtest/install-sh276
-rw-r--r--funtools/funtest/mif.lst4
-rw-r--r--funtools/funtest/mif1.fits2
-rw-r--r--funtools/funtest/mif2.fits2
-rw-r--r--funtools/funtest/mif3.fits2
-rw-r--r--funtools/funtest/mif4.fits2
-rw-r--r--funtools/funtest/mkdim.c96
-rw-r--r--funtools/funtest/mkev.c335
-rw-r--r--funtools/funtest/mkev2.c53
-rw-r--r--funtools/funtest/ntest.ev98
-rwxr-xr-xfuntools/funtest/nwcs109
-rw-r--r--funtools/funtest/parse.in24
-rw-r--r--funtools/funtest/pr8
-rw-r--r--funtools/funtest/qcon.c123
-rw-r--r--funtools/funtest/resample.fc70
-rw-r--r--funtools/funtest/sample.fc13
-rw-r--r--funtools/funtest/snr100.reg100
-rw-r--r--funtools/funtest/snr400.reg400
-rw-r--r--funtools/funtest/snr900.reg900
-rw-r--r--funtools/funtest/swap5
-rw-r--r--funtools/funtest/swap18
-rw-r--r--funtools/funtest/t1.reg6
-rw-r--r--funtools/funtest/t2.reg5
-rw-r--r--funtools/funtest/t3.reg4
-rw-r--r--funtools/funtest/t4.reg1
-rw-r--r--funtools/funtest/tboxell.in50
-rw-r--r--funtools/funtest/tcalc.in14
-rw-r--r--funtools/funtest/tcols.in56
-rw-r--r--funtools/funtest/tcone.in8
-rwxr-xr-xfuntools/funtest/tenv24
-rw-r--r--funtools/funtest/test.asc298
-rw-r--r--funtools/funtest/test.ev62
-rw-r--r--funtools/funtest/test.fitsbin0 -> 5760 bytes
-rw-r--r--funtools/funtest/test2.ev113
-rw-r--r--funtools/funtest/test2.rawbin0 -> 3770 bytes
-rwxr-xr-xfuntools/funtest/tevread93
-rw-r--r--funtools/funtest/tfile.in17
-rwxr-xr-xfuntools/funtest/tfuncalc178
-rwxr-xr-xfuntools/funtest/tfuncnts307
-rwxr-xr-xfuntools/funtest/tfuncone131
-rwxr-xr-xfuntools/funtest/tfundisp227
-rwxr-xr-xfuntools/funtest/tfunhead241
-rwxr-xr-xfuntools/funtest/tfunimage227
-rwxr-xr-xfuntools/funtest/tfunmerge126
-rwxr-xr-xfuntools/funtest/tfuntext140
-rwxr-xr-xfuntools/funtest/tfunview163
-rw-r--r--funtools/funtest/thead.in12
-rwxr-xr-xfuntools/funtest/timev264
-rw-r--r--funtools/funtest/tmerge.in16
-rw-r--r--funtools/funtest/tnum.in9
-rw-r--r--funtools/funtest/tparen.in50
-rw-r--r--funtools/funtest/tregions.in67
-rw-r--r--funtools/funtest/tsections.in11
-rw-r--r--funtools/funtest/ttext.in91
-rw-r--r--funtools/funtest/tview.in11
-rw-r--r--funtools/funtest/twcs.c61
-rw-r--r--funtools/funtest/unwcs.in12
-rw-r--r--funtools/funtest/wcs.in12
-rw-r--r--funtools/funtest/wtest.c123
-rw-r--r--funtools/funtest/x.fits1
98 files changed, 9017 insertions, 0 deletions
diff --git a/funtools/funtest/Makefile.in b/funtools/funtest/Makefile.in
new file mode 100644
index 0000000..2b7cc77
--- /dev/null
+++ b/funtools/funtest/Makefile.in
@@ -0,0 +1,274 @@
+#
+# This is a Makefile for the Funtools testing. If it has the name "Makefile.in"
+# then it is a template for a Makefile; to generate the actual Makefile,
+# run "./configure", which is a configuration script generated by the
+# "autoconf" program (constructs like "@foo@" will get replaced in the
+# actual Makefile.
+#
+
+#----------------------------------------------------------------
+# Things you can change to personalize the Makefile for your own
+# site (you can make these changes in either Makefile.in or
+# Makefile, but changes to Makefile will get lost if you re-run
+# the configuration script).
+#----------------------------------------------------------------
+
+# Default top-level directories in which to install architecture-
+# specific files (exec_prefix) and machine-independent files such
+# as scripts (prefix). The values specified here may be overridden
+# at configure-time with the --exec-prefix and --prefix options
+# to the "configure" script.
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+# The following definition can be set to non-null for special systems
+# like AFS with replication. It allows the pathnames used for installation
+# to be different than those used for actually reference files at
+# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
+# when installing files.
+INSTALL_ROOT =
+
+# extra includes for compiling
+INCLUDES = -I. -I$(prefix)/include
+
+# extra libs
+EXTRA_LIBS = @EXTRA_LIBS@
+
+# the full set of libraries for linking
+LIBS = -L.. -lfuntools $(EXTRA_LIBS) -lm
+
+# To change the compiler switches, for example to change from -O
+# to -g, change the following line:
+CFLAGS = @CFLAGS@
+
+# To add ld switches, change the following line:
+LDFLAGS = @LDFLAGS@
+
+# Some versions of make, like SGI's, use the following variable to
+# determine which shell to use for executing commands:
+SHELL = /bin/sh
+
+# extra modules added by configure.in to fix OS bugs
+EXTRA_OBJS = @EXTRA_OBJS@
+
+# There are just too many different versions of "install" around;
+# better to use the install-sh script that comes with the distribution,
+# which is slower but guaranteed to work.
+
+INSTALL = @srcdir@/install-sh -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+
+#----------------------------------------------------------------
+# The information below is modified by the configure script when
+# Makefile is generated from Makefile.in. You shouldn't normally
+# modify any of this stuff by hand.
+#----------------------------------------------------------------
+
+AC_FLAGS = @DEFS@
+RANLIB = @RANLIB@
+
+#----------------------------------------------------------------
+# The information below should be usable as is. The configure
+# script won't modify it and you shouldn't need to modify it
+# either.
+#----------------------------------------------------------------
+
+CC = @CC@
+
+CC_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
+
+DEPEND_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
+
+SRCS = evread.c evreplace.c evmerge.c evmerge2.c evcol.c evnext.c \
+ evcre.c imblank.c imtest.c wtest.c evtest.c mkev.c filt.c \
+ asc2fits.c bigfits.c
+
+OBJS = evread.o evreplace.o evmerge.o evmerge2.o evcol.o evnext.o \
+ evcre.o imblank.o imtest.o wtest.o evtest.o mkev.o filt.o \
+ asc2fits.o bigfits.o
+
+PROGS = evread evreplace evmerge evmerge2 evcol evnext evcre \
+ imblank imtest wtest evtest mkev filt asc2fits bigfits
+
+all: $(PROGS)
+
+evread: evread.o
+ $(CC) $(LDFLAGS) evread.o -o evread $(LIBS)
+
+evreplace: evreplace.o
+ $(CC) $(LDFLAGS) evreplace.o -o evreplace $(LIBS)
+
+evmerge: evmerge.o
+ $(CC) $(LDFLAGS) evmerge.o -o evmerge $(LIBS)
+
+evmerge2: evmerge2.o
+ $(CC) $(LDFLAGS) evmerge2.o -o evmerge2 $(LIBS)
+
+evcol: evcol.o
+ $(CC) $(LDFLAGS) evcol.o -o evcol $(LIBS)
+
+evnext: evnext.o
+ $(CC) $(LDFLAGS) evnext.o -o evnext $(LIBS)
+
+evcre: evcre.o
+ $(CC) $(LDFLAGS) evcre.o -o evcre $(LIBS)
+
+imblank: imblank.o
+ $(CC) $(LDFLAGS) imblank.o -o imblank $(LIBS)
+
+imtest: imtest.o
+ $(CC) $(LDFLAGS) imtest.o -o imtest $(LIBS)
+
+wtest: wtest.o
+ $(CC) $(LDFLAGS) wtest.o -o wtest $(LIBS)
+
+evtest: evtest.o
+ $(CC) $(LDFLAGS) evtest.o -o evtest $(LIBS)
+
+mkev: mkev.o
+ $(CC) $(LDFLAGS) mkev.o -o mkev $(LIBS)
+
+filt: filt.o
+ $(CC) $(LDFLAGS) filt.o -o filt $(LIBS)
+
+asc2fits: asc2fits.o
+ $(CC) $(LDFLAGS) asc2fits.o -o asc2fits $(LIBS)
+
+bigfits: bigfits.o
+ $(CC) $(LDFLAGS) bigfits.o -o bigfits $(LIBS)
+
+Makefile: Makefile.in
+ $(SHELL) ../config.status
+
+RM = rm -f
+
+clean:
+ $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
+ foo* *~ *.log \#* TAGS *.E a.out errors \
+ $(PROGS) $(TESTPROGS) \
+ gmon.out *.pg *.bak tview.fit tview.fits \
+ config.info config.log \
+ *fun*.out doc/*~
+ $(RM) -r autom4te.cache
+
+distclean: clean
+ $(RM) Makefile config.status config.cache config.log
+
+install:
+ @echo "Nothing to install in funtest"
+
+pclean:
+ $(RM) $(PROGS)
+
+depend:
+ makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
+
+evread.o: evread.c
+ $(CC) -c $(CC_SWITCHES) evread.c
+
+evreplace.o: evreplace.c
+ $(CC) -c $(CC_SWITCHES) evreplace.c
+
+evmerge.o: evmerge.c
+ $(CC) -c $(CC_SWITCHES) evmerge.c
+
+evmerge2.o: evmerge2.c
+ $(CC) -c $(CC_SWITCHES) evmerge2.c
+
+evcol.o: evcol.c
+ $(CC) -c $(CC_SWITCHES) evcol.c
+
+evnext.o: evnext.c
+ $(CC) -c $(CC_SWITCHES) evnext.c
+
+evcre.o: evcre.c
+ $(CC) -c $(CC_SWITCHES) evcre.c
+
+imblank.o: imblank.c
+ $(CC) -c $(CC_SWITCHES) imblank.c
+
+imtest.o: imtest.c
+ $(CC) -c $(CC_SWITCHES) imtest.c
+
+wtest.o: wtest.c
+ $(CC) -c $(CC_SWITCHES) wtest.c
+
+evtest.o: evtest.c
+ $(CC) -c $(CC_SWITCHES) evtest.c
+
+mkev.o: mkev.c
+ $(CC) -c $(CC_SWITCHES) mkev.c
+
+filt.o: filt.c
+ $(CC) -c $(CC_SWITCHES) filt.c
+
+asc2fits.o: asc2fits.c
+ $(CC) -c $(CC_SWITCHES) asc2fits.c
+
+bigfits.o: bigfits.c
+ $(CC) -c $(CC_SWITCHES) bigfits.c
+
+pure: evread.pure evreplace.pure evmerge.pure evmerge2.pure \
+ evcol.pure evnext.pure evcre.pure \
+ imblank.pure imtest.pure wtest.pure filt.pure \
+ evtest.pure asc2fits.pure bigfits.pure
+
+evread.pure: $(FUNLIB) evread.o
+ purify $(CC) $(LDFLAGS) evread.o -o evread.pure \
+ $(FUNLIB) $(LIBS)
+
+evreplace.pure: $(FUNLIB) evreplace.o
+ purify $(CC) $(LDFLAGS) evreplace.o -o evreplace.pure \
+ $(FUNLIB) $(LIBS)
+
+evmerge.pure: $(FUNLIB) evmerge.o
+ purify $(CC) $(LDFLAGS) evmerge.o -o evmerge.pure \
+ $(FUNLIB) $(LIBS)
+
+evmerge2.pure: $(FUNLIB) evmerge2.o
+ purify $(CC) $(LDFLAGS) evmerge2.o -o evmerge2.pure \
+ $(FUNLIB) $(LIBS)
+
+evcol.pure: $(FUNLIB) evcol.o
+ purify $(CC) $(LDFLAGS) evcol.o -o evcol.pure \
+ $(FUNLIB) $(LIBS)
+
+evnext.pure: $(FUNLIB) evnext.o
+ purify $(CC) $(LDFLAGS) evnext.o -o evnext.pure \
+ $(FUNLIB) $(LIBS)
+
+evcre.pure: $(FUNLIB) evcre.o
+ purify $(CC) $(LDFLAGS) evcre.o -o evcre.pure \
+ $(FUNLIB) $(LIBS)
+
+imblank.pure: $(FUNLIB) imblank.o
+ purify $(CC) $(LDFLAGS) imblank.o -o imblank.pure \
+ $(FUNLIB) $(LIBS)
+
+imtest.pure: $(FUNLIB) imtest.o
+ purify $(CC) $(LDFLAGS) imtest.o -o imtest.pure \
+ $(FUNLIB) $(LIBS)
+
+wtest.pure: $(FUNLIB) wtest.o
+ purify $(CC) $(LDFLAGS) wtest.o -o wtest.pure \
+ $(FUNLIB) $(LIBS)
+
+filt.pure: $(FUNLIB) filt.o
+ purify $(CC) $(LDFLAGS) filt.o -o filt.pure \
+ $(FUNLIB) $(LIBS)
+
+evtest.pure: $(FUNLIB) evtest.o
+ purify $(CC) $(LDFLAGS) evtest.o -o evtest.pure \
+ $(FUNLIB) $(LIBS)
+
+asc2fits.pure: $(FUNLIB) asc2fits.o
+ purify $(CC) $(LDFLAGS) asc2fits.o -o asc2fits.pure \
+ $(FUNLIB) $(LIBS)
+
+bigfits.pure: $(FUNLIB) bigfits.o
+ purify $(CC) $(LDFLAGS) bigfits.o -o bigfits.pure \
+ $(FUNLIB) $(LIBS)
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/funtest/arg3.inc b/funtools/funtest/arg3.inc
new file mode 100644
index 0000000..9c05967
--- /dev/null
+++ b/funtools/funtest/arg3.inc
@@ -0,0 +1 @@
+@t4.reg
diff --git a/funtools/funtest/asc2fits.c b/funtools/funtest/asc2fits.c
new file mode 100644
index 0000000..7644dce
--- /dev/null
+++ b/funtools/funtest/asc2fits.c
@@ -0,0 +1,85 @@
+/*
+ *
+ * asc2fits foo.fits < foo.ascii
+ *
+ * This is an example of generating a binary table from specific ASCII input.
+ * The more general case is much harder.
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <funtools.h>
+
+#define MAXREC 30
+
+typedef struct EvStruct{
+ int x, y, pha;
+ double time;
+} *Event, EventRec;
+
+int main(int argc, char **argv)
+{
+ int got, put;
+ char tbuf[SZ_LINE];
+ Fun fun;
+ EventRec events[MAXREC];
+ Event ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ if( argc < 2 ){
+ fprintf( stderr, "usage: %s oname\n", argv[0]);
+ exit(1);
+ }
+
+ /* open output file */
+ if( !(fun = FunOpen(argv[1],"w", NULL)) )
+ gerror(stderr, "Could not open the output file: %s\n", argv[1]);
+
+ /* set up the (hardwired) columns */
+ FunColumnSelect( fun, sizeof(EventRec), NULL,
+ "x", "J", "w", FUN_OFFSET(Event, x),
+ "y", "J", "w", FUN_OFFSET(Event, y),
+ "pha", "J", "w", FUN_OFFSET(Event, pha),
+ "time", "D", "w", FUN_OFFSET(Event, time),
+ NULL);
+
+ /* ignore first line, which is the header */
+ fgets(tbuf, SZ_LINE, stdin);
+
+ /* process data lines */
+ got = 0;
+ /* get next line */
+ while( fgets(tbuf, SZ_LINE, stdin) ){
+ /* ignore comments */
+ if( (*tbuf == '\n') || (*tbuf == '#') )
+ continue;
+ /* point to next buffer to fill */
+ ev = &events[got];
+ /* parse data record */
+ if(sscanf(tbuf, "%d %d %d %lf", &ev->x, &ev->y, &ev->pha, &ev->time) != 4)
+ break;
+ /* got another record */
+ got++;
+ /* flush this batch of records if necessary */
+ if( got == MAXREC ){
+ if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ got, put);
+ }
+ /* reset record counter */
+ got = 0;
+ }
+ }
+ /* final flush */
+ if( got ){
+ if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ got, put);
+ }
+ }
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/ascii2fits.c b/funtools/funtest/ascii2fits.c
new file mode 100644
index 0000000..048167c
--- /dev/null
+++ b/funtools/funtest/ascii2fits.c
@@ -0,0 +1,99 @@
+/*
+ * Solaris:
+ * gcc -o foo foo.c -I ../include -L../lib -lfuntools -lsocket -lnsl -ldl -lm
+ * Linux:
+ * gcc -o foo foo.c -I ../include -L../lib -lfuntools -lm
+ *
+ * asc2fits foo.fits < foo.ascii
+ *
+ * This is an example of generating a binary table from specific ASCII input.
+ * The more general case is much harder.
+ *
+ * input looks like this:
+ *
+ * 1 100.0 200.0 5.0 14 13 11 3.0
+ * 2 101.0 202.2 7.0 11 12 10 4.0
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <funtools.h>
+
+#define MAXREC 30
+
+typedef struct EvStruct{
+ int i1, i2, i3, i4;
+ double d1, d2, d3, d4;
+} *Event, EventRec;
+
+int main(int argc, char **argv)
+{
+ int got, put;
+ char tbuf[SZ_LINE];
+ Fun fun;
+ EventRec events[MAXREC];
+ Event ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ if( argc < 2 ){
+ fprintf( stderr, "usage: %s oname\n", argv[0]);
+ exit(1);
+ }
+
+ /* open output file */
+ if( !(fun = FunOpen(argv[1],"w", NULL)) )
+ gerror(stderr, "Could not open the output file: %s\n", argv[1]);
+
+ /* set up the (hardwired) columns */
+ FunColumnSelect( fun, sizeof(EventRec), NULL,
+ "i1", "J", "w", FUN_OFFSET(Event, i1),
+ "d1", "D", "w", FUN_OFFSET(Event, d1),
+ "d2", "D", "w", FUN_OFFSET(Event, d2),
+ "d3", "D", "w", FUN_OFFSET(Event, d3),
+ "i2", "J", "w", FUN_OFFSET(Event, i2),
+ "i3", "J", "w", FUN_OFFSET(Event, i3),
+ "i4", "J", "w", FUN_OFFSET(Event, i4),
+ "d4", "D", "w", FUN_OFFSET(Event, d4),
+ NULL);
+
+ /* process data lines */
+ got = 0;
+ /* get next line */
+ while( fgets(tbuf, SZ_LINE, stdin) ){
+ /* ignore comments */
+ if( (*tbuf == '\n') || (*tbuf == '#') )
+ continue;
+ /* point to next buffer to fill */
+ ev = &events[got];
+ /* parse data record */
+ if(sscanf(tbuf, "%d %lf %lf %lf %d %d %d %lf",
+ &ev->i1,
+ &ev->d1, &ev->d2, &ev->d3,
+ &ev->i2, &ev->i3, &ev->i4,
+ &ev->d4) != 8)
+ break;
+ /* got another record */
+ got++;
+ /* flush this batch of records if necessary */
+ if( got == MAXREC ){
+ if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ got, put);
+ }
+ /* reset record counter */
+ got = 0;
+ }
+ }
+ /* final flush */
+ if( got ){
+ if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ got, put);
+ }
+ }
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/avg b/funtools/funtest/avg
new file mode 100644
index 0000000..0ba7500
--- /dev/null
+++ b/funtools/funtest/avg
@@ -0,0 +1,2 @@
+cur->avg:E=(cur->x+cur->y)/2.0;fprintf(stdout,"%d %d %d %d %f %f\\n",cur->x,cur->y,cur->pha,cur->pi,cur->avg,cur->time);
+
diff --git a/funtools/funtest/bigfits.c b/funtools/funtest/bigfits.c
new file mode 100644
index 0000000..1762be4
--- /dev/null
+++ b/funtools/funtest/bigfits.c
@@ -0,0 +1,87 @@
+/*
+ *
+ * bigfits -- test large file creation
+ *
+ * gcc -g -o bigfits -I $HOME/include -L$HOME/lib bigfits.c -lfuntools
+ *
+ * gcc -g -o bigfits -I $HOME/include -L$HOME/lib bigfits.c -lfuntools -lm -lsocket -ldl -lnsl
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <funtools.h>
+
+#define MAXX 100
+#define MAXY 100
+#define MAXREC (MAXX*MAXY)
+
+typedef struct EvStruct{
+ unsigned int n;
+ short x, y;
+ unsigned short block;
+} *Event, EventRec;
+
+int main(int argc, char **argv)
+{
+ int i, j, n;
+ int put;
+ unsigned int total=0;
+ char *oname;
+ Fun fun;
+ EventRec events[MAXREC];
+ Event ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ if( argc < 3 ){
+ fprintf( stderr, "usage: %s oname n\n", argv[0]);
+ exit(1);
+ }
+ oname = argv[1];
+ n = atoi(argv[2]);
+
+ fprintf(stderr, "writing 10 bytes * %d groups of records * %d times\n",
+ MAXREC, n);
+
+ /* fill in the records */
+ for(j=0; j<MAXY; j++){
+ for(i=0; i<MAXX; i++){
+ ev = &events[j*MAXY+i];
+ ev->x = i;
+ ev->y = j;
+ ev->n = total++;
+ }
+ }
+
+ /* open output file */
+ if( !(fun = FunOpen(oname,"w", NULL)) )
+ gerror(stderr, "Could not open the output file: %s\n", oname);
+
+ /* set up the (hardwired) columns */
+ FunColumnSelect( fun, sizeof(EventRec), NULL,
+ "x", "I:0:99", "w", FUN_OFFSET(Event, x),
+ "y", "I:0:99", "w", FUN_OFFSET(Event, y),
+ "block","I", "w", FUN_OFFSET(Event, block),
+ "n", "J", "w", FUN_OFFSET(Event, n),
+ NULL);
+
+
+ /* write n * MAXREC records */
+ for(i=0; i<n; i++){
+ /* set block count */
+ for(j=0; j<MAXREC; j++){
+ ev = &events[j];
+ ev->block = i;
+ }
+ if( (put=FunTableRowPut(fun, events, MAXREC, 0, NULL)) != MAXREC ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ MAXREC, put);
+ }
+ }
+
+ FunClose(fun);
+
+ return(0);
+}
diff --git a/funtools/funtest/bpix.ev b/funtools/funtest/bpix.ev
new file mode 100644
index 0000000..7aecaa8
--- /dev/null
+++ b/funtools/funtest/bpix.ev
@@ -0,0 +1,3 @@
+SIMPLE = T / file does conform to FITS standard BITPIX = 8 / number of bits per data pixel NAXIS = 0 / number of data axes EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format defined in Astronomy andCOMMENT Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.COMMENT Contact the NASA Science Office of Standards and Technology for the COMMENT FITS Definition document #100 and other FITS information. LONGSTRN= 'OGIP 1.0' / The HEASARC Long String Convention may be used.COMMENT This FITS file may contain long string keyword values that are COMMENT continued over multiple keywords. The HEASARC convention uses the & COMMENT character at the end of each substring which is then continued COMMENT on the next keyword which has the name CONTINUE. ORIGIN = 'ASC ' / Source of FITS file CREATOR = 'acis_build_badpix - Version 1.2' / tool that created this output CHECKSUM= 'PopaQmmXPmmaPmmU' / HDU checksum updated 1999-12-28T03:42:04 DATASUM = ' ' DATE = '1999-12-27T22:42:04' / Date and time of file creation DATE-OBS= '1999-12-11T08:07:57' / Date and time of observation start DATE-END= '1999-12-11T10:41:09' / Date and time of observation stop TIMESYS = 'TT ' / Time system MJDREF = 5.0814000000000E+04 / MJD zero point for times TIMEZERO= 0.0000000000000E+00 / Clock correction TIMEUNIT= 's ' / Time unit CLOCKAPP= T / default TSTART = 6.1286877053705E+07 TSTOP = 6.1296068519518E+07 MISSION = 'AXAF ' / Mission TELESCOP= 'CHANDRA ' / Telescope INSTRUME= 'ACIS ' / Instrument OBS_ID = '550 ' / Observation id OBI_NUM = 0 / Obi number SEQ_NUM = '800058 ' / Sequence number STARTMJF= 66563 STOPMJF = 66563 STARTMNF= 57 STOPMNF = 57 END XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 36 / width of table in bytes NAXIS2 = 3 PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 6 / number of fields in each row EXTNAME = 'BADPIX ' / name of this binary table extension EXTVER = 0 HDUNAME = 'BADPIX0 ' / ASCDM block name TTYPE1 = 'SHAPE ' / region shape TFORM1 = '16A ' / format of field TTYPE2 = 'COMPONENT' / Component number TFORM2 = '1I ' / format of field TLMIN2 = 0 TLMAX2 = 36 LONGSTRN= 'OGIP 1.0' / The HEASARC Long String Convention may be used.COMMENT This FITS file may contain long string keyword values that are COMMENT continued over multiple keywords. The HEASARC convention uses the & COMMENT character at the end of each substring which is then continued COMMENT on the next keyword which has the name CONTINUE. MTYPE1 = 'CHIP ' MFORM1 = 'CHIPX,CHIPY' TTYPE3 = 'CHIPX ' / CHIP X location TFORM3 = '2I ' / format of field TUNIT3 = 'pixel ' TLMIN3 = 1 TLMAX3 = 1024 TTYPE4 = 'CHIPY ' / CHIP Y location TFORM4 = '2I ' / format of field TUNIT4 = 'pixel ' TLMIN4 = 1 TLMAX4 = 1024 TTYPE5 = 'TIME ' / Time pixel went bad TFORM5 = '1D ' / format of field TUNIT5 = 's ' TTYPE6 = 'STATUS ' / Badpixel status code TFORM6 = '16X ' / format of field TUNIT6 = 'coded ' CONTENT = 'BADPIX ' HDUCLASS= 'ASC ' HDUCLAS1= 'REGION ' ORIGIN = 'ASC ' / Source of FITS file CREATOR = 'acis_build_badpix - Version 1.2' / tool that created this output REVISION= 1 / Processing version of data ASCDSVER= 'R4CU4UPD4' / ASCDS version number CHECKSUM= '77ZWB5ZT95ZTA5ZT' / HDU checksum updated 1999-12-28T03:42:04 DATASUM = '2927251180' / data unit checksum updated 1999-12-28T03:42:04 DATE = '1999-12-27T22:42:04' / Date and time of file creation DATE-OBS= '1999-12-11T07:30:44' / Date and time of observation start DATE-END= '1999-12-11T10:47:37' / Date and time of observation stop TIMESYS = 'TT ' / Time system MJDREF = 5.0814000000000E+04 / MJD zero point for times TIMEZERO= 0.0000000000000E+00 / Clock correction TIMEUNIT= 's ' / Time unit TIMEREF = 'LOCAL ' / Time reference (barycenter/local) TASSIGN = 'SATELLITE' / Time assigned by clock CLOCKAPP= T / default TIERRELA= 1.0000000000000E-09 / default TIERABSO= 1.0000000000000E-03 / default TIMVERSN= 'ASC-FITS-2' / Timing system definition TSTART = 6.1284644870344E+07 / Observation start time TSTOP = 6.1296457995772E+07 / Observation end time TIMEPIXR= 5.0000000000000E-01 / default MISSION = 'AXAF ' / Mission TELESCOP= 'CHANDRA ' / Telescope INSTRUME= 'ACIS ' / Instrument DETNAM = 'ACIS-01236' / Detector GRATING = 'NONE ' / Grating OBJECT = 'A2261 ' / Source name TITLE = 'DETERMINATION OF H0/Q0' / Proposal title OBSERVER= ' Leon VanSpeybroeck' / Principal investigator OBS_ID = '550 ' / Observation id OBI_NUM = 0 / Obi number SEQ_NUM = '800058 ' / Sequence number SIM_X = -7.8090834371673E-01 / SIM focus pos (mm) SIM_Y = 0.0000000000000E+00 / SIM orthogonal axis pos (mm) SIM_Z = -2.2578551408009E+02 / SIM translation stage pos (mm) DEFOCUS = 1.4398718632593E-03 / SIM defocus (mm) FOC_LEN = 1.0061620000000E+04 / HRMA focal length (mm) OBS_MODE= 'POINTING' / Observation mode DATAMODE= 'VFAINT ' / Data mode RA_NOM = 2.6067999657378E+02 / Nominal RA DEC_NOM = 3.2121556687915E+01 / Nominal Dec ROLL_NOM= 3.5702297219635E+02 / Nominal Roll EQUINOX = 2.0000000000000E+03 / default RADECSYS= 'ICRS ' / default DATACLAS= 'OBSERVED' / default READMODE= 'TIMED ' CCD_ID = 0 FEP_ID = 0 STARTBEP= 3828670882 STOPBEP = 452862530 HISTNUM = 40 HISTORY TOOL :acis_build_badpix 1999-12-27T22:42:04 ASC00001HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00002HISTORY CONT :08n823/input/acisf061286877N001_pbk0.fits[time=61284644.ASC00003HISTORY CONT :8703440:61296457.9957720] ASC00004HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00005HISTORY CONT :08n823/input/acisf061286877N001_1_berr0.fits[time=612846ASC00006HISTORY CONT :44.8703440:61296457.9957720] ASC00007HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00008HISTORY CONT :08n823/input/acisf061286877N001_2_berr0.fits[time=612846ASC00009HISTORY CONT :44.8703440:61296457.9957720] ASC00010HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00011HISTORY CONT :08n823/input/acisf061286877N001_3_berr0.fits[time=612846ASC00012HISTORY CONT :44.8703440:61296457.9957720] ASC00013HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00014HISTORY CONT :08n823/input/acisf061285682N001_1_bias0.fits ASC00015HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00016HISTORY CONT :08n823/input/acisf061285682N001_2_bias0.fits ASC00017HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00018HISTORY CONT :08n823/input/acisf061285682N001_3_bias0.fits ASC00019HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00020HISTORY CONT :08n823/input/acisf061285682N001_4_bias0.fits ASC00021HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00022HISTORY CONT :08n823/input/acisf061285682N001_5_bias0.fits ASC00023HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00024HISTORY CONT :08n823/input/acisf061286877N001_1_evt0.fits[time=6128464ASC00025HISTORY CONT :4.8703440:61296457.9957720] ASC00026HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00027HISTORY CONT :08n823/input/acisf061286877N001_2_evt0.fits[time=6128464ASC00028HISTORY CONT :4.8703440:61296457.9957720] ASC00029HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00030HISTORY CONT :08n823/input/acisf061286877N001_3_evt0.fits[time=6128464ASC00031HISTORY CONT :4.8703440:61296457.9957720] ASC00032HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00033HISTORY CONT :08n823/input/acisf061286877N001_4_evt0.fits[time=6128464ASC00034HISTORY CONT :4.8703440:61296457.9957720] ASC00035HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00036HISTORY CONT :08n823/input/acisf061286877N001_5_evt0.fits[time=6128464ASC00037HISTORY CONT :4.8703440:61296457.9957720] ASC00038HISTORY PARM :outfile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_062634ASC00039HISTORY CONT :908n823/output/acisf00550_000N001_bpix1.fits ASC00040END rectangle
+point
diff --git a/funtools/funtest/cat.ls b/funtools/funtest/cat.ls
new file mode 100644
index 0000000..edad0d1
--- /dev/null
+++ b/funtools/funtest/cat.ls
@@ -0,0 +1,3 @@
+RA_N DEC_N
+---- -----
+216.103 35.665
diff --git a/funtools/funtest/cat.txt b/funtools/funtest/cat.txt
new file mode 100644
index 0000000..f3f9f90
--- /dev/null
+++ b/funtools/funtest/cat.txt
@@ -0,0 +1,102 @@
+ MAG_R ERR_R AMAG_R AERR_R RA_R DEC_R AWORLD_R BWORLD_R THETA_R ELONG_R ELLIP_R FLAGS IMAFLAGS_R CLASS_R DFLAG_R ITFLAG_R MAG_I ERR_I AMAG_I AERR_I RA_I DEC_I AWORLD_I BWORLD_I THETA_I ELONG_I ELLIP_I FLAGS_I IMAFLAGS_I CLASS_I DFLAG_I ITFLAG_I MAG_B ERR_B AMAG_B AERR_B RA_B DEC_B AWORLD_B BWORLD_B THETA_B ELONG_B ELLIP_B FLAGS_B IMAFLAGS_B CLASS_B DFLAG_B ITFLAG_B MAG_K ERR_K AMAG_K AERR_K RA_K DEC_K AWORLD_K BWORLD_K THETA_K ELONG_K ELLIP_K FLAGS_K IMAFLAGS_K CLASS_K DFLAG_K ITFLAG_K NDWFS_NAME RA_N DEC_N
+--------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- ------------ --------------------- ---------------------
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.13510000 0.26310000 18.43120000 0.15600000 216.09715930 35.57213060 0.00007240 0.00004195 19.60 1.71600000 0.41700000 0 2 0.73 0 0 'NDWFS_J142' 216.09708333 35.57194444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.76660000 0.29910000 17.34280000 1474.41580000 216.09817510 35.59888400 0.00010407 0.00005839 2.60 1.78100000 0.43900000 0 2 0.72 0 0 'NDWFS_J142' 216.09791667 35.59861111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.36650000 0.25000000 17.76580000 0.30720000 216.09902060 35.21971580 0.00008169 0.00005793 28.60 1.40700000 0.28900000 0 2 0.85 0 0 'NDWFS_J142' 216.09875000 35.21944444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.28660000 0.15500000 16.58530000 733.86490000 216.09955970 35.28452600 0.00011305 0.00006754 59.60 1.68300000 0.40600000 2 0 0.85 0 0 'NDWFS_J142' 216.09916667 35.28444444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.09320000 0.20880000 18.30430000 0.21740000 216.09943570 35.29183850 0.00007158 0.00004246 -15.90 1.69500000 0.41000000 0 0 0.63 0 0 'NDWFS_J142' 216.09916667 35.29166667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.37140000 0.17870000 18.16770000 0.22990000 216.09971980 35.01669160 0.00011426 0.00004636 27.00 2.43500000 0.58900000 0 2 0.80 0 0 'NDWFS_J142' 216.09958333 35.01666667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.31570000 0.21340000 17.68130000 0.25000000 216.09999260 35.19214480 0.00010302 0.00006189 -61.70 1.65500000 0.39600000 0 2 0.63 0 0 'NDWFS_J142' 216.09958333 35.19194444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.36080000 0.16570000 16.22570000 0.15710000 216.09988510 35.19502390 0.00014744 0.00009985 -81.70 1.47300000 0.32100000 0 2 0.93 0 0 'NDWFS_J142' 216.09958333 35.19500000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.88030000 0.25600000 17.59980000 0.39100000 216.09973330 35.19576170 0.00008751 0.00007457 -62.50 1.17100000 0.14600000 0 3 0.88 0 0 'NDWFS_J142' 216.09958333 35.19555556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.39170000 0.13310000 16.16290000 0.14230000 216.09975060 35.28013580 0.00014365 0.00009449 8.40 1.51700000 0.34100000 0 0 0.92 0 0 'NDWFS_J142' 216.09958333 35.28000000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.60370000 0.23180000 17.55830000 0.32320000 216.09968520 35.28498600 0.00010224 0.00004155 -88.90 2.46000000 0.59300000 3 0 0.70 0 0 'NDWFS_J142' 216.09958333 35.28472222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.97840000 0.27470000 18.23860000 0.25370000 216.10010750 35.18600510 0.00007251 0.00004229 -17.80 1.72500000 0.42000000 0 2 0.69 0 0 'NDWFS_J142' 216.10000000 35.18583333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.81420000 0.28980000 17.70800000 0.27940000 216.10025590 35.29139420 0.00007329 0.00005317 -45.70 1.37800000 0.27400000 0 0 0.87 0 0 'NDWFS_J142' 216.10000000 35.29138889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.08290000 0.23650000 17.94080000 0.28240000 216.10065710 35.57122560 0.00007076 0.00004297 -18.30 1.65500000 0.39600000 0 2 0.71 0 0 'NDWFS_J142' 216.10041667 35.57111111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 12.37600000 0.01680000 12.37090000 0.01760000 216.10124780 35.19885350 0.00095540 0.00038518 73.60 2.51600000 0.60300000 0 2 0.03 0 0 'NDWFS_J142' 216.10083333 35.19861111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.24370000 0.11330000 17.42650000 1592.59350000 216.10083490 35.29064640 0.00012447 0.00005848 -19.20 2.15100000 0.53500000 0 0 0.91 0 0 'NDWFS_J142' 216.10083333 35.29055556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.83000000 0.32300000 17.70360000 0.26520000 216.10133800 34.95826030 0.00007250 0.00005436 43.70 1.33400000 0.25000000 0 2 0.85 0 0 'NDWFS_J142' 216.10125000 34.95805556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.77190000 0.28620000 17.87650000 0.29170000 216.10144990 35.20173430 0.00007207 0.00004259 72.10 1.70300000 0.41300000 2 3 0.73 0 0 'NDWFS_J142' 216.10125000 35.20166667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.26210000 0.17380000 16.75050000 0.19380000 216.10134820 35.29164700 0.00017490 0.00005157 8.90 3.34700000 0.70100000 0 0 0.85 0 0 'NDWFS_J142' 216.10125000 35.29138889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.70860000 0.22900000 17.11050000 1374.67970000 216.10137310 35.30623130 0.00010474 0.00004786 -68.70 2.16400000 0.53800000 0 0 0.92 0 0 'NDWFS_J142' 216.10125000 35.30611111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.94260000 0.14750000 15.97520000 966.21800000 216.10130350 35.55450960 0.00014293 0.00008309 68.80 1.73200000 0.42300000 0 2 0.92 0 0 'NDWFS_J142' 216.10125000 35.55444444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.22880000 0.17410000 16.26120000 0.14830000 216.10193030 35.20218600 0.00019437 0.00007964 31.90 2.41700000 0.58600000 3 3 0.76 0 0 'NDWFS_J142' 216.10166667 35.20194444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.78960000 0.23430000 17.80860000 0.22620000 216.10204950 35.30292160 0.00008392 0.00004605 2.70 1.82100000 0.45100000 0 0 0.83 0 0 'NDWFS_J142' 216.10166667 35.30277778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.35260000 0.12330000 17.55090000 0.27000000 216.10175750 35.47289140 0.00009205 0.00008139 26.80 1.13000000 0.11500000 0 2 0.85 0 0 'NDWFS_J142' 216.10166667 35.47277778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 16.95920000 0.14380000 16.23670000 0.14920000 216.10247110 35.20260660 0.00020080 0.00012157 70.50 1.66200000 0.39800000 2 3 0.13 0 0 'NDWFS_J142' 216.10208333 35.20250000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.57470000 0.25850000 17.33640000 0.23240000 216.10228640 35.28054270 0.00010388 0.00004719 0.60 2.20200000 0.54600000 0 0 0.68 0 0 'NDWFS_J142' 216.10208333 35.28027778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.52360000 0.14640000 18.22170000 0.26380000 216.10217080 35.38430610 0.00007025 0.00004248 -71.50 1.64500000 0.39200000 0 2 0.81 0 0 'NDWFS_J142' 216.10208333 35.38416667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.08400000 0.14870000 17.09030000 0.22160000 216.10220130 35.55488380 0.00013776 0.00006684 11.50 2.04900000 0.51200000 0 2 0.94 0 0 'NDWFS_J142' 216.10208333 35.55472222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.26500000 0.11760000 17.96750000 0.17790000 216.10282030 34.73210690 0.00009024 0.00007888 14.50 1.14300000 0.12500000 0 2 0.91 0 0 'NDWFS_J142' 216.10250000 34.73194444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.11960000 0.17590000 17.55840000 0.22260000 216.10253660 35.19448360 0.00009417 0.00006897 1.40 1.36600000 0.26800000 0 3 0.89 0 0 'NDWFS_J142' 216.10250000 35.19444444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.47060000 0.27860000 17.62350000 0.30520000 216.10260060 35.28174800 0.00009675 0.00004524 82.60 2.15100000 0.53500000 0 0 0.79 0 0 'NDWFS_J142' 216.10250000 35.28166667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.40760000 0.17460000 17.59890000 0.26890000 216.10303540 34.29395850 0.00007052 0.00006489 -77.60 1.08600000 0.07900000 0 2 0.79 0 0 'NDWFS_J142' 216.10291667 34.29388889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.18680000 0.18120000 17.73390000 0.28110000 216.10303900 35.29419470 0.00010160 0.00006930 1.20 1.46600000 0.31800000 0 0 0.92 0 0 'NDWFS_J142' 216.10291667 35.29416667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.41820000 0.10170000 23.43920000 0.15290000 216.10321970 35.55618100 0.00029317 0.00009247 -4.20 3.19800000 0.68700000 17 1 0.97 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.55611111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.31060000 0.21270000 25.12690000 1.02380000 216.10299530 35.56239140 0.00020489 0.00003580 1.10 5.72400000 0.82500000 17 0 0.35 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.56222222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.36580000 0.12050000 22.55440000 0.13450000 216.10313020 35.56361750 0.00026410 0.00011304 2.80 2.33300000 0.57100000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.56361111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.11010000 0.09090000 23.13420000 0.13180000 216.10314990 35.56544160 0.00027453 0.00012558 1.70 2.18500000 0.54200000 17 1 0.09 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.56527778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.62550000 0.09970000 24.29360000 0.36680000 216.10314350 35.57564030 0.00025492 0.00007567 1.00 3.37000000 0.70300000 17 1 0.16 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.57555556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 25.60140000 0.31890000 24.44070000 0.29190000 216.10302050 35.57653650 0.00020652 0.00002067 1.10 9.99300000 0.90000000 17 0 0.88 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.57638889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.08790000 0.08890000 23.08530000 0.19240000 216.10310940 35.57869120 0.00027392 0.00013129 1.60 2.08600000 0.52100000 17 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.57861111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.82430000 0.13120000 23.47660000 0.13540000 216.10312650 35.58766990 0.00025613 0.00007497 -0.40 3.42600000 0.70800000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.58750000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.22230000 0.09760000 22.96560000 0.10900000 216.10316590 35.58909380 0.00029230 0.00011063 0.30 2.64500000 0.62200000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.58888889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.22480000 0.13560000 24.11360000 0.18620000 216.10302890 35.59523230 0.00020927 0.00005509 2.00 3.79100000 0.73600000 17 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.59500000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.56600000 0.11270000 23.58960000 0.16480000 216.10315520 35.59752790 0.00025332 0.00009267 1.70 2.73200000 0.63400000 17 1 0.18 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.59750000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.49880000 0.10940000 23.40960000 0.14400000 216.10316850 35.60196610 0.00026664 0.00009218 -0.20 2.89800000 0.65500000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60194444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.53500000 0.12240000 23.04380000 0.21500000 216.10312040 35.60639190 0.00023835 0.00011405 -0.50 2.09200000 0.52200000 19 1 0.18 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60638889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.99450000 0.15520000 23.61930000 0.20710000 216.10313570 35.60744430 0.00022686 0.00007500 2.30 3.01900000 0.66900000 17 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60722222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.76650000 0.11670000 23.54120000 0.14370000 216.10314710 35.60886990 0.00024778 0.00007731 0.80 3.20700000 0.68800000 17 1 0.89 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60861111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.49590000 0.14670000 23.52370000 0.12510000 216.10307940 35.61394420 0.00023171 0.00003898 2.20 5.90800000 0.83100000 17 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.61388889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.16960000 0.09640000 23.21730000 0.13990000 216.10323210 35.61785280 0.00026396 0.00012617 -0.60 2.09500000 0.52300000 1 1 0.92 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.61777778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.64530000 0.11790000 23.04330000 0.18170000 216.10319490 35.62030510 0.00023856 0.00009605 4.40 2.47600000 0.59600000 1 0 0.26 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62027778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 99.00000000 99.00000000 99.00000000 99.00000000 216.10325720 35.62181370 0.00028358 0.00022798 0.10 1.24400000 0.19600000 19 1 0.79 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62166667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.02220000 0.16710000 23.88700000 0.20330000 216.10315180 35.62499450 0.00021952 0.00007597 3.10 2.88200000 0.65300000 1 0 0.07 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62472222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.17360000 0.10480000 23.98670000 0.14540000 216.10322180 35.62849220 0.00022768 0.00003558 1.10 6.39900000 0.84400000 1 0 0.95 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62833333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.02630000 0.11140000 23.41120000 0.17920000 216.10325010 35.63524110 0.00022449 0.00017035 -3.30 1.31900000 0.24200000 1 0 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.63500000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.19860000 0.18480000 23.94080000 0.23400000 216.10326620 35.63740820 0.00023895 0.00005740 0.30 4.17200000 0.76000000 1 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.63722222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.49890000 0.08490000 23.30410000 0.22340000 216.10330180 35.63841660 0.00025107 0.00017619 -9.60 1.42800000 0.30000000 3 1 0.12 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.63833333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.74910000 0.18300000 24.03500000 0.26900000 216.10361760 35.47882210 0.00020518 0.00003580 1.10 5.73200000 0.82600000 16 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.47861111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.96240000 0.15880000 23.71530000 0.16280000 216.10372720 35.48756390 0.00023210 0.00007567 1.90 3.06400000 0.67400000 16 0 0.48 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.48750000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.92660000 0.14040000 23.70900000 0.16070000 216.10374100 35.49100090 0.00023398 0.00007437 1.00 3.14700000 0.68200000 16 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.49083333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.86570000 0.06120000 23.68340000 0.22330000 216.10364530 35.49744030 0.00021667 0.00003566 0.40 6.10400000 0.83600000 17 0 0.70 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.49722222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.58050000 0.13310000 23.28820000 0.13010000 216.10372660 35.50177440 0.00026123 0.00009974 0.80 2.62000000 0.61800000 17 1 0.07 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50166667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.08490000 0.13320000 23.94860000 0.17420000 216.10367110 35.50621720 0.00024243 0.00005758 1.00 4.21100000 0.76300000 17 0 0.90 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50611111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.32560000 0.19650000 23.72540000 0.21320000 216.10359650 35.50692520 0.00021648 0.00005599 -0.70 3.88400000 0.74300000 17 0 0.98 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50666667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.88050000 0.13250000 24.11280000 0.23220000 216.10370050 35.50897060 0.00024864 0.00007279 0.50 3.42000000 0.70800000 17 1 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50888889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.66070000 0.10920000 23.57340000 0.15250000 216.10367890 35.51212370 0.00027172 0.00007467 0.50 3.64400000 0.72600000 17 1 0.16 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51194444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.66830000 0.15050000 23.43420000 0.22860000 216.10364030 35.51327390 0.00026487 0.00007971 3.20 3.31100000 0.69800000 17 1 0.06 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51305556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.12550000 0.16470000 23.70210000 0.25750000 216.10371870 35.51424200 0.00026735 0.00005722 1.10 4.67400000 0.78600000 17 1 0.92 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51416667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.17270000 0.09700000 22.93480000 0.16450000 216.10363500 35.51761910 0.00027153 0.00012403 2.50 2.18700000 0.54300000 17 1 0.15 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51750000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.61090000 0.14550000 22.83820000 0.16840000 216.10362750 35.51903430 0.00024619 0.00009057 0.50 2.72100000 0.63200000 17 1 0.65 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51888889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.55040000 0.12990000 23.24900000 0.21390000 216.10366180 35.52225940 0.00027373 0.00009497 3.90 2.87200000 0.65200000 17 1 0.88 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.52222222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.12380000 0.10220000 22.45450000 0.14550000 216.10364590 35.52302200 0.00025053 0.00015179 0.30 1.65100000 0.39400000 17 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.52277778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.58830000 0.16370000 24.15500000 0.16710000 216.10361070 35.53003170 0.00022442 0.00003578 1.10 6.27300000 0.84100000 17 0 0.89 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.53000000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.08160000 0.04220000 23.75330000 0.16300000 216.10358030 35.53074400 0.00022205 0.00007499 0.70 2.96300000 0.66300000 17 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.53055556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.87280000 0.16510000 23.60900000 0.22120000 216.10363410 35.53231760 0.00021965 0.00007813 -0.00 2.81600000 0.64500000 17 0 0.95 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.53222222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.11000000 0.09720000 22.98580000 0.11830000 216.10361290 35.54364710 0.00025632 0.00013770 1.50 1.86100000 0.46300000 17 1 0.93 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.54361111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 20.82180000 0.02080000 20.71470000 0.02680000 216.10370450 35.56077810 0.00048886 0.00025272 -22.50 1.95000000 0.48700000 17 1 0.03 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.56055556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.58030000 0.00130000 17.36890000 0.00110000 216.10334380 35.62319770 0.00033090 0.00020283 3.20 1.63000000 0.38700000 3 1 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.62305556
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.40610000 0.14120000 23.81090000 0.12910000 216.10344510 35.65299180 0.00024644 0.00003580 1.10 6.88600000 0.85500000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.65277778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.39090000 0.10870000 23.11050000 0.19470000 216.10343160 35.65442470 0.00026089 0.00010770 0.80 2.42300000 0.58700000 1 1 0.95 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.65416667
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.71920000 0.17780000 24.39350000 0.35580000 216.10338010 35.65957820 0.00020560 0.00003580 1.10 5.74400000 0.82600000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.65944444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.86350000 0.13780000 23.92020000 0.28380000 216.10346210 35.66023030 0.00025436 0.00007504 1.70 3.38600000 0.70500000 1 0 0.90 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66000000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.50600000 0.12360000 23.18130000 0.17580000 216.10359330 35.66095120 0.00028251 0.00010121 -5.60 2.81400000 0.64500000 1 1 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66083333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.92180000 0.14770000 23.51650000 0.25780000 216.10350050 35.66509810 0.00024057 0.00007825 2.00 3.07000000 0.67400000 1 0 0.36 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66500000
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 25.21930000 0.20080000 24.48120000 0.23730000 216.10346590 35.66541600 0.00022758 0.00002067 1.10 11.01200000 0.90900000 1 0 0.98 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66527778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.61580000 0.08470000 22.76280000 0.16630000 216.10369620 35.66742190 0.00033435 0.00018691 2.50 1.78800000 0.44100000 1 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66722222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.26560000 0.10900000 23.24260000 0.14060000 216.10358100 35.67086270 0.00025350 0.00012662 0.00 2.00400000 0.50100000 1 0 0.12 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.67083333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.69010000 0.20430000 23.92260000 0.23680000 216.10359980 35.67547700 0.00023513 0.00003578 0.50 6.60000000 0.84800000 1 0 0.97 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.67527778
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.31490000 0.15840000 24.63290000 0.58400000 216.10369000 35.68118050 0.00021703 0.00005610 3.00 3.85200000 0.74000000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68111111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.18480000 0.11440000 24.18600000 0.18480000 216.10368830 35.68149850 0.00025489 0.00003550 1.60 7.15000000 0.86000000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68138889
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.45920000 0.11990000 23.09380000 0.19520000 216.10369210 35.68593560 0.00035488 0.00009713 5.40 3.62100000 0.72400000 3 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68583333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.98810000 0.11340000 23.74490000 0.24360000 216.10372860 35.68848010 0.00023211 0.00005613 1.00 4.13600000 0.75800000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68833333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.38050000 0.16340000 17.80220000 0.18380000 216.10403290 34.19493450 0.00007308 0.00004088 -71.00 1.77600000 0.43700000 0 2 0.75 0 0 'NDWFS_J142' 216.10375000 34.19472222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.17280000 0.15380000 18.63080000 0.21720000 216.10389610 34.91720860 0.00007287 0.00004136 20.90 1.75200000 0.42900000 0 2 0.61 0 0 'NDWFS_J142' 216.10375000 34.91694444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.80670000 0.21630000 24.14450000 0.28360000 216.10413590 35.44713750 0.00015807 0.00005502 1.10 2.87300000 0.65200000 16 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.44694444
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.89530000 0.22220000 24.11230000 0.20340000 216.10409950 35.44870530 0.00015264 0.00005273 1.00 2.89600000 0.65500000 16 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.44861111
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.06380000 0.12850000 23.90920000 0.17120000 216.10410290 35.44987430 0.00021776 0.00006832 1.30 3.18700000 0.68600000 24 1 0.12 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.44972222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.38380000 0.00740000 19.39050000 0.00840000 216.10411610 35.46110670 0.00045521 0.00037135 88.50 1.22600000 0.18400000 27 1 0.08 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 16.68110000 0.08940000 16.44180000 0.13030000 216.10422860 35.46108030 0.00018791 0.00017880 75.50 1.05200000 0.04900000 0 4 0.01 0 0 'NDWFS_J142' 216.10375000 35.46083333
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.99500000 0.06540000 24.43990000 0.39150000 216.10381860 35.46729200 0.00019538 0.00003545 2.00 5.48700000 0.81800000 16 0 0.96 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.46722222
+ 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.34970000 0.11290000 24.80620000 0.58570000 216.10377030 35.47398820 0.00031837 0.00012216 0.80 2.60800000 0.61600000 19 1 0.22 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.47388889
diff --git a/funtools/funtest/comm b/funtools/funtest/comm
new file mode 100644
index 0000000..4f49e6a
--- /dev/null
+++ b/funtools/funtest/comm
@@ -0,0 +1,15 @@
+ double a; # comment
+ # comment
+ {
+ struct foo{
+ double sa;
+ } foo;
+ if( cur->x:D == cur->y:D ) continue;
+ a = cur->x;
+ /* comment */
+ foo.sa = a;
+ b = (int)a;
+ cur->x = cur->y;
+ cur->y = a;
+ cur->avg:E = (cur->x+cur->y)/2.0;
+ }
diff --git a/funtools/funtest/conf.h.in b/funtools/funtest/conf.h.in
new file mode 100644
index 0000000..e60ee1d
--- /dev/null
+++ b/funtools/funtest/conf.h.in
@@ -0,0 +1,56 @@
+/* Define as 1 if you have string.h */
+#undef HAVE_STRING_H
+
+/* Define as 1 if you have stdlib.h */
+#undef HAVE_STDLIB_H
+
+/* Define as 1 if you have malloc.h */
+#undef HAVE_MALLOC_H
+
+/* Define as 1 if you have unistd.h */
+#undef HAVE_UNISTD_H
+
+/* Define as 1 if you have getopt.h */
+#undef HAVE_GETOPT_H
+
+/* Define as 1 if you have values.h */
+#undef HAVE_VALUES_H
+
+/* Define as 1 if you have dlfcn.h */
+#undef HAVE_DLFCN_H
+
+/* Define as 1 if you have sys/un.h */
+#undef HAVE_SYS_UN_H
+
+/* Define as 1 if you have sys/shm.h */
+#undef HAVE_SYS_SHM_H
+
+/* Define as 1 if you have sys/mman.h */
+#undef HAVE_SYS_MMAN_H
+
+/* Define as 1 if you have sys/ipc.h */
+#undef HAVE_SYS_IPC_H
+
+/* Define as 1 if you have socklen_t */
+#undef HAVE_SOCKLEN_T
+
+/* Define as 1 if you have strchr */
+#undef HAVE_STRCHR
+
+/* Define as 1 if you have memcpy */
+#undef HAVE_MEMCPY
+
+/* Define as 1 if you have snprintf */
+#undef HAVE_SNPRINTF
+
+/* Define as 1 if you have Tcl */
+#undef HAVE_TCL
+
+/* Define as 1 if you have Xt */
+#undef HAVE_XT
+
+/* Define as 1 if you are running Cygwin. */
+#undef HAVE_CYGWIN
+
+/* Define as 1 if you are running MinGW. */
+#undef HAVE_MINGW32
diff --git a/funtools/funtest/evcol.c b/funtools/funtest/evcol.c
new file mode 100644
index 0000000..5b6a4cb
--- /dev/null
+++ b/funtools/funtest/evcol.c
@@ -0,0 +1,130 @@
+/*
+ *
+ * evcol.c -- example program for processing all extensions and adding a
+ * column to the binary tables
+ *
+ */
+#include <funtools.h>
+#include <word.h>
+
+#define MAXROW 8192
+
+typedef struct evstruct{
+ char shape[17];
+ int mycol;
+} *Ev, EvRec;
+
+int main (int argc, char **argv)
+{
+ int i, got;
+ int idx;
+ int tlmax;
+ int ext=1;
+ int total=1;
+ int haveshape=0;
+ char *s[3];
+ char tbuf[SZ_LINE];
+ Fun fun, fun2;
+ Ev ebuf, ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* make sure we have minimal arguments */
+ if( argc < 3 )
+ gerror(stderr, "usage: %s iname oname\n", argv[0]);
+
+ /* open a new output FITS file */
+ if( !(fun2 = FunOpen(argv[2], "w", NULL)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* process each input extension in turn */
+ for(ext=0; ;ext++){
+ /* get new extension name */
+ sprintf(tbuf, "%s[%d]", argv[1], ext);
+ /* open it -- if we cannot open it, we are done */
+ if( !(fun=FunOpen(tbuf, "r", NULL)) )
+ break;
+
+ /* make the new extension the reference handle for the output file */
+ FunInfoPut(fun2, FUN_IFUN, &fun, 0);
+
+ /* if its not a binary table, just write it out */
+ for(i=0; i<=2; i++) s[i] = NULL;
+ if( !(s[0]=FunParamGets(fun, "XTENSION", 0, NULL, &got)) ||
+ strcmp(s[0], "BINTABLE")){
+ if( s[0] ) free(s[0]);
+ FunFlush(fun2, "copy=reference");
+ FunClose(fun);
+ continue;
+ }
+ else{
+ if( (s[1]=FunParamGets(fun, "EXTNAME", 0, NULL, &got)) ){
+ fprintf(stdout, "processing %s", s[1]);
+ if( (s[2]=FunParamGets(fun, "HDUNAME", 0, NULL, &got)) )
+ fprintf(stdout, " %s", s[2]);
+ fprintf(stdout, "\n");
+ }
+ }
+ for(i=0; i<=2; i++) if( s[i] ) free(s[i]);
+
+ /* select columns from this new extension for merging */
+ /* we have some special code to test various bugs with bpix.fits */
+ if( (idx = FunColumnLookup(fun, "SHAPE", 0,
+ NULL, NULL, NULL, NULL, NULL, NULL)) ){
+ haveshape = 1;
+ FunColumnSelect(fun, sizeof(EvRec), "merge=update",
+ "SHAPE", "16A", "rw", FUN_OFFSET(Ev, shape),
+ "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
+ NULL);
+ }
+ else{
+ FunColumnSelect(fun, sizeof(EvRec), "merge=update",
+ "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
+ NULL);
+ }
+
+ /* we have some special code to test various bugs with bpix.fits */
+ /* we need to increase tlmax value of the "component" column */
+ if( (idx = FunColumnLookup(fun, "COMPONENT", 0,
+ NULL, NULL, NULL, NULL, NULL, NULL)) ){
+ if( (tlmax=FunParamGeti(fun, "TLMAX", idx, -1, &got)) && got )
+ FunParamPuti(fun2, "TLMAX", idx, tlmax+100, NULL, 0);
+ }
+
+ /* get input rows (let routine allocate the row array) */
+ while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
+ /* process all rows */
+ for(i=0; i<got; i++){
+ /* point to the i'th row */
+ ev = ebuf+i;
+ /* make sure ascii vector is null-terminated */
+ ev->shape[16] = '\0';
+ /* used with bpix.ev */
+ if( haveshape ){
+ cluc(ev->shape);
+ fprintf(stdout, "\tshape: %s\n", ev->shape);
+ }
+ ev->mycol = total++;
+ }
+ /* write out this batch of rows, along with the new column */
+ FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
+ /* write out one more record with special marker */
+ ev = ebuf;
+ strcpy(ev->shape, "hexagon ");
+ ev->mycol = -1;
+ FunTableRowPut(fun2, (char *)ev, 1, 0, NULL);
+ /* free row data */
+ if( ebuf ) free(ebuf);
+ }
+
+ /* flush output extension (write padding, etc.) */
+ FunFlush(fun2, NULL);
+ /* close the input extension */
+ FunClose(fun);
+ }
+
+ /* all done -- close output */
+ FunClose(fun2);
+ return(0);
+}
diff --git a/funtools/funtest/evcre.c b/funtools/funtest/evcre.c
new file mode 100644
index 0000000..b5b2cd3
--- /dev/null
+++ b/funtools/funtest/evcre.c
@@ -0,0 +1,115 @@
+/*
+ *
+ * evcre foo.fits -- test event creation
+ *
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <funtools.h>
+
+#define MAXREC 10
+
+typedef struct EvStruct{
+ short x[4], *atp;
+} *Event, EventRec;
+
+int main(int argc, char **argv)
+{
+ int i, j;
+ int val=1;
+ int got, put;
+ Fun fun;
+ EventRec events[MAXREC];
+ Event ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ if( argc < 2 ){
+ fprintf( stderr, "usage: %s oname\n", argv[0]);
+ exit(1);
+ }
+
+ /* fill in the records */
+ got = MAXREC;
+ for(i=0; i<got; i++){
+ ev = &events[i];
+ for(j=0; j<4; j++){
+ ev->x[j] = -i-j;
+ }
+ ev->atp = calloc(10,sizeof(short));
+ for(j=0; j<10; j++){
+ ev->atp[j] = i+j;
+ }
+ }
+
+ /* open output file */
+ if( !(fun = FunOpen(argv[1],"w", NULL)) )
+ gerror(stderr, "Could not open the output file: %s\n", argv[1]);
+
+ /* set up the (hardwired) columns */
+ FunColumnSelect(fun, sizeof(EventRec), NULL,
+ "2i", "2I ", "w", FUN_OFFSET(Event, x),
+ "2i2", "2I[2]", "w", FUN_OFFSET(Event, x),
+ "at2p", "@2I", "w", FUN_OFFSET(Event, atp),
+ "at2p4", "@2I[4]", "w", FUN_OFFSET(Event, atp),
+ "atp9", "@I[9]", "w", FUN_OFFSET(Event, atp),
+ NULL);
+
+ /* put these in extension header */
+ FunParamPuti(fun, "IPAR", 0, 100, "INTEGER Param", 0);
+ FunParamPuti(fun, "IPAR", 1, 101, "INTEGER Param", 0);
+ FunParamPutd(fun, "DPAR", 0, 123456789.9876, 12, "DOUBLE Param", 0);
+ FunParamPutd(fun, "DPAR", 1, 123456.780, 4, "DOUBLE Param", 0);
+ FunParamPuts(fun, NULL, 0, "", NULL, 0);
+ FunParamPuts(fun, NULL, 0, "Null param", NULL, 0);
+ FunParamPuts(fun, "COMMENT", 0, "This is comment #1", "Comment card", 0);
+ FunParamPuts(fun, "COMMENT", 0, "This is comment #2", "Comment card", 0);
+ FunParamPuts(fun, "COMMENT", 0, "This is comment #3", "Comment card", 0);
+
+ /* put these in primary header */
+ val = 1;
+ FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0);
+ FunParamPuti(fun, "IPAR", 0, -100, "INTEGER Param", 0);
+ FunParamPuti(fun, "IPAR", 1, -101, "INTEGER Param", 0);
+ FunParamPutd(fun, "DPAR", 0, -123456789.9876, 12, "DOUBLE Param", 0);
+ FunParamPutd(fun, "DPAR", 1, -123456.780, 4, "DOUBLE Param", 0);
+
+ /* put these in extension header */
+ val = 0;
+ FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0);
+ FunParamPuti(fun, "IPAR", 2, 200, "INTEGER Param", 0);
+ /* blank card used as a place holder */
+ FunParamPuts(fun, NULL, 0, "IPAR3", "INTEGER Param", 0);
+ FunParamPuts(fun, NULL, 0, "IPAR4", "INTEGER Param", 0);
+
+ /* put these in primary header */
+ FunParamPuti(FUN_PRIMARY(fun), "IPAR", 2, -200, "INTEGER Param", 0);
+
+ if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ got, put);
+ }
+
+ /* update file after writing data */
+ FunParamPuti(fun, "IPAR", 2, 400, "INTEGER Param", 0);
+ FunParamPuti(fun, "IPAR", 3, 600, "INTEGER Param", 2);
+ /* this will not update because append flag is 1, not 2 */
+ FunParamPuti(fun, "IPAR", 4, 800, "INTEGER Param", 1);
+ /* this will not update because there was no space saved */
+ FunParamPuti(fun, "IPAR", 5, 1000, "INTEGER Param", 2);
+
+ /* close file */
+ FunClose(fun);
+
+
+ /* fill in the records */
+ for(i=0; i<got; i++){
+ ev = &events[i];
+ free(ev->atp);
+ }
+
+ return(0);
+}
diff --git a/funtools/funtest/evmerge.c b/funtools/funtest/evmerge.c
new file mode 100644
index 0000000..6b7cebc
--- /dev/null
+++ b/funtools/funtest/evmerge.c
@@ -0,0 +1,77 @@
+/*
+ *
+ * evmerge.c -- example program for merging user values into a table file
+ *
+ */
+#include <funtools.h>
+#include <word.h>
+
+#define MAXROW 8192
+
+typedef struct evstruct{
+ double time;
+ int time2;
+} *Ev, EvRec;
+
+int main (int argc, char **argv)
+{
+ int i, got;
+ char tbuf[SZ_LINE];
+ Fun fun, fun2;
+ Ev ebuf, ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* make sure we have minimal arguments */
+ if( argc < 4 )
+ gerror(stderr, "usage: %s iname oname mergetype [columns]\n", argv[0]);
+
+ /* open input file */
+ if( !(fun = FunOpen(argv[1], "rc", NULL)) )
+ gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
+
+ /* open the output FITS image, inheriting params from input */
+ if( !(fun2 = FunOpen(argv[2], "w", fun)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* "merge=[type]" merges original input columns with new ones, where type is:
+ * update -- add new columns, update value of existing ones (same data type)
+ * replace -- add new columns, replace data type and value of existing ones
+ * append -- only add new columns, do not "replace" or "update" existing ones
+ * If tbuf argument is NULL, no merging is performed -- only user-specified
+ * columns are output.
+ */
+ if( isfalse(argv[3]) )
+ *tbuf = '\0';
+ else
+ sprintf(tbuf, "merge=%s", argv[3]);
+ FunColumnSelect(fun, sizeof(EvRec), tbuf,
+ "time", "D", "rw", FUN_OFFSET(Ev, time),
+ "time2", "J", "w", FUN_OFFSET(Ev, time2),
+ NULL);
+
+ /* activate specified columns -- these will be written to the output file */
+ if( argc >= 5 )
+ FunColumnActivate(fun, argv[4], NULL);
+
+ /* get rows -- let routine allocate the row array */
+ while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
+ /* process all rows */
+ for(i=0; i<got; i++){
+ /* point to the i'th row */
+ ev = ebuf+i;
+ ev->time2 = (int)(ev->time+.5);
+ ev->time = -(ev->time/10.0);
+ }
+ /* write out this batch of rows with the new column */
+ FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
+ /* free row data */
+ if( ebuf ) free(ebuf);
+ }
+
+ /* clean up -- close output before input to perform flush automatically */
+ FunClose(fun2);
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/evmerge2.c b/funtools/funtest/evmerge2.c
new file mode 100644
index 0000000..c9b3509
--- /dev/null
+++ b/funtools/funtest/evmerge2.c
@@ -0,0 +1,124 @@
+/*
+ *
+ * evmerge2.c -- example program for combining extensions from 2 binary tables
+ * we write the primary extension of file 1 along with its event extension,
+ * and the GTI extension of file2.
+ *
+ */
+#include <funtools.h>
+#define MAXROW 8192
+
+typedef struct gtistruct{
+ double start, stop;
+} *GTI, GTIRec;
+
+/* sample event struct */
+typedef struct evstruct{
+ double time;
+} *Ev, EvRec;
+
+int main (int argc, char **argv)
+{
+ int i, j;
+ int get, got;
+ int ngti;
+ char *idx;
+ char tbuf[SZ_LINE];
+ Fun ifun1, ifun2, ofun;
+ GTI gtibuf=NULL, gti;
+ Ev ebuf=NULL, ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* make sure we have minimal arguments */
+ if( argc < 4 )
+ gerror(stderr, "usage: %s iname1 iname2 oname\n", argv[0]);
+
+ /* open a new output FITS file */
+ if( !(ofun = FunOpen(argv[3], "w", NULL)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* open the primary extension of the event file (file #1) and output it */
+ /* first strip off the event extension from the filename */
+ strcpy(tbuf, argv[1]);
+ if( (idx=strchr(tbuf, '[')) ) *idx = '\0';
+ /* add '[0]' to denote primary */
+ strcat(tbuf, "[0]");
+ /* open primary extension */
+ if( !(ifun1 = FunOpen(tbuf, "r", NULL)) )
+ gerror(stderr, "could not FunOpen primary extension of file1: %s\n", tbuf);
+ /* make this extension the reference handle for the output file */
+ FunInfoPut(ofun, FUN_IFUN, &ifun1, 0);
+ /* a flush will write primary extension to the output file */
+ FunFlush(ofun, "copy=reference");
+ /* close primary */
+ FunClose(ifun1);
+
+ /* open the GTI file (file #2) */
+ strcpy(tbuf, argv[2]);
+ /* add GTI extension, if user left it off */
+ if( !(idx=strchr(tbuf, '[')) ) strcat(tbuf, "[GTI]");
+ if( !(ifun2 = FunOpen(tbuf, "r", NULL)) )
+ gerror(stderr, "could not FunOpen input GTI file: %s\n", tbuf);
+ /* select columns that we need to process */
+ /* NB: this is the entire GTI record (start,stop) */
+ FunColumnSelect(ifun2, sizeof(GTIRec), NULL,
+ "START", "D", "rw", FUN_OFFSET(GTI, start),
+ "STOP", "D", "rw", FUN_OFFSET(GTI, stop),
+ NULL);
+ /* read and store all GTI records for later processing and output */
+ ngti = FunParamGeti(ifun2, "NAXIS2", 0, 0, &get);
+ gtibuf = FunTableRowGet(ifun2, NULL, ngti, NULL, &got);
+
+ /* open the EVENTS extension (file #1) */
+ strcpy(tbuf, argv[1]);
+ /* add EVENTS extension, if user left it off */
+ if( !(idx=strchr(tbuf, '[')) ) strcat(tbuf, "[EVENTS]");
+ if( !(ifun1 = FunOpen(tbuf, "r", NULL)) )
+ gerror(stderr, "could not FunOpen EVENTS input file: %s\n", tbuf);
+ /* we need the time to get the right gti record */
+ FunColumnSelect(ifun1, sizeof(EvRec), "merge=update",
+ "TIME", "D", "rw", FUN_OFFSET(Ev, time),
+ NULL);
+ /* make this extension the reference handle for the output file */
+ FunInfoPut(ofun, FUN_IFUN, &ifun1, 0);
+ /* get input rows (let routine allocate the row array) */
+ while( (ebuf = (Ev)FunTableRowGet(ifun1, NULL, MAXROW, NULL, &got)) ){
+ /* process each row */
+ for(i=0; i<got; i++){
+ /* point to the i'th row */
+ ev = ebuf+i;
+ /* look through gti records for the right one */
+ for(j=0; j<ngti; j++){
+ gti = gtibuf + j;
+ /* if this row is in a good time interval, writ it out */
+ if( (ev->time > gti->start) && (ev->time <= gti->stop) ){
+ FunTableRowPut(ofun, (char *)ev, 1, i, NULL);
+ break;
+ }
+ }
+ }
+ /* free row data */
+ if( ebuf ) free(ebuf);
+ }
+ /* flush output extension (write padding, etc.) so we can start next one */
+ FunFlush(ofun, NULL);
+
+ /* we now write the gti records into the extension following the rows */
+ /* make the GTI extension the reference handle for the output file, which
+ also sets up the default columns from the input gti file */
+ FunInfoPut(ofun, FUN_IFUN, &ifun2, 0);
+ /* write the GTI records */
+ FunTableRowPut(ofun, (char *)gtibuf, ngti, 0, NULL);
+
+ /* close output */
+ FunClose(ofun);
+ /* close the inputs */
+ FunClose(ifun1);
+ FunClose(ifun2);
+
+ /* free gti buffer */
+ if( gtibuf ) free(gtibuf);
+ return(0);
+}
diff --git a/funtools/funtest/evnext.c b/funtools/funtest/evnext.c
new file mode 100644
index 0000000..3050548
--- /dev/null
+++ b/funtools/funtest/evnext.c
@@ -0,0 +1,116 @@
+/*
+ *
+ * evnext.c -- example program for changing the time of an row to have
+ * the value from the next row
+ *
+ */
+
+#include <funtools.h>
+
+#define MAXROW 100
+
+typedef struct evstruct{
+ double time;
+} *Ev, EvRec;
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int i;
+ int got, ogot;
+ char *oraw;
+ char *nraw;
+ char *null=NULL;
+ Ev ebuf, oebuf=NULL;
+ Ev ev, nev, oev;
+ Fun fun, fun2;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* make sure we have minimal arguments */
+ if( argc < 3 )
+ gerror(stderr, "usage: %s iname oname [columns]\n", argv[0]);
+
+ /* open file */
+ if( !(fun = FunOpen(argv[1], "r", NULL)) )
+ gerror(stderr, "could not FunOpen %s\n", argv[1]);
+
+ /* open the output FITS image, inheriting params from input */
+ if( !(fun2 = FunOpen(argv[2], "w", fun)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* specify columns we want */
+ got = FunColumnSelect(fun, sizeof(EvRec), "merge=update",
+ "time", "1D", "rw", FUN_OFFSET(Ev, time),
+ NULL);
+ /* activate specified columns -- these will be written to the output file */
+ if( argc >= 4 )
+ FunColumnActivate(fun, argv[3], NULL);
+
+ /* get rows */
+ while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
+ /* process the last row from previous batch, if we have it */
+ if( oebuf ){
+ /* this is the old array of rows -- we point to the last one */
+ oev = oebuf+(ogot-1);
+ /* this is the new array of rows -- we point to the first one */
+ ev = ebuf;
+ /* change time value of old row to new row's value */
+ oev->time = ev->time;
+ /* now we have to write out this last row */
+ /* first, save pointer to the new raw data */
+ FunInfoGet(fun, FUN_RAWBUF, &nraw, 0);
+ /* put back old pointer so we merge it with last row */
+ FunInfoPut(fun, FUN_RAWBUF, &oraw, 0);
+ /* write out last row merging with its raw data */
+ /* (its arg 4 that tells funtools to merge with the last raw row) */
+ FunTableRowPut(fun2, oebuf, 1, ogot-1, NULL);
+ /* free up old raw data */
+ if( oraw ) free(oraw);
+ /* free up old user data */
+ if( oebuf ) free(oebuf);
+ /* finally, put back new raw data pointer, so we can process new batch */
+ FunInfoPut(fun, FUN_RAWBUF, &nraw, 0);
+ }
+ /* process the got-1 rows by replacing the time with time from
+ the succeeding row */
+ for(i=0; i<(got-1); i++){
+ /* point to the i'th row */
+ ev = ebuf+i;
+ nev = ebuf+(i+1);
+ ev->time = nev->time;
+ }
+ /* if we processed at least one row this time ... */
+ if( got > 1 ){
+ /* write out got-1 rows with the raw columns */
+ FunTableRowPut(fun2, (char *)ebuf, (got-1), 0, NULL);
+ }
+ /* if we have a "last" row to process next time ... */
+ if( got ){
+ /* save the user row for when we have the next batch */
+ oebuf = ebuf;
+ /* save pointer to raw data */
+ FunInfoGet(fun, FUN_RAWBUF, &oraw, 0);
+ /* null out rawbuf pointer so Funtools does not free it automatically */
+ FunInfoPut(fun, FUN_RAWBUF, &null, 0);
+ /* save old value of got */
+ ogot = got;
+ }
+ }
+
+ /* clean up last saved batch */
+ if( oraw ) free(oraw);
+ if( oebuf ) free(oebuf);
+
+ /* close and return */
+ FunClose(fun2);
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/evread.c b/funtools/funtest/evread.c
new file mode 100644
index 0000000..f93d80c
--- /dev/null
+++ b/funtools/funtest/evread.c
@@ -0,0 +1,363 @@
+/*
+ *
+ * evread.c -- example program for reading rows in different ways
+ *
+ */
+
+#include <funtoolsP.h>
+
+#define MAXROW 10000
+
+extern char *optarg;
+extern int optind;
+
+/* single event (used in array of structs) */
+typedef struct evstruct{
+ short region;
+ double x, y;
+ int pi, pha;
+ double time;
+ double dx, dy;
+} *Ev, EvRec;
+
+/* arrays of columns (used in struct of arrays) */
+typedef struct aevstruct{
+ short region[MAXROW];
+ double x[MAXROW], y[MAXROW];
+ int pi[MAXROW], pha[MAXROW];
+ double time[MAXROW];
+ double dx[MAXROW], dy[MAXROW];
+} *AEv, AEvRec;
+
+/* pointers to arrays of columns (used in struct of arrays) */
+typedef struct pevstruct{
+ short *region;
+ double *x, *y;
+ int *pi, *pha;
+ double *time;
+ double *dx, *dy;
+} *PEv, PEvRec;
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int i;
+ int c;
+ int got;
+ int put;
+ int args;
+ int ncol;
+ int ctype, cn, tcol;
+ int doev=0;
+ int doseek=0;
+ int doualloc=0;
+ int nrow;
+ int maxrow;
+ char tbuf[SZ_LINE];
+ char *mode="r";
+ char *iname;
+ char *oname=NULL;
+ char *params=NULL;
+ char *cname;
+ Fun fun=NULL;
+ Fun ofun=NULL;
+ void *buf=NULL;
+ Ev ev, ebuf=NULL;
+ AEv aev, abuf=NULL;
+ PEv pev, pbuf=NULL;
+ FITSHead header=NULL;
+ FunCol *cols;
+
+ /* process switch arguments */
+ while ((c = getopt(argc, argv, "aepusw:")) != -1){
+ switch(c){
+ case 'a':
+ doev = 1;
+ params = "org=soa";
+ break;
+ case 'e':
+ doev = 0;
+ params = "org=aos";
+ break;
+ case 'f':
+ doev = 3;
+ params = "org=aos";
+ break;
+ case 'p':
+ doev = 2;
+ params = "org=soa";
+ break;
+ case 's':
+ doseek = 1;
+ break;
+ case 'u':
+ doualloc = 1;
+ break;
+ case 'w':
+ oname = optarg;
+ mode = "rw";
+ break;
+ }
+ }
+
+ /* check for required arguments */
+ args = argc - optind;
+ if( args == 0 )
+ iname = "test.ev[EVENTS]";
+ else
+ iname = argv[optind];
+
+ /* open input file */
+ if( !(fun = FunOpen(iname, "r", NULL)) ){
+ gerror(stderr, "could not FunOpen %s\n", iname);
+ exit(1);
+ }
+
+ /* open output file, if necessary */
+ if( oname ){
+ if( !(ofun = FunOpen(oname, "w", fun)) ){
+ gerror(stderr, "could not FunOpen outout %s\n", oname);
+ exit(1);
+ }
+ }
+
+ /* set number of rows to read at once */
+ if( doseek )
+ maxrow = 1;
+ else
+ maxrow = MAXROW;
+
+ /* display column information from raw data file */
+ /* first get fitsy header info */
+ FunInfoGet(fun, FUN_HEADER, &header, FUN_COLS, &cols, FUN_NCOL, &ncol, 0);
+ if( !header->table ){
+ gerror(stderr, "not a table\n");
+ exit(1);
+ }
+ fprintf(stdout, " name\t type\t n\t col\t otype\t scaled\n");
+ fprintf(stdout, "-------\t-------\t-------\t-------\t-------\t-------\n");
+ for(i=0; i<ncol; i++){
+ /* current type info, which might have a changed data type if its scaled */
+ if( !FunColumnLookup(fun, NULL, i,
+ &cname, &ctype, NULL, NULL, &cn, NULL) ){
+ gerror(stderr, "missing column %d\n", i);
+ exit(1);
+ }
+ /* non-negative tcols point to raw columns in FITS table, where we can
+ determine the original data type and whether scaling params exist */
+ if( (tcol = cols[i]->tcol) >= 0 ){
+ fprintf(stdout, "%7s\t%7c\t%7d\t%7d\t%7c\t%7d\n",
+ cname, ctype, cn,
+ tcol,
+ header->table->col[tcol].type,
+ header->table->col[tcol].scaled);
+ }
+ }
+ fprintf(stdout, "\n");
+
+ /* specify columns we want */
+ switch(doev){
+ /* array of structs */
+ case 0:
+ got = FunColumnSelect(fun, sizeof(EvRec), params,
+ "x", "D:10:10", mode, FUN_OFFSET(Ev, x),
+ "y", "D:10:10", mode, FUN_OFFSET(Ev, y),
+ "pha", "J", mode, FUN_OFFSET(Ev, pha),
+ "pi", "J", mode, FUN_OFFSET(Ev, pi),
+ "time", "1D", mode, FUN_OFFSET(Ev, time),
+ "dx", "D:10:10", mode, FUN_OFFSET(Ev, dx),
+ "dy", "D:10:10", mode, FUN_OFFSET(Ev, dy),
+ "$region", "I", mode, FUN_OFFSET(Ev, region),
+ NULL);
+ if( doualloc ){
+ ebuf = calloc(MAXROW, sizeof(EvRec));
+ buf = ebuf;
+ }
+ break;
+ /* struct of arrays */
+ case 1:
+ got = FunColumnSelect(fun, sizeof(AEvRec), params,
+ "x", "D:10:10", mode, FUN_OFFSET(AEv, x),
+ "y", "D:10:10", mode, FUN_OFFSET(AEv, y),
+ "pha", "J", mode, FUN_OFFSET(AEv, pha),
+ "pi", "J", mode, FUN_OFFSET(AEv, pi),
+ "time", "1D", mode, FUN_OFFSET(AEv, time),
+ "dx", "D:10:10", mode, FUN_OFFSET(AEv, dx),
+ "dy", "D:10:10", mode, FUN_OFFSET(AEv, dy),
+ "$region", "I", mode, FUN_OFFSET(AEv, region),
+ NULL);
+ if( doualloc ){
+ abuf = calloc(1, sizeof(AEvRec));
+ buf = abuf;
+ }
+ break;
+ /* struct of pointers */
+ case 2:
+ got = FunColumnSelect(fun, sizeof(PEvRec), params,
+ "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
+ "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
+ "pha", "@J", mode, FUN_OFFSET(PEv, pha),
+ "pi", "@J", mode, FUN_OFFSET(PEv, pi),
+ "time", "@1D", mode, FUN_OFFSET(PEv, time),
+ "dx", "@D:10:10", mode, FUN_OFFSET(PEv, dx),
+ "dy", "@D:10:10", mode, FUN_OFFSET(PEv, dy),
+ "$region", "@I", mode, FUN_OFFSET(PEv, region),
+ NULL);
+ if( doualloc ){
+ pbuf = calloc(1, sizeof(PEvRec));
+ pbuf->region = calloc(MAXROW, sizeof(short));
+ pbuf->x = calloc(MAXROW, sizeof(double));
+ pbuf->y = calloc(MAXROW, sizeof(double));
+ pbuf->pi = calloc(MAXROW, sizeof(int));
+ pbuf->pha = calloc(MAXROW, sizeof(int));
+ pbuf->time = calloc(MAXROW, sizeof(double));
+ pbuf->dx = calloc(MAXROW, sizeof(double));
+ pbuf->dy = calloc(MAXROW, sizeof(double));
+ buf = pbuf;
+ }
+ break;
+ /* array of structs containing pointers */
+ case 3:
+ got = FunColumnSelect(fun, sizeof(PEvRec), params,
+ "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
+ "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
+ "pha", "@J", mode, FUN_OFFSET(PEv, pha),
+ "pi", "@J", mode, FUN_OFFSET(PEv, pi),
+ "time", "@1D", mode, FUN_OFFSET(PEv, time),
+ "dx", "@D:10:10", mode, FUN_OFFSET(PEv, dx),
+ "dy", "@D:10:10", mode, FUN_OFFSET(PEv, dy),
+ "$region", "@I", mode, FUN_OFFSET(PEv, region),
+ NULL);
+ if( doualloc ){
+ pbuf = calloc(1, sizeof(PEvRec));
+ pbuf->region = calloc(1, sizeof(short));
+ pbuf->x = calloc(1, sizeof(double));
+ pbuf->y = calloc(1, sizeof(double));
+ pbuf->pi = calloc(1, sizeof(int));
+ pbuf->pha = calloc(1, sizeof(int));
+ pbuf->time = calloc(1, sizeof(double));
+ pbuf->dx = calloc(1, sizeof(double));
+ pbuf->dy = calloc(1, sizeof(double));
+ buf = pbuf;
+ }
+ break;
+ default:
+ gerror(stderr, "unknown params value: %d\n", doev);
+ break;
+ }
+
+ /* get rows */
+ while( 1 ){
+ if( doseek ){
+ fprintf(stdout, "Enter row: ");
+ fflush(stdout);
+ fgets(tbuf, SZ_LINE, stdin);
+ nrow = atoi(tbuf);
+ if( nrow <=0 ) break;
+ if( FunTableRowSeek(fun, nrow, NULL) < 0 ){
+ gerror(stderr, "FunTableRowSeek() failed on row %d\n", nrow);
+ exit(1);
+ }
+ }
+ buf = (void *)FunTableRowGet(fun, buf, maxrow, NULL, &got);
+ if( !buf ) break;
+ /* output if necessary */
+ if( ofun ){
+ if( (put=FunTableRowPut(ofun, buf, got, 0, NULL)) != got ){
+ gerror(stderr, "expected to write %d rows; only wrote %d\n",
+ got, put);
+ }
+ }
+ /* and display */
+ switch(doev){
+ case 0:
+ for(i=0; i<got; i++){
+ ev = (Ev)buf+i;
+ fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
+ ev->x, ev->y,
+ ev->pha, ev->pi,
+ ev->time,
+ ev->dx, ev->dy,
+ (int)ev->region);
+ fflush(stdout);
+ }
+ break;
+ case 1:
+ aev = (AEv)buf;
+ for(i=0; i<got; i++){
+ fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
+ aev->x[i], aev->y[i],
+ aev->pha[i], aev->pi[i],
+ aev->time[i],
+ aev->dx[i], aev->dy[i],
+ (int)aev->region[i]);
+ fflush(stdout);
+ }
+ break;
+ case 2:
+ pev = (PEv)buf;
+ for(i=0; i<got; i++){
+ fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
+ pev->x[i], pev->y[i],
+ pev->pha[i], pev->pi[i],
+ pev->time[i],
+ pev->dx[i], pev->dy[i],
+ (int)pev->region[i]);
+ fflush(stdout);
+ }
+ break;
+ case 3:
+ for(i=0; i<got; i++){
+ pev = (PEv)buf+i;
+ fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
+ pev->x[0], pev->y[0],
+ pev->pha[0], pev->pi[0],
+ pev->time[0],
+ pev->dx[0], pev->dy[0],
+ (int)pev->region[0]);
+ fflush(stdout);
+ }
+ break;
+ default:
+ gerror(stderr, "unknown params value: %d\n", doev);
+ break;
+ }
+ /* if funtools did allocation, free it now */
+ if( !doualloc ){
+ if( buf ) xfree(buf);
+ buf = NULL;
+ }
+ }
+
+ /* clean up */
+ if( doualloc ){
+ switch(doev){
+ case 0:
+ if( ebuf ) xfree(ebuf);
+ break;
+ case 1:
+ if( abuf ) xfree(abuf);
+ break;
+ case 2:
+ if( pbuf->region ) xfree(pbuf->region);
+ if( pbuf->x ) xfree(pbuf->x);
+ if( pbuf->y ) xfree(pbuf->y);
+ if( pbuf->pi ) xfree(pbuf->pi);
+ if( pbuf->pha ) xfree(pbuf->pha);
+ if( pbuf->time ) xfree(pbuf->time);
+ if( pbuf->dx ) xfree(pbuf->dx);
+ if( pbuf->dy ) xfree(pbuf->dy);
+ if( pbuf ) xfree(pbuf);
+ break;
+ }
+ }
+ if( ofun ) FunClose(ofun);
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/evreplace.c b/funtools/funtest/evreplace.c
new file mode 100644
index 0000000..48d2b54
--- /dev/null
+++ b/funtools/funtest/evreplace.c
@@ -0,0 +1,96 @@
+#include <funtools.h>
+
+/* if defined, user allocated row buffer, otherwise let funtools do it */
+/* #define USER_ALLOC 1 */
+
+#define MAXROW 100000
+
+typedef struct evstruct{
+ double x, y;
+ int *phas;
+} *Ev, EvRec;
+
+void Reverse(double x, double y, int *phas,
+ double *nx, double *ny, int *nphas, int npha)
+{
+ int i;
+ *nx = y;
+ *ny = x;
+ for(i=0; i<npha; i++){
+ nphas[npha-(i+1)] = phas[i];
+ }
+}
+
+int main(int argc, char **argv)
+{
+ int i;
+ int got;
+ int npha;
+ char tbuf[SZ_LINE];
+ Ev ebuf, ev, nev;
+ Fun fun, fun2;
+
+ /* make sure we have minimal arguments */
+ if( argc < 3 ){
+ fprintf(stderr, "usage: %s iname oname [columns]\n", argv[0]);
+ exit(1);
+ }
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* open input FITS file for reading, and allowing copy of other extensions */
+ if( !(fun = FunOpen(argv[1], "rc", NULL)) )
+ gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
+
+ /* look for the size of the phas vector */
+ if( !FunColumnLookup(fun, "phas", 0, NULL, NULL, NULL, NULL, &npha, NULL) )
+ gerror(stderr, "can't find phas column\n");
+
+ /* open the output FITS image, inheriting params from input */
+ if( !(fun2 = FunOpen(argv[2], "w", fun)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* allocate a new row buffer, now that we know the size of phas */
+ nev = (Ev)calloc(1, sizeof(EvRec));
+ nev->phas = (int *)calloc(npha, sizeof(int));
+
+ /* create format statement for the pha vector, @ means its a pointer */
+ sprintf(tbuf, "@%dJ", npha);
+ /* specify input columns we want brought into user space */
+ FunColumnSelect(fun, sizeof(EvRec), "merge=replace",
+ "$x", "D", "rw", FUN_OFFSET(Ev, x),
+ "$y", "D", "rw", FUN_OFFSET(Ev, y),
+ "phas", tbuf, "rw", FUN_OFFSET(Ev, phas),
+ NULL);
+
+ /* set columns to be written to the output file */
+ if( argc >= 4 )
+ FunColumnActivate(fun, argv[3], NULL);
+
+ /* loop through rows and replicate */
+ while( (ebuf=(Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
+ for(i=0; i<got; i++){
+ /* get pointer to the user info containing x,y, phas */
+ ev = ebuf+i;
+ /* generate a new rows (with new x, y, phas values) */
+ Reverse(ev->x, ev->y, ev->phas,
+ &(nev->x), &(nev->y), nev->phas, npha);
+ /* write this new row -- with the replacements from user space */
+ FunTableRowPut(fun2, nev, 1, i, NULL);
+ }
+ if( ebuf ) free(ebuf);
+ }
+
+ /* free the new row */
+ if( nev ){
+ if( nev->phas ) free(nev->phas);
+ free(nev);
+ }
+
+ /* close output before input so that funtools will copy the rest of the
+ input extensions to the output (if such copy is requred) */
+ FunClose(fun2);
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/evtest.c b/funtools/funtest/evtest.c
new file mode 100644
index 0000000..975b298
--- /dev/null
+++ b/funtools/funtest/evtest.c
@@ -0,0 +1,82 @@
+/*
+ *
+ * evmerge.c -- example program for merging user values into a table file
+ *
+ */
+
+#include <math.h>
+#include <funtools.h>
+
+#define MAXROW 8192
+
+typedef struct evstruct{
+ double time;
+ double ntime;
+ double tinc;
+} *Ev, EvRec;
+
+int main (int argc, char **argv)
+{
+ int i, got;
+ int maxrow=MAXROW;
+ double x=0.5;
+ char *tmode;
+ char *s;
+ Fun fun, fun2;
+ Ev ebuf, ev;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* make sure we have minimal arguments */
+ if( argc < 3 )
+ gerror(stderr, "usage: %s iname oname [columns]\n", argv[0]);
+
+ /* get maxrow,if user-specified */
+ if( (s=(char *)getenv("FUN_MAXROW")) != NULL )
+ maxrow = atoi(s);
+
+ /* open input file */
+ if( !(fun = FunOpen(argv[1], "rc", NULL)) )
+ gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
+
+ /* open the output FITS image, inheriting params from input */
+ if( !(fun2 = FunOpen(argv[2], "w", fun)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* if we have "time2", read it, else create it */
+ if( FunColumnLookup(fun, "tinc", 0, NULL, NULL, NULL, NULL, NULL, NULL) )
+ tmode = "rw";
+ else
+ tmode = "w";
+
+ FunColumnSelect(fun, sizeof(EvRec), "merge=replace",
+ "time", "D", "r", FUN_OFFSET(Ev, time),
+ "ntime", "D", "rw", FUN_OFFSET(Ev, ntime),
+ "tinc", "D", tmode, FUN_OFFSET(Ev, tinc),
+ NULL);
+
+ /* activate specified columns -- these will be written to the output file */
+ if( argc >= 4 )
+ FunColumnActivate(fun, argv[3], NULL);
+
+ /* get rows -- let routine allocate the row array */
+ while( (ebuf = (Ev)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) ){
+ /* process all rows */
+ for(i=0; i<got; i++){
+ /* point to the i'th row */
+ ev = ebuf+i;
+ ev->tinc += (i*sqrt(cos(x)*cos(x) + sin(x)*sin(x)));
+ ev->ntime = ev->time + ev->tinc;
+ /* write out row with the new columns */
+ FunTableRowPut(fun2, (char *)ev, 1, i, NULL);
+ }
+ /* free row data */
+ if( ebuf ) free(ebuf);
+ }
+
+ /* clean up -- close output before input to perform flush automatically */
+ FunClose(fun2);
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/fctest b/funtools/funtest/fctest
new file mode 100755
index 0000000..ad9d34d
--- /dev/null
+++ b/funtools/funtest/fctest
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -x
+
+funcnts $* | awk 'start==1{print $0};/^---- ------------ ---------$/{start=1}'
diff --git a/funtools/funtest/filt.c b/funtools/funtest/filt.c
new file mode 100644
index 0000000..37c5ccf
--- /dev/null
+++ b/funtools/funtest/filt.c
@@ -0,0 +1,147 @@
+/* NB: for pre-funtools.1.0.b24:
+ * copy pixels.h from funtools/filter/pixels.h to your include directory
+ */
+
+/*
+ *
+ * On Linux:
+ * gcc -o filt filt.c -I<install>/include -L<install>/lib -lfuntools -ldl -lm
+ *
+ * Run example:
+ *
+ * filt funtest/test.ev @foo
+ *
+ * where foo is a file containing:
+ * circle 1 1 .1
+ * circle 3 3 .1
+ * circle 5 5 .1
+ * circle 7 7 .1
+ */
+
+#include <funtools.h>
+#include <filter.h>
+#include <swap.h>
+
+#define MAXROW 10000
+
+typedef struct evstruct{
+ double x, y;
+} *Ev, EvRec;
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int i;
+ int got;
+ int rawsize;
+ int endian;
+ int *rbuf;
+ char *fname=NULL;
+ char *region=NULL;
+ char *rawbuf;
+ char *bincols;
+ char tbuf[SZ_LINE];
+ Fun fun;
+ Ev ebuf, ev;
+ FITSHead header;
+ Filter filt;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* process args */
+ if( argc < 3 )
+ gerror(stderr, "usage: filt fname region\n");
+ else{
+ fname = argv[1];
+ region = argv[2];
+ }
+
+ /* open input file */
+ if( !(fun = FunOpen(fname, "r", NULL)) ){
+ gerror(stderr, "could not FunOpen %s\n", fname);
+ }
+ /* specify columns we want, as usual */
+ got = FunColumnSelect(fun, sizeof(EvRec), NULL,
+ "x", "D", "r", FUN_OFFSET(Ev, x),
+ "y", "D", "r", FUN_OFFSET(Ev, y),
+ NULL);
+
+ /* FILTER STUFF: get fitsy header and some other information for filtering */
+ FunInfoGet(fun,
+ FUN_ENDIAN, &endian,
+ FUN_HEADER, &header,
+ FUN_RAWSIZE, &rawsize,
+ FUN_BINCOLS, &bincols,
+ 0);
+
+ /* FILTER STUFF: make up the filter mode for FilterOpen() specifying:
+ 1. event processing
+ 2. the binning column names (needed for region processing)
+ 3. whether we have to convert raw data to native format
+ */
+ /* event (not image) filtering */
+ strcpy(tbuf, "type=events");
+ /* add the binning key -- required for region filtering */
+ if( bincols ){
+ strcat(tbuf, ",");
+ strcat(tbuf, bincols);
+ }
+ /* filter code should convert data to native format if its not already */
+ if( is_bigendian() == endian )
+ strcat(tbuf, ",convert=false");
+ else
+ strcat(tbuf, ",convert=true");
+
+ /* FILTER STUFF: allocate return filter buffer for FilterOpen() */
+ rbuf = (int *)malloc(MAXROW*sizeof(int));
+
+ /* FILTER STUFF: FilterOpen: new filter that will return region ids or 0 */
+ if( !(filt = FilterOpen(header, region, tbuf)) )
+ gerror(stderr, "can't open region filter: %s", region);
+
+ /* get events */
+ while( (ebuf=(Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
+
+ /* FILTER STUFF: get pointer to current raw buffer of events to filter */
+ FunInfoGet(fun, FUN_RAWBUF, &rawbuf, 0);
+
+ /* FILTER STUFF: filter the raw events we just read -- answers in rbuf */
+ if( FilterEvents(filt, rawbuf, rawsize, got, rbuf) ){
+
+ /* loop through events, process them based on returned region value */
+ for(i=0; i<got; i++){
+ ev = ebuf+i;
+ /* FILTER STUFF: rbuf[i] is:
+ 0 if we failed filter
+ -1 if we passed filter but its not in a region
+ +n if we passed filter in a region (n is region id)
+ */
+ if( rbuf[i] > 0 )
+ fprintf(stdout, "YES %d\t%.2f\t%.2f\n", rbuf[i], ev->x, ev->y);
+ else
+ fprintf(stdout, "NO %d\t%.2f\t%.2f\n", rbuf[i], ev->x, ev->y);
+ fflush(stdout);
+ }
+ }
+ /* free for next read */
+ if( ebuf ) free(ebuf);
+ }
+
+ /* free up space */
+ if( rbuf ) free(rbuf);
+
+ /* close filter */
+ if( filt ) FilterClose(filt);
+
+ /* close file */
+ FunClose(fun);
+
+ return(0);
+}
diff --git a/funtools/funtest/funcalc.sed b/funtools/funtest/funcalc.sed
new file mode 100644
index 0000000..d9f3b18
--- /dev/null
+++ b/funtools/funtest/funcalc.sed
@@ -0,0 +1,11 @@
+# cc <foo.c> 2>&1 | sed -n -f funauto.sed
+# Linux gcc (and others)
+s/.*[`'‘]\([^)]*\)['’] *undeclared (first use in this function).*/\1/p
+# Solaris cc
+s/.*undefined symbol: \([^)]*\)/\1/p
+# Dec Alpha/OSF cc
+s/.*In this statement, "\([^)]*\)" is not declared.*/\1/p
+# SGI cc
+s/.*The identifier "\([^)]*\)" is undefined.*/\1/p
+# Intel icc
+s/.*identifier "\([^)]*\)" is undefined.*/\1/p
diff --git a/funtools/funtest/funcheck b/funtools/funtest/funcheck
new file mode 100755
index 0000000..c5b0a43
--- /dev/null
+++ b/funtools/funtest/funcheck
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ x$1 != x ]; then
+ FILE=$1
+ echo "checking $FILE ..."
+else
+ echo "checking stdin ..."
+fi
+
+egrep -v 'REV|EXACT|SUM|OPROG|NPROG|FILE|block factor does|0a1,2|\*\*\*|^ *$|^foo|idx|^tboxell|^\)|^HERE\)\]' $FILE
diff --git a/funtools/funtest/funchecks b/funtools/funtest/funchecks
new file mode 100755
index 0000000..44c5d7b
--- /dev/null
+++ b/funtools/funtest/funchecks
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+for file in foo.[in][cdpt]*
+do
+ funcheck $file
+done
diff --git a/funtools/funtest/funcones b/funtools/funtest/funcones
new file mode 100755
index 0000000..fcf2457
--- /dev/null
+++ b/funtools/funtest/funcones
@@ -0,0 +1,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
diff --git a/funtools/funtest/fundisp1out b/funtools/funtest/fundisp1out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/funtools/funtest/fundisp1out
diff --git a/funtools/funtest/funsky.c b/funtools/funtest/funsky.c
new file mode 100644
index 0000000..0151235
--- /dev/null
+++ b/funtools/funtest/funsky.c
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2005 Smithsonian Astrophysical Observatory
+ */
+
+/* gcc -g -o funsky funsky.c -I $HOME/include -L$HOME/lib -lfuntools
+ -ldl -lnsl -lsocket -lm
+ */
+
+#include <funtoolsP.h>
+#include <strtod.h>
+
+extern char *optarg;
+extern int optind;
+
+#define X__PI 3.14159265358979323846
+#define X_2PI ( 2 * X__PI )
+#define X_R2D (X_2PI / 360.0)
+#define X_R2H (X_2PI / 24.0)
+#define X_H2D (360.0 / 24.0)
+
+#define r2h(r) ( (r) / X_R2H )
+#define h2r(d) ( (d) * X_R2H )
+#define r2d(r) ( (r) / X_R2D )
+#define d2r(d) ( (d) * X_R2D )
+#define h2d(r) ( (r) * X_H2D )
+#define d2h(d) ( (d) / X_H2D )
+
+#ifdef ANSI_FUNC
+void usage(char *s)
+#else
+void usage(s)
+ char *s;
+#endif
+{
+ fprintf(stderr, "usage: [switches] %s fname[ext]\n", s);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "switches:\n");
+ fprintf(stderr, "-d\t# always use integer tlmin conversion (as ds9 does)\n");
+ fprintf(stderr, "-r\t# convert x,y to RA,Dec (default: convert RA,Dec to x,y)\n");
+ fprintf(stderr, "-v\t# display input values also (default: display output only)\n");
+ fprintf(stderr, "-T\t# output display in rdb format\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "Pairs of space- or comma-delimited numeric values are input to stdin.\n");
+ fprintf(stderr, "By default, input RA and Dec are converted into x and y. (Use the\n");
+ fprintf(stderr, "-r to convert from x,y to RA,Dec.) When RA and Dec are input, \n");
+ fprintf(stderr, "floating point numbers are degrees, but h:m:s, d:m:s also are valid.\n");
+ fprintf(stderr, "The coord. system is taken from the header (might differ from ds9).\n");
+ fprintf(stderr, "NB: x,y values are physical coords for event data, image coords\n");
+ fprintf(stderr, "for image data.\n");
+ fprintf(stderr, "\n");
+ exit(1);
+}
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int c;
+ int ip;
+ int type;
+ int offscl;
+ int verbose=0;
+ int dods9=0;
+ int skytopix=1;
+ int tltyp[2];
+ double dval1, dval2, dval3, dval4;
+ double tlmin[2];
+ double binsiz[2];
+ char sp=' ';
+ char iname[SZ_LINE];
+ char lbuf[SZ_LINE];
+ char tbuf1[SZ_LINE];
+ char tbuf2[SZ_LINE];
+ char *s0, *s1;
+ Fun fun;
+ void *wcs;
+
+ /* exit on gio errors */
+ if( !getenv("GERROR") )
+ setgerror(2);
+
+ /* we want the args in the same order in which they arrived, and
+ gnu getopt sometimes changes things without this */
+ putenv("POSIXLY_CORRECT=true");
+
+ /* process switch arguments */
+ while ((c = getopt(argc, argv, "drvT")) != -1){
+ switch(c){
+ case 'd':
+ dods9=1;
+ break;
+ case 'r':
+ skytopix=0;
+ break;
+ case 'v':
+ verbose=1;
+ break;
+ case 'T':
+ sp = '\t';
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* check for required arguments */
+ if( (argc - optind) != 1 ){
+ usage(argv[0]);
+ }
+
+ /* input file name */
+ strcpy(iname, argv[optind+0]);
+
+ /* open input file */
+ if( !(fun = FunOpen(iname, "r", NULL)) ){
+ gerror(stderr, "can't FunOpen input file (or find extension): %s\n", iname);
+ }
+
+ /* get wcs info */
+ FunInfoGet(fun, FUN_WCS, &wcs, FUN_TYPE, &type, 0);
+
+ /* for tables, we need some extra column info */
+ switch(type){
+ case FUN_TABLE:
+ case FUN_EVENTS:
+ s0 = fun->header->table->col[fun->bin[0]].name;
+ s1 = fun->header->table->col[fun->bin[1]].name;
+ if( s0 ){
+ FunColumnLookup(fun, s0, 0, NULL, &tltyp[0], NULL, NULL, NULL, NULL);
+ FunColumnLookup2(fun, s0, 0, &tlmin[0], NULL, &binsiz[0], NULL, NULL);
+ }
+ else{
+ tlmin[0] = 0;
+ binsiz[0] = 0;
+ tltyp[0] = 'I';
+ }
+ if( s1 ){
+ FunColumnLookup(fun, s1, 0, NULL, &tltyp[1], NULL, NULL, NULL, NULL);
+ FunColumnLookup2(fun, s1, 0, &tlmin[1], NULL, &binsiz[1], NULL, NULL);
+ }
+ else{
+ tlmin[1] = 0;
+ binsiz[1] = 0;
+ tltyp[1] = 'I';
+ }
+ break;
+ default:
+ break;
+ }
+
+ if( dods9 ){
+ tltyp[0] = 'J';
+ tltyp[1] = 'J';
+ }
+
+ if( !iswcs(wcs) ){
+ gerror(stderr, "could not load WCS information from header: %s\n", iname);
+ }
+
+ /* output header if necessary */
+ if( sp == '\t' ){
+ if( skytopix ){
+ if( verbose ) fprintf(stdout, " RA\t Dec\t");
+ fprintf(stdout, " X\t Y\n");
+ if( verbose ) fprintf(stdout, "------------\t------------\t");
+ fprintf(stdout, "------------\t------------\n");
+ }
+ else{
+ if( verbose ) fprintf(stdout, " X\t Y\t");
+ fprintf(stdout, " RA\t Dec\n");
+ if( verbose ) fprintf(stdout, "------------\t------------\t");
+ fprintf(stdout, "------------\t------------\n");
+ }
+ fflush(stdout);
+ }
+
+ /* read lines, split into 2 args, convert, and output */
+ newdtable(",");
+ while( fgets(lbuf, SZ_LINE, stdin) ){
+ ip = 0;
+ if( !word(lbuf, tbuf1, &ip) || !word(lbuf, tbuf2, &ip) ) break;
+ dval1 = SAOstrtod(tbuf1,NULL);
+ if( (SAOdtype !=0) && (SAOdtype != '.') && (SAOdtype != 'd') ){
+ dval1 = h2d(dval1);
+ }
+ dval2 = SAOstrtod(tbuf2,NULL);
+ if( skytopix ){
+ wcs2pix(wcs, dval1, dval2, &dval3, &dval4, &offscl);
+ if( verbose ) fprintf(stdout, "%12.6f%c%12.6f%c", dval1, sp, dval2, sp);
+ switch(type){
+ case FUN_IMAGE:
+ case FUN_ARRAY:
+ fprintf(stdout, "%12.2f%c%12.2f\n", dval3, sp, dval4);
+ break;
+ case FUN_TABLE:
+ case FUN_EVENTS:
+ dval3 = tli2p(dval3, tlmin[0], binsiz[0], tltyp[0]);
+ dval4 = tli2p(dval4, tlmin[1], binsiz[1], tltyp[1]);
+ fprintf(stdout, "%12.2f%c%12.2f\n", dval3, sp, dval4);
+ break;
+ default:
+ gerror(stderr, "unknown FITS data type\n");
+ break;
+ }
+ fflush(stdout);
+ }
+ else{
+ switch(type){
+ case FUN_IMAGE:
+ case FUN_ARRAY:
+ break;
+ case FUN_TABLE:
+ case FUN_EVENTS:
+ dval1 = tlp2i(dval1, tlmin[0], binsiz[0], tltyp[0]);
+ dval2 = tlp2i(dval2, tlmin[1], binsiz[1], tltyp[1]);
+ break;
+ default:
+ gerror(stderr, "unknown FITS data type\n");
+ break;
+ }
+ pix2wcs(wcs, (double)dval1, (double)dval2, &dval3, &dval4);
+ if( verbose ) fprintf(stdout, "%12.2f%c%12.2f%c", dval1, sp, dval2, sp);
+ fprintf(stdout, "%12.6f%c%12.6f\n", dval3, sp, dval4);
+ fflush(stdout);
+ }
+ }
+ freedtable();
+
+ /* close up shop */
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/funstack b/funtools/funtest/funstack
new file mode 100755
index 0000000..bbcfc3d
--- /dev/null
+++ b/funtools/funtest/funstack
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+if [ x"$3" = x ]; then
+ echo "usage: $0 ifile ofile regions"
+ echo "The regions specification should be in physical coords and can be:"
+ echo " a region string e.g. 'circle 512 512 .1;box(606,606,3,4)'"
+ echo " a region file e.g. 'foo.reg' (nb: s9 file OK, but no @ prefix)"
+ exit 1
+fi
+
+# input parameters
+IFILE=$1
+OFILE=$2
+REGIONS=$3
+
+# temporary fits file
+TFITS=./tfunstack.fits
+rm -f ${TFITS}
+
+# temporary funcalc command file
+TFC=./tfunstack.fc
+rm -f ${TFC}
+
+# convert file to region string, if necessary
+if [ -r "${REGIONS}" ]; then
+ REGIONS=`cat ${REGIONS} | awk '{print $0";"}'`
+fi
+
+# generate the funcalc command file from region string
+# we do this so that awk can parse the region and add in the region centers
+echo "${REGIONS}" | \
+sed '/^physical/d;s/[\(\),]/ /g' | \
+sed '/^#/d;/^global/d' | \
+awk 'BEGIN{RS=";"};
+BEGIN{
+ print "local"
+ print "int nreg;"
+ print "int xdim, ydim;"
+ print "double xmin, xmax, umin, ymax;"
+ print "double xref, yref;"
+ print "double xreg[1024], yreg[1024];"
+ print "end"
+ print "before"
+ print "FunInfoGet(fun, FUN_SECT_DIM1, &xdim, FUN_SECT_DIM2, &ydim, 0);"
+ print "FunInfoGet(fun, FUN_MIN1, &xmin, FUN_MAX1, &xmax, 0);"
+ print "FunInfoGet(fun, FUN_MIN2, &ymin, FUN_MAX2, &ymax, 0);"
+ print "xref = (xmin + xmax)/2.0;"
+ print "yref = (ymin + ymax)/2.0;"
+ i=1
+};
+{
+ if( ($1!="polygon") && ($1!="pie") ){
+ if( ($2 != "") && ($3 != "") ){
+ print "xreg["i"]="$2";"
+ print "yreg["i"]="$3";"
+ i = i+1
+ }
+ if( i >= 1024 ){
+ printf "ERROR: too many regions (1024 max)" > "dev/stderr"
+ exit
+ }
+ }
+}
+END{
+ print "nreg="i-1";"
+ print "end"
+ print "if( cur->region > nreg ){"
+ print " gerror(stderr, \"%d exceeds input reg %d\\n\", cur-> region, nreg);"
+ print " exit(1);"
+ print "}"
+ print "cur->x = cur->x - xreg[cur->region] + xref;"
+ print "cur->y = cur->y - yreg[cur->region] + yref;"
+}' > ${TFC}
+
+# funtools seems to rearrange the order of columns when $REGION is specified
+# so here we get the column names explicitly to preserve order
+COLS=`funhead ${IFILE} | egrep 'TTYPE[0-9]' | awk '{print $3}' | sed "s/'//g"`
+
+# first filter the input file and preserve the region ids
+funtable ${IFILE}"[${REGIONS}]" ${TFITS} "${COLS} "'$REGION'
+
+# now run the funcalc script to stack the events
+funcalc -f ${TFC} ${TFITS} ${OFILE}
+
+# clean up
+rm -f ${TFC} ${TFITS}
diff --git a/funtools/funtest/funtest b/funtools/funtest/funtest
new file mode 100755
index 0000000..c2515ec
--- /dev/null
+++ b/funtools/funtest/funtest
@@ -0,0 +1,195 @@
+#!/bin/sh
+
+TEXT=0
+CONTAINED=0
+DYNAMIC=0
+PROCESS=0
+
+INDEX=0
+NOINDEX=0
+
+ROOT=foo
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -a0)
+ DYNAMIC=1
+ INDEX=1
+ NOINDEX=1
+ shift
+ continue;;
+
+ -a1)
+ DYNAMIC=1
+ PROCESS=1
+ INDEX=1
+ NOINDEX=1
+ shift
+ continue;;
+
+ -a2)
+ DYNAMIC=1
+ PROCESS=1
+ CONTAINED=1
+ INDEX=1
+ NOINDEX=1
+ shift
+ continue;;
+
+ -a3)
+ DYNAMIC=1
+ PROCESS=1
+ CONTAINED=1
+ TEXT=1
+ INDEX=1
+ NOINDEX=1
+ shift
+ continue;;
+
+ -b)
+ INDEX=1
+ NOINDEX=1
+ shift
+ continue;;
+
+ -c)
+ CONTAINED=1
+ shift
+ continue;;
+
+ -d)
+ DYNAMIC=1
+ shift
+ continue;;
+
+ -i)
+ INDEX=1
+ shift
+ continue;;
+
+ -n)
+ NOINDEX=1
+ shift
+ continue;;
+
+ -p)
+ PROCESS=1
+ shift
+ continue;;
+
+ -t)
+ TEXT=1
+ shift
+ continue;;
+
+ -z)
+ FILTER_PAINT=true
+ export FILTER_PAINT
+ shift
+ continue;;
+
+ *)
+ shift
+ continue;;
+ esac
+done
+
+if [ $TEXT = 0 -a $CONTAINED = 0 -a $DYNAMIC = 0 -a $PROCESS = 0 ]; then
+ DYNAMIC=1
+ PROCESS=1
+ TEXT=1
+fi
+
+if [ $INDEX = 0 -a $NOINDEX = 0 ]; then
+ INDEX=1
+fi
+
+echo " "
+echo "dynamic=$DYNAMIC text=$TEXT process=$PROCESS contained=$CONTAINED"
+echo "index=$INDEX noindex=$NOINDEX"
+if [ x$FILTER_PAINT = xtrue ]; then
+ X=z
+ echo "filter paint mode is on"
+else
+ X=""
+fi
+echo "testing against old funcnts: `which funcnts`"
+echo "making evread ..."
+make evread
+echo " "
+
+FILTER_IDX_DEBUG=0
+export FILTER_IDX_DEBUG
+
+if [ x$DYNAMIC = x1 ]; then
+ echo "dynamic ..."
+ FILTER_PTYPE=d
+ export FILTER_PTYPE
+ if [ x$INDEX = x1 ]; then
+ echo "with index ..."
+ date
+ FILTER_IDX_ACTIVATE=1
+ export FILTER_IDX_ACTIVATE
+ ./funtests $* >${ROOT}.id$X 2>&1
+ if [ x$TEXT = x1 ]; then
+ echo "... and with text ..."
+ date
+ ./funtexts > ${ROOT}.it$X 2>&1
+ fi
+ fi
+ if [ x$NOINDEX = x1 ]; then
+ echo "no index ..."
+ date
+ FILTER_IDX_ACTIVATE=0
+ export FILTER_IDX_ACTIVATE
+ ./funtests $* >${ROOT}.nd$X 2>&1
+ if [ x$TEXT = x1 ]; then
+ echo "... and with text ..."
+ date
+ ./funtexts > ${ROOT}.nt$X 2>&1
+ fi
+ fi
+fi
+
+if [ x$PROCESS = x1 ]; then
+ echo "process ..."
+ FILTER_PTYPE=p
+ export FILTER_PTYPE
+ if [ x$INDEX = x1 ]; then
+ echo "with index ..."
+ date
+ FILTER_IDX_ACTIVATE=1
+ export FILTER_IDX_ACTIVATE
+ ./funtests $* >${ROOT}.ip$X 2>&1
+ fi
+ if [ x$NOINDEX = x1 ]; then
+ echo "no index ..."
+ date
+ FILTER_IDX_ACTIVATE=0
+ export FILTER_IDX_ACTIVATE
+ ./funtests $* >${ROOT}.np$X 2>&1
+ fi
+fi
+
+if [ x$CONTAINED = x1 ]; then
+ echo "contained ..."
+ FILTER_PTYPE=c
+ export FILTER_PTYPE
+ if [ x$INDEX = x1 ]; then
+ echo "with index ..."
+ date
+ FILTER_IDX_ACTIVATE=1
+ export FILTER_IDX_ACTIVATE
+ ./funtests $* >${ROOT}.ic$X 2>&1
+ fi
+ if [ x$NOINDEX = x1 ]; then
+ echo "no index ..."
+ date
+ FILTER_IDX_ACTIVATE=0
+ export FILTER_IDX_ACTIVATE
+ ./funtests $* >${ROOT}.nc$X 2>&1
+ fi
+fi
+
+echo "done"
+date
diff --git a/funtools/funtest/funtesti b/funtools/funtest/funtesti
new file mode 100755
index 0000000..e84c770
--- /dev/null
+++ b/funtools/funtest/funtesti
@@ -0,0 +1,18 @@
+#!/bin/tcsh -f
+rm -f foo.idx foo.noidx
+
+# setenv FILTER_PTYPE c
+setenv FILTER_IDX_DEBUG 0
+
+setenv FILTER_IDX_ACTIVATE 1
+date >> foo.idx
+funtests >>& foo.idx
+date >> foo.idx
+
+setenv FILTER_IDX_ACTIVATE 0
+date > foo.noidx
+funtests >>& foo.noidx
+date >> foo.noidx
+
+
+
diff --git a/funtools/funtest/funtests b/funtools/funtest/funtests
new file mode 100755
index 0000000..df7079f
--- /dev/null
+++ b/funtools/funtest/funtests
@@ -0,0 +1,127 @@
+#!/bin/sh
+# set -x
+
+ARGS=$*
+
+echo "************** Executing tfundisp with regions **************"
+echo " "
+tfundisp $ARGS < tregions.in
+
+echo "************** Executing tfundisp with boxes, ellipses **************"
+echo " "
+tfundisp $ARGS < tboxell.in
+
+echo "************** Executing tfundisp with columns **************"
+echo " "
+tfundisp $ARGS < tcols.in
+
+echo "************** Executing tfunhead **************"
+echo " "
+tfunhead $ARGS < thead.in
+
+echo "************** Executing tfuncalc **************"
+echo " "
+tfuncalc < tcalc.in
+
+echo "************** Executing tfunmerge **************"
+echo " "
+tfunmerge < tmerge.in
+
+echo "************** Executing tfuncone **************"
+echo " "
+tfuncone < tcone.in
+
+echo "************** Executing tfuncnts **************"
+echo " "
+tfuncnts $ARGS < tregions.in
+
+echo "************** Executing tfuncnts with filter **************"
+echo " "
+tfuncnts $ARGS -b "pha=5:7&&pi=6:8" < tregions.in
+
+echo "************** Executing tfuncnts with boxes, ellipses **************"
+echo " "
+tfuncnts $ARGS < tboxell.in
+
+echo "************** Executing tfundisp with paren checks **************"
+echo " "
+tfundisp $ARGS < tparen.in
+
+echo "************** Executing tfundisp with filter **************"
+echo " "
+tfundisp $ARGS -b "pha=5:7&&pi=6:8&&" < tregions.in
+
+echo "************** Executing tfundisp w/include file **************"
+echo " "
+tfundisp -i -b "pha=5:7&&pi=6:8&&" $ARGS < tregions.in
+
+echo "************** Executing timev [*,*,2] **************"
+echo " "
+
+timev $ARGS -b "[*,*,2]" < tregions.in
+
+echo "************** Executing timev [*,*,3] **************"
+echo " "
+timev $ARGS -b "[*,*,3]" < tregions.in
+
+echo "************** Executing timev [404:603,412:611] **************"
+echo " "
+timev $ARGS -b "[404:603,412:611]" < tregions.in
+
+echo "************** Executing timev [404:603,412:611,2] **************"
+echo " "
+timev $ARGS -b "[404:603,412:611,2]" < tregions.in
+
+echo "************** Executing timev [404:603,412:611,3] **************"
+echo " "
+timev $ARGS -b "[404:603,412:611,3]" < tregions.in
+
+echo "************** Executing tfuncnts, blocked w/phys. coords **********"
+echo " "
+tfuncnts -f1 ${HOME}/data/snr2.fits -c physical $ARGS < tregions.in
+
+echo "************** Executing tfuncnts on files **************"
+echo " "
+tfuncnts $ARGS < tfile.in
+
+echo "************** Executing tfundisp on files **************"
+echo " "
+tfundisp $ARGS < tfile.in
+
+echo "************** Executing tfundisp w/include file **************"
+echo " "
+tfundisp -i -b "pha=5:7&&pi=6:8&&" $ARGS < tfile.in
+
+echo "************** Executing tfundisp with filter2 **************"
+echo " "
+tfundisp $ARGS -b "(pha=5:7||pi=6:8)&&" < tregions.in
+
+echo "************** Executing tfundisp with filter3 **************"
+echo " "
+tfundisp $ARGS -b "(pha=5:7,pi=6:8)&&" < tregions.in
+
+echo "************** Executing tfunimage with sections **************"
+echo " "
+if [ x"$TXT" = x0 ]; then
+ tfunimage $ARGS < tsections.in
+else
+ F2=`echo "$ARGS" | awk '{print $3}'`
+ F1=`echo $T | awk -F. '{print $1}'`.fits
+ tfunimage -f $F1 $F2 < tsections.in
+fi
+
+echo "************** Executing tevread with regions **************"
+echo " "
+tevread $ARGS < tregions.in
+
+echo "************** Executing tevread with column filters **************"
+echo " "
+tevread $ARGS < tcols.in
+
+echo "************** Executing tfunview **************"
+echo " "
+tfunview $ARGS < tview.in
+
+echo "************** Executing tfunview with alt view db **************"
+echo " "
+tfunview -f ./funtools2.vu $ARGS < tview.in
diff --git a/funtools/funtest/funtexts b/funtools/funtest/funtexts
new file mode 100755
index 0000000..e5c5088
--- /dev/null
+++ b/funtools/funtest/funtexts
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+tfuntext $* < ttext.in
+
+TEXT_EXTNAME=EVENTS
+export TEXT_EXTNAME
+
+S=$HOME/data/snr.ev
+T=$HOME/data/snr.txt.gz
+
+export S
+export T
+
+funtests -f2 $S $T $*
diff --git a/funtools/funtest/funtools1.vu b/funtools/funtest/funtools1.vu
new file mode 100644
index 0000000..a8fb74b
--- /dev/null
+++ b/funtools/funtest/funtools1.vu
@@ -0,0 +1,10 @@
+view file format columns filter
+------ ---------------------- -------------- ------------ ---------------
+x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
+x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
+x1 ${HOME}/data/snr.ev cir 512 512 .1
+x0 ${HOME}/data/snr.ev
+xf I=%4d
+xc x y pi pha
+xr cir 512 512 .1
+ *.fit x y pi pha cir 512 512 .1
diff --git a/funtools/funtest/funtools2.vu b/funtools/funtest/funtools2.vu
new file mode 100644
index 0000000..81eefdd
--- /dev/null
+++ b/funtools/funtest/funtools2.vu
@@ -0,0 +1,11 @@
+VIEW FILE FORMAT COLUMNS FILTER
+---- -------------------- ------ ------------ ----------------
+x3 ${HOME}/data/snr.ev 'I=%4d' 'x y pi pha' 'cir 512 512 .1'
+x2 ${HOME}/data/snr.ev '' 'x y pi pha' 'cir 512 512 .1'
+x1 ${HOME}/data/snr.ev '' '' 'cir 512 512 .1'
+x0 ${HOME}/data/snr.ev '' '' ''
+xf '' 'I=%4d' '' ''
+xc '' '' 'x y pi pha' ''
+xr '' '' '' 'cir 512 512 .1'
+'' *.fit '' 'x y pi pha' 'cir 512 512 .1'
+
diff --git a/funtools/funtest/goo.ls b/funtools/funtest/goo.ls
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/funtools/funtest/goo.ls
diff --git a/funtools/funtest/group.calc b/funtools/funtest/group.calc
new file mode 100644
index 0000000..ef5543f
--- /dev/null
+++ b/funtools/funtest/group.calc
@@ -0,0 +1,125 @@
+/* globals go before main */
+global
+#define SAVEINC 100
+/* not available before 1.3.0b25 */
+#define I __i
+/* our save record contains a funcalc row record and a place for raw data */
+typedef struct savestruct{
+ RowRec row;
+ char *raw;
+} *Save, SaveRec;
+
+/* qsort comparison routine -- reverse order of x */
+static int _Cmp(const void *s1, const void *s2)
+{
+ Save f1 = (Save)s1;
+ Save f2 = (Save)s2;
+ /* order flag */
+ if( f1->row.x < f2->row.x )
+ return -1;
+ if( f1->row.x > f2->row.x )
+ return 1;
+ else
+ return 0;
+}
+
+/* this is the heart of the algorithm */
+static void ProcessRows(Fun fun, Fun ofun, Save save, int nsave)
+{
+ int i;
+ /* sort rows */
+ qsort(save, nsave, sizeof(SaveRec), _Cmp);
+ /* output rows in new order */
+ for(i=0; i<nsave; i++){
+ /* re-associate raw data with this row */
+ FunInfoPut(fun, FUN_RAWBUF, &save[i].raw, 0);
+ /* write the row */
+ FunTableRowPut(ofun, &save[i].row, 1, 0, NULL);
+ }
+}
+end
+
+/* locals go immediately after local variables in main */
+local
+ char *cptr=NULL;
+ char *rptr=NULL;
+ int i=0;
+ int group=0;
+ int rawsize=0;
+ int lastkey=0;
+ int maxsave=0;
+ int nsave=0;
+ Save save=NULL;
+end
+
+/* execute this before we enter inner loop */
+before
+ /* get size of raw input record */
+ FunInfoGet(fun, FUN_RAWSIZE, &rawsize, 0);
+end
+
+/* MAIN ROW PROCESSING LOOP */
+
+/* first time through, just seed last key */
+if( NROW == 0 ) lastkey=cur->key;
+
+/* save raw data for this set of rows */
+FunInfoGet(fun, FUN_RAWBUF, &rptr, 0);
+
+/* if this key starts a new group, process and output previous group */
+if( cur->key != lastkey ){
+ /* process current group */
+ ProcessRows(fun, ofun, save, nsave);
+ /* restore the current row pointers so we can process the next row */
+ FunInfoPut(fun, FUN_RAWBUF, &rptr, 0);
+ /* reset number of keys in this group */
+ nsave = 0;
+ /* got another group */
+ group++;
+}
+
+/* user manipulation */
+/* set values of a new column */
+cur->group:I = group;
+/* manipulate one of the user columns */
+cur->x = -cur->x;
+
+/* save this row ... first make sure we have enough space */
+if( nsave >= maxsave ){
+ maxsave += SAVEINC;
+ if( !save )
+ save = xmalloc(maxsave*sizeof(SaveRec));
+ else
+ save = xrealloc(save, maxsave*sizeof(SaveRec));
+ /* clear what we just alloc'ed (wish realloc() would do this! */
+ memset(save+((maxsave-SAVEINC)*sizeof(SaveRec)), 0, SAVEINC*sizeof(SaveRec));
+}
+/* save the user part of this row */
+memcpy(&(save[nsave].row), cur, sizeof(RowRec));
+/* might have to allocate space for raw */
+if( !save[nsave].raw ) save[nsave].raw = xmalloc(rawsize);
+/* save raw data for this row */
+memcpy(save[nsave].raw, rptr+(I*rawsize), rawsize);
+/* saved another key in this group */
+nsave++;
+
+/* this key becomes last key */
+lastkey = cur->key;
+
+/* prevent funcalc from writing out the current record */
+continue;
+
+/* END OF INNER LOOP */
+
+/* after we leave inner loop */
+after
+ /* process rows in last group */
+ ProcessRows(fun, ofun, save, nsave);
+ /* restore raw buf pointer so FunClose can free it properly */
+ FunInfoPut(fun, FUN_RAWBUF, &rptr, 0);
+ /* clean up saved data */
+ for(i=0; i<maxsave; i++){
+ if( save[i].raw ) xfree(save[i].raw);
+ }
+ if( save ) xfree(save);
+end
diff --git a/funtools/funtest/imblank.c b/funtools/funtest/imblank.c
new file mode 100644
index 0000000..309aa1f
--- /dev/null
+++ b/funtools/funtest/imblank.c
@@ -0,0 +1,107 @@
+#include <funtools.h>
+#include <stdlib.h>
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int i;
+ int bitpix, dim1, dim2;
+ int total;
+ double blimit, bvalue;
+ char *buf;
+ unsigned char *cbuf;
+ short *sbuf;
+ int *ibuf;
+ float *fbuf;
+ double *dbuf;
+ Fun fun, fun2;
+
+ if( argc < 4 ){
+ fprintf(stderr, "usage: %s iname oname blimit bvalue\n", argv[0]);
+ exit(1);
+ }
+
+ /* get blank limit and optional blank value */
+ blimit = atof(argv[3]);
+ bvalue = 0;
+ if( argc >= 5 )
+ bvalue = atof(argv[4]);
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* open the input FITS file */
+ if( !(fun = FunOpen(argv[1], "rc", NULL)) )
+ gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
+
+ /* open the output FITS image, preparing to copy input params */
+ if( !(fun2 = FunOpen(argv[2], "w", fun)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
+
+ /* extract and bin the data section into an image buffer */
+ if( !(buf = FunImageGet(fun, NULL, NULL)) )
+ gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
+
+ /* get required information from funtools structure.
+ this should come after the ImageGet call, in case that call
+ changed fun_sect_bitpix value */
+ FunInfoGet(fun,
+ FUN_SECT_BITPIX, &bitpix,
+ FUN_SECT_DIM1, &dim1,
+ FUN_SECT_DIM2, &dim2,
+ 0);
+
+ /* set appropriate data type buffer to point to image buffer */
+ switch(bitpix){
+ case 8:
+ cbuf = (unsigned char *)buf; break;
+ case 16:
+ sbuf = (short *)buf; break;
+ case 32:
+ ibuf = (int *)buf; break;
+ case -32:
+ fbuf = (float *)buf; break;
+ case -64:
+ dbuf = (double *)buf; break;
+ }
+
+ /* loop through pixels and reset values below limit to value */
+ total = dim1*dim2;
+ for(i=0; i<total; i++){
+ switch(bitpix){
+ case 8:
+ if( cbuf[i] <= blimit ) cbuf[i] = bvalue;
+ break;
+ case 16:
+ if( sbuf[i] <= blimit ) sbuf[i] = bvalue;
+ break;
+ case 32:
+ if( ibuf[i] <= blimit ) ibuf[i] = bvalue;
+ break;
+ case -32:
+ if( fbuf[i] <= blimit ) fbuf[i] = bvalue;
+ break;
+ case -64:
+ if( dbuf[i] <= blimit ) dbuf[i] = bvalue;
+ break;
+ }
+ }
+
+ /* write the output image, updating the FITS header from the orig file */
+ if( !FunImagePut(fun2, buf, 0, 0, 0, NULL) )
+ gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
+
+ /* free up space */
+ if( buf ) free(buf);
+
+ /* close output first so that flush happens automatically */
+ FunClose(fun2);
+ FunClose(fun);
+ return(0);
+}
diff --git a/funtools/funtest/imtest.c b/funtools/funtest/imtest.c
new file mode 100644
index 0000000..25e35fa
--- /dev/null
+++ b/funtools/funtest/imtest.c
@@ -0,0 +1,156 @@
+#include <funtools.h>
+#include <stdlib.h>
+#include <file.h>
+
+extern char *optarg;
+extern int optind;
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int i, j;
+ int c;
+ int args;
+ int ptype;
+ int dim1, dim2, bitpix, skip, bigendian;
+ int tdim;
+ char dims[SZ_LINE];
+ char *buf=NULL;
+ char *iname=NULL, *oname=NULL;
+
+ unsigned char *cbuf;
+ short *sbuf;
+ int *ibuf;
+ float *fbuf;
+ double *dbuf;
+ double *dbuf2;
+
+ Fun ifun=NULL, ofun=NULL;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* we want the args in the same order in which they arrived, and
+ gnu getopt sometimes changes things without this */
+ putenv("POSIXLY_CORRECT=true");
+
+ /* process switch arguments */
+ while ((c = getopt(argc, argv, "c:l")) != -1){
+ switch(c){
+ case 'c':
+ ptype = 'c';
+ strcpy(dims, optarg);
+ ParseArraySpec(dims, &dim1, &dim2, &bitpix, &skip, &bigendian);
+ break;
+ case 'l':
+ ptype = 'l';
+ break;
+ }
+ }
+
+ /* check for required arguments */
+ args = argc - optind;
+ switch(ptype){
+ case 'c':
+ if( args < 1 )
+ gerror(stderr, "usage: %s -c dims fname\n", argv[0]);
+ iname = NULL;
+ oname = argv[optind++];
+ break;
+ case 'l':
+ if( args < 2 )
+ gerror(stderr, "usage: %s -l iname oname\n", argv[0]);
+ iname = argv[optind++];
+ oname = argv[optind++];
+ break;
+ default:
+ gerror(stderr, "usage: %s requires -c [dims] or -l\n", argv[0]);
+ }
+
+ /* open the input FITS file */
+ if( iname ){
+ if( !(ifun = FunOpen(iname, "r", NULL)) )
+ gerror(stderr, "could not FunOpen input file: %s\n", argv[optind-1]);
+ }
+
+ /* open the output FITS file */
+ if( oname ){
+ if( !(ofun = FunOpen(oname, "w", NULL)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[optind-1]);
+ }
+
+ /* set appropriate data type buffer to point to image buffer */
+ if( ptype == 'c' ){
+ /* allocate the buffer */
+ tdim = dim1*dim2;
+ buf = malloc(tdim*ft_sizeof(bitpix));
+ switch(bitpix){
+ case 8:
+ cbuf = (unsigned char *)buf;
+ for(i=0; i<tdim; i++)
+ cbuf[i] = i;
+ break;
+ case 16:
+ sbuf = (short *)buf;
+ for(i=0; i<tdim; i++)
+ sbuf[i] = i;
+ break;
+ case 32:
+ ibuf = (int *)buf;
+ for(i=0; i<tdim; i++)
+ ibuf[i] = i;
+ break;
+ case -32:
+ fbuf = (float *)buf;
+ for(i=0; i<tdim; i++)
+ fbuf[i] = i;
+ break;
+ case -64:
+ dbuf = (double *)buf;
+ for(i=0; i<tdim; i++)
+ dbuf[i] = i;
+ break;
+ }
+ /* write the output image, updating the FITS header from the orig file */
+ if( ofun && buf ){
+ if( !FunImagePut(ofun, buf, dim1, dim2, bitpix, NULL) )
+ gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
+ }
+ if( buf ) free(buf);
+ }
+
+ /* reverse each line of the image */
+ if( ptype == 'l' ){
+ /* get required information from funtools structure */
+ FunInfoGet(ifun,
+ FUN_SECT_DIM1, &dim1,
+ FUN_SECT_DIM2, &dim2,
+ 0);
+ /* we will generate an image of type double xon output */
+ dbuf = malloc(dim1 * sizeof(double));
+ dbuf2 = malloc(dim1 * sizeof(double));
+ for(i=1; i<=dim2; i++){
+ /* reach next line */
+ if( !FunImageRowGet(ifun, dbuf, i, i, "bitpix=-64") )
+ gerror(stderr, "could not FunImageRowGet: %d %s\n", i, iname);
+ /* reverse the line */
+ for(j=1; j<=dim1; j++){
+ dbuf2[dim1-j] = dbuf[j-1];
+ }
+ /* write theline */
+ FunImageRowPut(ofun, dbuf2, i, i, dim1, dim2, -64, NULL);
+ }
+ if( dbuf ) free(dbuf);
+ if( dbuf2 ) free(dbuf2);
+ }
+
+ if( ifun ) FunClose(ifun);
+ if( ofun ) FunClose(ofun);
+ return(0);
+}
diff --git a/funtools/funtest/install-sh b/funtools/funtest/install-sh
new file mode 100755
index 0000000..36f96f3
--- /dev/null
+++ b/funtools/funtest/install-sh
@@ -0,0 +1,276 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd=$cpprog
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "$0: no input file specified" >&2
+ exit 1
+else
+ :
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d "$dst" ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=$mkdirprog
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f "$src" ] || [ -d "$src" ]
+ then
+ :
+ else
+ echo "$0: $src does not exist" >&2
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "$0: no destination specified" >&2
+ exit 1
+ else
+ :
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d "$dst" ]
+ then
+ dst=$dst/`basename "$src"`
+ else
+ :
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+ '
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp=$pathcomp$1
+ shift
+
+ if [ ! -d "$pathcomp" ] ;
+ then
+ $mkdirprog "$pathcomp"
+ else
+ :
+ fi
+
+ pathcomp=$pathcomp/
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd "$dst" &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ dstfile=`basename "$dst" $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ :
+ fi
+
+# Make a couple of temp file names in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+ rmtmp=$dstdir/#rm.$$#
+
+# Trap to clean up temp files at exit.
+
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd "$src" "$dsttmp" &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
+
+# Now remove or move aside any old file at destination location. We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons. In this case, the final cleanup
+# might fail but the new file should still install successfully.
+
+{
+ if [ -f "$dstdir/$dstfile" ]
+ then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+ $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+ {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+} &&
+
+# Now rename the file to the real destination.
+
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+
+fi &&
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+
+{
+ (exit 0); exit
+}
diff --git a/funtools/funtest/mif.lst b/funtools/funtest/mif.lst
new file mode 100644
index 0000000..0545c47
--- /dev/null
+++ b/funtools/funtest/mif.lst
@@ -0,0 +1,4 @@
+mif1.fits
+mif2.fits
+mif3.fits
+mif4.fits
diff --git a/funtools/funtest/mif1.fits b/funtools/funtest/mif1.fits
new file mode 100644
index 0000000..b8f750f
--- /dev/null
+++ b/funtools/funtest/mif1.fits
@@ -0,0 +1,2 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.120000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.129999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
+%…C=
diff --git a/funtools/funtest/mif2.fits b/funtools/funtest/mif2.fits
new file mode 100644
index 0000000..ab2fbaa
--- /dev/null
+++ b/funtools/funtest/mif2.fits
@@ -0,0 +1,2 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.110000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.129999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
+%…C=
diff --git a/funtools/funtest/mif3.fits b/funtools/funtest/mif3.fits
new file mode 100644
index 0000000..4f12c43
--- /dev/null
+++ b/funtools/funtest/mif3.fits
@@ -0,0 +1,2 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.120000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.119999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
+%…C=
diff --git a/funtools/funtest/mif4.fits b/funtools/funtest/mif4.fits
new file mode 100644
index 0000000..1a8bff9
--- /dev/null
+++ b/funtools/funtest/mif4.fits
@@ -0,0 +1,2 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.130000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.139999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
+%…C=
diff --git a/funtools/funtest/mkdim.c b/funtools/funtest/mkdim.c
new file mode 100644
index 0000000..d0f468d
--- /dev/null
+++ b/funtools/funtest/mkdim.c
@@ -0,0 +1,96 @@
+/* Solaris:
+ gcc -g -o mkdim mkdim.c -I /soft/saord/include -L/soft/saord/lib -lfuntools
+ -ldl -lsocket -lnsl -lm
+ OS X:
+ gcc -g -o mkdim mkdim.c -I /soft/saord/include -L/soft/saord/lib -lfuntools -lm
+
+*/
+
+#include <funtools.h>
+#include <stdlib.h>
+#include <string.h>
+#include <file.h>
+
+extern char *optarg;
+extern int optind;
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int dim1, dim2, bitpix;
+ int tdim;
+ char *buf=NULL;
+ char *oname=NULL;
+ char lbuf[SZ_LINE];
+ unsigned char *cbuf;
+ short *sbuf;
+ int *ibuf;
+ float *fbuf;
+ double *dbuf;
+ double x, y, val;
+ Fun ofun=NULL;
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ if( argc != 5 ){
+ gerror(stderr, "usage: cat tfile | %s oname xdim ydim bitpix\n", argv[0]);
+ return 1;
+ }
+ oname = argv[1];
+ dim1 = atoi(argv[2]);
+ dim2 = atoi(argv[3]);
+ bitpix = atoi(argv[4]);
+
+ /* open the output FITS file */
+ if( oname ){
+ if( !(ofun = FunOpen(oname, "w", NULL)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[optind-1]);
+ }
+
+ /* set appropriate data type buffer to point to image buffer */
+ /* allocate the buffer */
+ tdim = dim1*dim2;
+ buf = malloc(tdim*ft_sizeof(bitpix));
+ while( fgets(lbuf, SZ_LINE, stdin) ){
+ if( sscanf(lbuf, "%lf %lf %lf", &x, &y, &val) != 3 ){
+ gerror(stderr, "invalid input: requires x, y, val; got %s\n", lbuf);
+ }
+ switch(bitpix){
+ case 8:
+ cbuf = (unsigned char *)buf;
+ cbuf[(int)y*dim2+(int)x] = (unsigned char)val;
+ break;
+ case 16:
+ sbuf = (short *)buf;
+ sbuf[(int)y*dim2+(int)x] = (short)val;
+ break;
+ case 32:
+ ibuf = (int *)buf;
+ ibuf[(int)y*dim2+(int)x] = (int)val;
+ break;
+ case -32:
+ fbuf = (float *)buf;
+ fbuf[(int)y*dim2+(int)x] = (float)val;
+ break;
+ case -64:
+ dbuf = (double *)buf;
+ dbuf[(int)y*dim2+(int)x] = val;
+ break;
+ }
+ }
+ /* write the output image, updating the FITS header from the orig file */
+ if( ofun && buf ){
+ if( !FunImagePut(ofun, buf, dim1, dim2, bitpix, NULL) )
+ gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
+ }
+ if( buf ) free(buf);
+ if( ofun ) FunClose(ofun);
+ return(0);
+}
diff --git a/funtools/funtest/mkev.c b/funtools/funtest/mkev.c
new file mode 100644
index 0000000..5cb6722
--- /dev/null
+++ b/funtools/funtest/mkev.c
@@ -0,0 +1,335 @@
+#if HAVE_CONFIG_H
+#include <conf.h>
+#endif
+
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <math.h>
+#include <prsetup.h>
+#include <macro.h>
+#include <swap.h>
+#include <xalloc.h>
+
+#ifndef UNUSED
+#ifdef __GNUC__
+# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
+#else
+# define UNUSED(x) UNUSED_ ## x
+#endif
+#endif
+
+extern char *optarg;
+extern int optind;
+
+#ifndef ABS
+#define ABS(x) ((x)<0?(-x):(x))
+#endif
+
+#define EVSIZE 26
+
+#define FITS_HEADER "\
+SIMPLE = T / FITS STANDARD \
+BITPIX = 8 / Binary data \
+NAXIS = 0 / No image array present \
+EXTEND = T / There may be standard extensions \
+END \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE \
+BITPIX = 8 / Binary data \
+NAXIS = 2 / Table is a matrix \
+NAXIS1 = $EVSIZE / Width of table in bytes \
+NAXIS2 = $TEV / Number of entries in table \
+PCOUNT = 0 / Random parameter count \
+GCOUNT = 1 / Group count \
+TFIELDS = 7 / Number of fields in row \
+EXTNAME = 'EVENTS ' / Table name \
+EXTVER = 1 / Version number of table \
+TFORM1 = '1I ' / Data type for field \
+TTYPE1 = 'X ' / Label for field \
+TSCAL1 = 10.0 / Label for field \
+TZERO1 = 1.0 / Label for field \
+TUNIT1 = ' ' / Physical units for field \
+TFORM2 = '1I ' / Data type for field \
+TTYPE2 = 'Y ' / Label for field \
+TSCAL2 = 20.0 / Label for field \
+TZERO2 = 2.0 / Label for field \
+TUNIT2 = ' ' / Physical units for field \
+TFORM3 = '1I ' / Data type for field \
+TTYPE3 = 'PHA ' / Label for field \
+TUNIT3 = ' ' / Physical units for field \
+TFORM4 = '1J ' / Data type for field \
+TTYPE4 = 'PI ' / Label for field \
+TUNIT4 = ' ' / Physical units for field \
+TFORM5 = '1D ' / Data type for field \
+TTYPE5 = 'TIME ' / Label for field \
+TUNIT5 = ' ' / Physical units for field \
+TFORM6 = '1E ' / Data type for field \
+TTYPE6 = 'DX ' / Label for field \
+TUNIT6 = ' ' / Physical units for field \
+TFORM7 = '1E ' / Data type for field \
+TTYPE7 = 'DY ' / Label for field \
+TUNIT7 = ' ' / Physical units for field \
+RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) \
+EQUINOX = 2.000000E3 / equinox (epoch) for WCS \
+TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) \
+TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) \
+TCRVL1 = 9.000000000000000E1 / sky coord (deg.) \
+TCRVL2 = 6.000000000000000E1 / sky coord (deg.) \
+TCDLT1 = -1.00000000000000E-1 / degrees per pixel \
+TCDLT2 = 1.000000000000002E-1 / degrees per pixel \
+TCRPX1 = 5.000000000000000E0 / pixel of tangent plane direc. \
+TCRPX2 = 5.000000000000000E0 / pixel of tangent plane direc. \
+TCROT2 = 0.000000000000000E0 / rotation angle (degrees) \
+TLMIN1 = $IXLO / Min. axis value \
+TLMAX1 = $IXHI / Max. axis value \
+TLMIN2 = $IYLO / Min. axis value \
+TLMAX2 = $IYHI / Max. axis value \
+TLMIN6 = $XLO / Min. axis value \
+TLMAX6 = $XHI / Max. axis value \
+TLMIN7 = $YLO / Min. axis value \
+TLMAX7 = $XHI / Max. axis value \
+END \
+ "
+
+/* these are used in the macro expansion and must be global */
+static double xlo, xhi, ylo, yhi;
+static int tev;
+static char macrobuf[SZ_LINE];
+
+#ifdef ANSI_FUNC
+static char *
+MacroCB(char *name, void *UNUSED(client_data))
+#else
+static char *MacroCB(name, client_data)
+ char *name;
+ void *client_data;
+#endif
+{
+ if( !strcmp(name, "TEV") ){
+ sprintf(macrobuf, "%10d", tev);
+ return macrobuf;
+ }
+ else if( !strcmp(name, "XLO") ){
+ sprintf(macrobuf, "%10.2f", xlo);
+ return macrobuf;
+ }
+ else if( !strcmp(name, "XHI") ){
+ sprintf(macrobuf, "%10.2f", xhi);
+ return macrobuf;
+ }
+ else if( !strcmp(name, "IXLO") ){
+ if( xlo > 0 )
+ sprintf(macrobuf, "%10d", (int)xlo);
+ else
+ sprintf(macrobuf, "%10d", (int)ceil(xlo));
+ return macrobuf;
+ }
+ else if( !strcmp(name, "IXHI") ){
+ if( xhi > 0 )
+ sprintf(macrobuf, "%10d", (int)xhi);
+ else
+ sprintf(macrobuf, "%10d", (int)ceil(xhi));
+ return macrobuf;
+ }
+ else if( !strcmp(name, "DIM1") ){
+ sprintf(macrobuf, "%6d", (int)(xhi-xlo));
+ return macrobuf;
+ }
+ else if( !strcmp(name, "YLO") ){
+ sprintf(macrobuf, "%10.2f", ylo);
+ return macrobuf;
+ }
+ else if( !strcmp(name, "YHI") ){
+ sprintf(macrobuf, "%10.2f", yhi);
+ return macrobuf;
+ }
+ else if( !strcmp(name, "IYLO") ){
+ if( ylo > 0 )
+ sprintf(macrobuf, "%10d", (int)ylo);
+ else
+ sprintf(macrobuf, "%10d", (int)ceil(ylo));
+ return macrobuf;
+ }
+ else if( !strcmp(name, "IYHI") ){
+ if( yhi > 0 )
+ sprintf(macrobuf, "%10d", (int)yhi);
+ else
+ sprintf(macrobuf, "%10d", (int)ceil(yhi));
+ return macrobuf;
+ }
+ else if( !strcmp(name, "DIM2") ){
+ sprintf(macrobuf, "%6d", (int)(yhi-ylo));
+ return macrobuf;
+ }
+ else if( !strcmp(name, "EVSIZE") ){
+ sprintf(macrobuf, "%4d", EVSIZE);
+ return macrobuf;
+ }
+ else{
+ return NULL;
+ }
+}
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int c;
+ int convert;
+ int nev;
+ int ii, kk;
+ int pad;
+ int pi;
+ int args;
+ int doraw=0;
+ char *padbuf;
+ short x, y;
+ short pha;
+ double i, j;
+ double time;
+ float dx, dy;
+ char *s, *t;
+
+ /* process switch arguments */
+ while ((c = getopt(argc, argv, "r")) != -1){
+ switch(c){
+ case 'r':
+ doraw = 1;
+ break;
+ }
+ }
+
+ /* check for required arguments */
+ args = argc - optind;
+ /* process arguments */
+ if( args != 4 ){
+ fprintf(stderr, "usage: %s xlo xhi ylo yhi\n", argv[0]);
+ exit(1);
+ }
+ else{
+ xlo = atof(argv[optind]);
+ xhi = atof(argv[optind+1]);
+ ylo = atof(argv[optind+2]);
+ yhi = atof(argv[optind+3]);
+ }
+
+ /* get initial header string */
+ s = xstrdup(FITS_HEADER);
+ /* see if we have to convert to IEEE format */
+ convert = !is_bigendian();
+
+ /* determine how many events we will have */
+ for(tev=0,j=ylo; j<=yhi; j++){
+ for(i=xlo; i<=xhi; i++){
+ if( i != j )
+ nev = 1;
+ else
+ nev = ABS(i);
+ tev += nev;
+ }
+ }
+
+ /* expand header to fill in number of events and dimensions */
+ t = ExpandMacro(s, NULL, NULL, 0, MacroCB, NULL);
+
+ /* write header, if necessary */
+ if( !doraw ){
+ ii = strlen(t);
+ if( (ii % 2880) != 0 ){
+ fprintf(stderr, "internal error: bad size (%d) for header\n", ii);
+ }
+ write(1, t, ii);
+ }
+
+ /* write events */
+ for(tev=0,j=ylo; j<=yhi; j++){
+ for(i=xlo; i<=xhi; i++){
+ if( i != j )
+ nev = 1;
+ else
+ nev = ABS(i);
+ tev += nev;
+ for(kk=0; kk<nev; kk++){
+ x = i;
+ y = j;
+ pha = i;
+ pi = j;
+ time = (double)tev + (double)(i+j+kk)/100.0;
+ dx = i;
+ dy = j;
+ if( convert ){
+ swap_short(&x, 1);
+ swap_short(&y, 1);
+ swap_short(&pha, 1);
+ swap_int(&pi, 1);
+ swap_double(&time, 1);
+ swap_float(&dx, 1);
+ swap_float(&dy, 1);
+ }
+ write(1, &x, sizeof(short));
+ write(1, &y, sizeof(short));
+ write(1, &pha, sizeof(short));
+ write(1, &pi, sizeof(int));
+ write(1, &time, sizeof(double));
+ write(1, &dx, sizeof(float));
+ write(1, &dy, sizeof(float));
+ }
+ }
+ }
+
+ /* write padding, if necessary */
+ if( !doraw ){
+ pad = 2880 - ((tev*EVSIZE)%2880);
+ if( pad == 2880 ) pad = 0;
+ if( pad ){
+ padbuf = (char *)calloc(pad, sizeof(char));
+ write(1, padbuf, pad);
+ }
+ }
+
+ return(0);
+}
+
diff --git a/funtools/funtest/mkev2.c b/funtools/funtest/mkev2.c
new file mode 100644
index 0000000..98e706b
--- /dev/null
+++ b/funtools/funtest/mkev2.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(argc, argv)
+ int argc;
+ char **argv;
+{
+ int i;
+ int nrec;
+ unsigned char bval;
+ unsigned short usval;
+ unsigned int uival;
+ short sval;
+ int ival;
+ float fval;
+ double dval;
+
+ if( argc > 1 )
+ nrec = atoi(argv[1]);
+ else
+ nrec = 100;
+ if( nrec < 0 )
+ nrec = 100;
+
+ for(i=0; i<nrec; i++){
+ dval = (double)i + (double)i/nrec;
+ write(1, &dval, sizeof(dval));
+ fval = (float)-i;
+ write(1, &fval, sizeof(fval));
+ ival = i;
+ write(1, &ival, sizeof(ival));
+ sval = (short)-i;
+ write(1, &sval, sizeof(sval));
+ bval = (unsigned char)i;
+ write(1, &bval, sizeof(bval));
+
+ usval = (unsigned short)i;
+ write(1, &usval, sizeof(usval));
+
+ bval = (unsigned char)i;
+ write(1, &bval, sizeof(bval));
+ bval++;
+ write(1, &bval, sizeof(bval));
+ bval++;
+ write(1, &bval, sizeof(bval));
+
+ uival = (unsigned int)i;
+ write(1, &uival, sizeof(uival));
+ }
+ fprintf(stderr, "setenv EVENTS \"(dval:D,fval:E,ival:J,sval:I,bval:B,x16:16X,x24:24X,x32:32X)\"\n");
+ return(0);
+}
diff --git a/funtools/funtest/ntest.ev b/funtools/funtest/ntest.ev
new file mode 100644
index 0000000..155c02d
--- /dev/null
+++ b/funtools/funtest/ntest.ev
@@ -0,0 +1,98 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 26 / Width of table in bytes NAXIS2 = 296 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1J ' / Data type for field TFORM3 = '1D ' / Data type for field TFORM4 = '1E ' / Data type for field TFORM5 = '1E ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'PHA ' / Label for field TTYPE2 = 'PI ' / Label for field TTYPE3 = 'TIME ' / Label for field TTYPE4 = 'DX ' / Label for field TTYPE5 = 'DY ' / Label for field TTYPE6 = 'X ' / Label for field TTYPE7 = 'Y ' / Label for field TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TLMIN4 = -7.5000000 / Min. axis value TLMIN5 = -7.5000000 / Min. axis value TLMIN6 = 0 / Min. axis value TLMIN7 = 0 / Min. axis value TLMAX4 = 7.5000000 / Max. axis value TLMAX5 = 7.5000000 / Max. axis value TLMAX6 = 14 / Max. axis value TLMAX7 = 14 / Max. axis value RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) EQUINOX = 2.000000E3 / equinox (epoch) for WCS END ÿùÿÿÿù@ffffffÀð
+=qÀð
+=p¤Àð
+=qÀÐ
+=À°
+=p£×¿
+
+=@Ð
+=p¤ÀÐ
+=p¤À
+=p£×¿
+
+=@
+=qÀÐ
+=p£×À°
+=p£×¿À
+=@`
+
+=qÀð
+=?
+
+=q@°
+À°
+=¿
+
+=q@
+ÀÐ
+=À
+=¿À
+=q@`
+
+Àð
+=À
+=q@`
+
+=Àð
+=p£×À
+=q@
+
+@ð
+=p£×À`
+=q?À
+
+@Ð
+=p£×À
+=q?
+
+@°
+=p£×À°
+=q¿
+
+@
+ÿú
+=p£×ÀÐ
+ÿû
+ÿü
+ÿý
+ÿþ
+ÿÿ
+=q¿À
+
+
+
+
+
+@`
+
+
+
+
+
+
+
+
+
+ÿù
+=p£×Àð
+=qÀ
+@
+
+=p¤@
+=p¤@ð
+=qÀ`
+?À
+
+=p¤@°
+=p¤@Ð
+=qÀ
+=@
+
+@Ð
+@ð
+=qÀ`
+=?À
+
+@Ð
+=p£×@ð
diff --git a/funtools/funtest/nwcs b/funtools/funtest/nwcs
new file mode 100755
index 0000000..cc21ba7
--- /dev/null
+++ b/funtools/funtest/nwcs
@@ -0,0 +1,109 @@
+#!/bin/sh
+# set -x
+
+if [ x"$3" = x ]; then
+ echo "usage: $0 ievents iwcs oimage"
+ echo "where:"
+ echo " ievents # input events file"
+ echo " iwcs # input image file containing new WCS header"
+ echo " oimage # output image file"
+ echo " "
+ echo "The x, y position of each event in the input file is transformed to"
+ echo "the a new x, y based on the specified WCS and the result is written"
+ echo "to the specified output image."
+ exit 1
+fi
+
+IEVENTS="$1"
+IWCS="$2"
+OIMAGE="$3"
+
+WEDIT=wcs.edit
+WCALC=nwcs.calc
+TEVENTS=tevents.fits
+TIMAGE=timage.fits
+
+echo "retrieving WCS information from $IWCS ..."
+funhead "$IWCS" | egrep "^EPOCH|^RADECSYS|^EQUINOX|^CTYPE1|^CTYPE2|^CRVAL1|^CRVAL2|^CRPIX1|^CRPIX2|^CDELT1|^CDELT2|^CROTA1|^CROTA2|^CUNIT1|^CUNIT2|^CD1_1|^CD1_2|^CD2_1|^CD2_2|^PV1_0|^PV1_1|^PV1_2|^PV1_3|^PV1_4|^PV1_5|^PV1_6|^PV1_7|^PV1_8|^PV1_9|^PV2_0|^PV2_1|^PV2_2|^PV2_3|^PV2_4|^PV2_5|^PV2_6|^PV2_7|^PV2_8|^PV2_9|^LTM1_1|^LTM1_2|^LTM2_1|^LTM2_2|^LTV1|^LTV2|^DTM1_1|^DTM1_2|^DTM2_1|^DTM2_2|^DTV1|^DTV2" > $WEDIT
+
+echo "converting events from $IEVENTS using new WCS ..."
+cat <<END > $WCALC
+local
+double tli2p (double di, double tlmin, double binsiz, int type);
+char *wcsfile=NULL;
+char *s;
+int i;
+int init=0;
+int got=0;
+int offscl;
+double tlmin1, tlmin2;
+double dval1, dval2;
+double nx, ny;
+void *wcs1;
+void *wcs2;
+Fun fun2;
+FITSCard card;
+end
+before
+ if( ARGC < 1 ){
+ gerror(stderr, "requires -a wcsfile\n");
+ exit(1);
+ }
+ wcsfile = ARGV(0);
+ if( !(fun2 = FunOpen(wcsfile, "r", NULL)) ){
+ gerror(stderr, "can't FunOpen wcs file (or find extension): %s\n",
+ wcsfile);
+ }
+ FunInfoGet(fun2, FUN_WCS, &wcs2, 0);
+ FunInfoGet(fun, FUN_WCS, &wcs1, FUN_MIN1, &tlmin1, FUN_MIN2, &tlmin2, 0);
+ xdim=FunParamGeti(fun2, "NAXIS1", 0, -1, &got);
+ if( !got ){
+ gerror(stderr, "NAXIS1 missing from WCS image\n");
+ exit(1);
+ }
+ ydim=FunParamGeti(fun2, "NAXIS2", 0, -1, &got);
+ if( !got ){
+ gerror(stderr, "NAXIS2 missing from WCS image\n");
+ exit(1);
+ }
+ pix2wcs(wcs2, (double)0, (double)0, &dval1, &dval2);
+ wcs2pix(wcs1, dval1, dval2, &nx, &ny, &offscl);
+ nx = tli2p(nx, tlmin1, 0, 'D');
+ ny = tli2p(ny, tlmin2, 0, 'D');
+ FunParamPuti(ofun, "NWCSX", 1, (int)nx, "lower corner x of wcs image", 1);
+ FunParamPuti(ofun, "NWCSY", 1, (int)ny, "lower corner y of wcs image", 1);
+ pix2wcs(wcs2, (double)xdim-1, (double)ydim-1, &dval1, &dval2);
+ wcs2pix(wcs1, dval1, dval2, &nx, &ny, &offscl);
+ nx = (double)tli2p(nx, tlmin1, 0, 'D');
+ ny = (double)tli2p(ny, tlmin2, 0, 'D');
+ FunParamPuti(ofun, "NWCSX", 2, (int)nx, "upper corner x of wcs image", 1);
+ FunParamPuti(ofun, "NWCSY", 2, (int)ny, "upper corner y of wcs image", 1);
+end
+pix2wcs(wcs1, (double)cur->x, (double)cur->y, &dval1, &dval2);
+wcs2pix(wcs2, dval1, dval2, &nx, &ny, &offscl);
+/* cur->x = (int)(nx+0.5); */
+/* cur->y = (int)(ny+0.5); */
+cur->x = nx;
+cur->y = ny;
+END
+funcalc -n -f "$WCALC" -a "$IWCS" "$IEVENTS" "$TEVENTS" > foo.c
+funcalc -f "$WCALC" -a "$IWCS" "$IEVENTS" "$TEVENTS"
+
+XDIM=`funhead $IWCS | egrep NAXIS1 | awk '{print $3}'`
+YDIM=`funhead $IWCS | egrep NAXIS2 | awk '{print $3}'`
+XCEN=`expr $XDIM / 2`
+YCEN=`expr $YDIM / 2`
+echo "found wcs image dimensions $XCEN@$XDIM, $YCEN@$YDIM ..."
+
+echo "converting new event file to image file $OIMAGE ..."
+funimage "$TEVENTS[$XDIM@$XCEN,$YDIM@$YCEN]" "$TIMAGE"
+
+echo "adding new WCS to output image $OIMAGE ..."
+funhead "$TIMAGE" "$OIMAGE" "$WEDIT"
+
+echo "determine lower and upper corners of $IWCS image in event coords:"
+funhead "$OIMAGE" | egrep "corner . of wcs image"
+
+echo "cleaning up ..."
+rm -f "$WEDIT" "$WCALC" "$TEVENTS" "$TIMAGE"
+
diff --git a/funtools/funtest/parse.in b/funtools/funtest/parse.in
new file mode 100644
index 0000000..800283a
--- /dev/null
+++ b/funtools/funtest/parse.in
@@ -0,0 +1,24 @@
+[100:200,300:400,5]
+[100:200,300:400]
+[*,300:400,5]
+[*,300:400]
+[100:200,*,5]
+[100:200,*]
+[*,*,5]
+[*,5]
+[100:200,300:400,5][pha==1&&pi>2]
+[100:200,300:400][pha==1&&pi>2]
+[*,300:400,5][pha==1&&pi>2]
+[*,300:400][pha==1&&pi>2]
+[100:200,*,5][pha==1&&pi>2]
+[100:200,*][pha==1&&pi>2]
+[*,*,5][pha==1&&pi>2]
+[*,5][pha==1&&pi>2]
+[100:200,300:400,5,pha==1&&pi>2]
+[100:200,300:400,pha==1&&pi>2]
+[*,300:400,5,pha==1&&pi>2]
+[*,300:400,pha==1&&pi>2]
+[100:200,*,5,pha==1&&pi>2]
+[100:200,*,pha==1&&pi>2]
+[*,*,5,pha==1&&pi>2]
+[*,5,pha==1&&pi>2]
diff --git a/funtools/funtest/pr b/funtools/funtest/pr
new file mode 100644
index 0000000..1c0d23c
--- /dev/null
+++ b/funtools/funtest/pr
@@ -0,0 +1,8 @@
+/* comment */
+# another comment
+if( cur->x > cur->y )
+ fprintf(stdout, "X: %d %d\n", cur->x, cur->y);
+else if( cur->x == cur->y )
+ fprintf(stdout, "E: %d\n", cur->x);
+else
+ fprintf(stdout, "Y: %d %d\n", cur->x, cur->y);
diff --git a/funtools/funtest/qcon.c b/funtools/funtest/qcon.c
new file mode 100644
index 0000000..a5d2e2d
--- /dev/null
+++ b/funtools/funtest/qcon.c
@@ -0,0 +1,123 @@
+/* gcc -g -o qcon qcon.c -I/soft/saord/include -L/soft/saord/lib -lfuntools -lsocket -lnsl -ldl -lm */
+
+#include <funtools.h>
+#include <stdlib.h>
+
+extern char *optarg;
+extern int optind;
+
+int main(int argc, char **argv)
+{
+ int c;
+ int args;
+ int offscl;
+ int dim1, dim2;
+ int ix, iy;
+ int offset;
+ int debug=0;
+ int dowcs=1;
+ int idx=0;
+ char tbuf[SZ_LINE];
+ double dval1, dval2;
+ double dx, dy;
+ double *dbuf;
+ struct WorldCoor *wcs;
+ Fun fun;
+
+ /* process switch arguments */
+ while( (c = getopt(argc, argv, "d")) != -1){
+ switch(c){
+ case 'd':
+ debug = 1;
+ break;
+ case 'i':
+ dowcs = 0;
+ break;
+ }
+ }
+
+ /* check for required arguments */
+ args = argc - optind;
+ if( args < 1 ){
+ fprintf(stderr, "usage: %s iname -d -i\n", argv[0]);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "where:\n");
+ fprintf(stderr, " -d\tprint out input and output position values\n");
+ fprintf(stderr, " -i\tinput values are image x,y (not ra,dec in deg)\n");
+ fprintf(stderr, "\n");
+ exit(1);
+ }
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* open the input FITS file */
+ if( !(fun = FunOpen(argv[optind], "r", NULL)) )
+ gerror(stderr, "could not FunOpen input file: %s\n", argv[optind]);
+
+ /* extract and bin the data section into a double float image buffer */
+ if( !(dbuf = FunImageGet(fun, NULL, "bitpix=-64")) )
+ gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
+
+ /* get required information from funtools structure */
+ FunInfoGet(fun,
+ FUN_SECT_DIM1, &dim1,
+ FUN_SECT_DIM2, &dim2,
+ FUN_WCS, &wcs,
+ 0);
+
+ /* for each line in the contour file ... */
+ while( fgets(tbuf, SZ_LINE, stdin) ){
+ /* ignore comments */
+ if( *tbuf == '#' )
+ continue;
+ /* blank lines means reset counter */
+ if( *tbuf == '\n' ){
+ fprintf(stdout, "\n");
+ idx = 0;
+ continue;
+ }
+ /* input contour values: ra, dec in degrees (or image coords if -i) */
+ if(sscanf(tbuf, "%lf %lf", &dval1, &dval2) != 2){
+ gerror(stderr, "invalid line in contour file: %s\n", tbuf);
+ }
+ /* convert input ra, dec to image x, y */
+ if( dowcs ){
+ wcs2pix(wcs, dval1, dval2, &dx, &dy, &offscl);
+ /* make sure we are not off scale */
+ if( offscl ){
+ fprintf(stderr, "warning: wcs position is offscale: %s\n", tbuf);
+ continue;
+ }
+ }
+ else{
+ dx = dval1;
+ dy = dval2;
+ }
+ /* convert image values to integers */
+ ix = (int)(dx+0.5);
+ iy = (int)(dy+0.5);
+ /* sanity checks -- must be inside the image */
+ if( (ix < 1) || (ix > dim1) || (iy < 1) || (iy > dim2)){
+ fprintf(stderr, "warning: image position off image: %s\n", tbuf);
+ continue;
+ }
+ /* calculate offset into dbuf */
+ offset = (iy-1)*dim1 + ix-1;
+ /* write out the index and the pixel value at the image position */
+ fprintf(stdout, "%d\t%f", idx, dbuf[offset]);
+ /* debugging info, if necessary */
+ if( debug ){
+ fprintf(stdout, "\t %f %f\t%d %d", dval1, dval2, ix, iy);
+ }
+ /* finish off line */
+ fprintf(stdout, "\n");
+ /* bump to next index */
+ idx++;
+ }
+
+ /* close output first so that flush happens automatically */
+ FunClose(fun);
+ if( dbuf ) free(dbuf);
+ return(0);
+}
diff --git a/funtools/funtest/resample.fc b/funtools/funtest/resample.fc
new file mode 100644
index 0000000..00ef7c4
--- /dev/null
+++ b/funtools/funtest/resample.fc
@@ -0,0 +1,70 @@
+global
+#include <stdlib.h>
+
+int icmp( const void *e1, const void *e2 )
+{
+ int i1 = *(int*) e1;
+ int i2 = *(int*) e2;
+
+ return i1 < i2 ? -1 : i1 == i2 ? 0 : 1;
+}
+
+end
+
+local
+int got;
+size_t irow = 0;
+size_t oidx = 0;
+size_t* output_irow;
+int naxis2;
+long int seed = getenv("SEED") ? atoi(getenv("SEED")) : 1 ;
+
+srand48(seed);
+end
+
+before
+
+naxis2 = FunParamGeti(fun, "NAXIS", 2, -1, &got);
+if ( ! got )
+{
+ gerror(stderr, "error retrieving naxis2\n" );
+ goto error;
+}
+
+/* allocate one more than we need. we stick a sentinel valuethat is
+ always greater than the number of rows in the file in the last
+ slot. that way we never fall off the end of output_irow in the
+ processing loop below. */
+
+if ( ! (output_irow = malloc( (naxis2+1) * sizeof(*output_irow) ) ) )
+ {
+ gerror(stderr, "error allocating index array of size %d\n", naxis2 );
+ goto error;
+ }
+
+{ size_t i;
+ for ( i = 0 ; i < naxis2 ; i++ )
+ output_irow[i] = drand48() * naxis2;
+ qsort( output_irow, naxis2, sizeof(*output_irow), icmp );
+ output_irow[naxis2] = naxis2;
+}
+
+end
+
+
+cur->x;
+
+/* if the current row index is the next one to write, write it.
+ the row may be used multiple times, so keep incrementing the
+ list of rows to write until it doesn't match the current row */
+
+while( irow == output_irow[oidx] )
+{
+ FunTableRowPut(ofun, (char *)cur, 1, __i, NULL);
+ oidx++;
+}
+irow++;
+
+/* don't let funcalc write anything out; we've handled that */
+continue;
+
diff --git a/funtools/funtest/sample.fc b/funtools/funtest/sample.fc
new file mode 100644
index 0000000..4384176
--- /dev/null
+++ b/funtools/funtest/sample.fc
@@ -0,0 +1,13 @@
+global
+#include <stdlib.h>
+end
+
+local
+long int seed = getenv("SEED") ? atoi(getenv("SEED")) : 1 ;
+double limit = getenv("LIMIT") ? atof(getenv("LIMIT")) : 0.8;
+
+srand48(seed);
+end
+
+cur->x;
+if ( drand48() > limit ) continue;
diff --git a/funtools/funtest/snr100.reg b/funtools/funtest/snr100.reg
new file mode 100644
index 0000000..0a5ee2f
--- /dev/null
+++ b/funtools/funtest/snr100.reg
@@ -0,0 +1,100 @@
+circle(350,350,4)
+circle(380,350,4)
+circle(410,350,4)
+circle(440,350,4)
+circle(470,350,4)
+circle(500,350,4)
+circle(530,350,4)
+circle(560,350,4)
+circle(590,350,4)
+circle(620,350,4)
+circle(350,380,4)
+circle(380,380,4)
+circle(410,380,4)
+circle(440,380,4)
+circle(470,380,4)
+circle(500,380,4)
+circle(530,380,4)
+circle(560,380,4)
+circle(590,380,4)
+circle(620,380,4)
+circle(350,410,4)
+circle(380,410,4)
+circle(410,410,4)
+circle(440,410,4)
+circle(470,410,4)
+circle(500,410,4)
+circle(530,410,4)
+circle(560,410,4)
+circle(590,410,4)
+circle(620,410,4)
+circle(350,440,4)
+circle(380,440,4)
+circle(410,440,4)
+circle(440,440,4)
+circle(470,440,4)
+circle(500,440,4)
+circle(530,440,4)
+circle(560,440,4)
+circle(590,440,4)
+circle(620,440,4)
+circle(350,470,4)
+circle(380,470,4)
+circle(410,470,4)
+circle(440,470,4)
+circle(470,470,4)
+circle(500,470,4)
+circle(530,470,4)
+circle(560,470,4)
+circle(590,470,4)
+circle(620,470,4)
+circle(350,500,4)
+circle(380,500,4)
+circle(410,500,4)
+circle(440,500,4)
+circle(470,500,4)
+circle(500,500,4)
+circle(530,500,4)
+circle(560,500,4)
+circle(590,500,4)
+circle(620,500,4)
+circle(350,530,4)
+circle(380,530,4)
+circle(410,530,4)
+circle(440,530,4)
+circle(470,530,4)
+circle(500,530,4)
+circle(530,530,4)
+circle(560,530,4)
+circle(590,530,4)
+circle(620,530,4)
+circle(350,560,4)
+circle(380,560,4)
+circle(410,560,4)
+circle(440,560,4)
+circle(470,560,4)
+circle(500,560,4)
+circle(530,560,4)
+circle(560,560,4)
+circle(590,560,4)
+circle(620,560,4)
+circle(350,590,4)
+circle(380,590,4)
+circle(410,590,4)
+circle(440,590,4)
+circle(470,590,4)
+circle(500,590,4)
+circle(530,590,4)
+circle(560,590,4)
+circle(590,590,4)
+circle(620,590,4)
+circle(350,620,4)
+circle(380,620,4)
+circle(410,620,4)
+circle(440,620,4)
+circle(470,620,4)
+circle(500,620,4)
+circle(530,620,4)
+circle(560,620,4)
+circle(590,620,4)
+circle(620,620,4)
diff --git a/funtools/funtest/snr400.reg b/funtools/funtest/snr400.reg
new file mode 100644
index 0000000..c7a02c4
--- /dev/null
+++ b/funtools/funtest/snr400.reg
@@ -0,0 +1,400 @@
+circle(350,350,4)
+circle(365,350,4)
+circle(380,350,4)
+circle(395,350,4)
+circle(410,350,4)
+circle(425,350,4)
+circle(440,350,4)
+circle(455,350,4)
+circle(470,350,4)
+circle(485,350,4)
+circle(500,350,4)
+circle(515,350,4)
+circle(530,350,4)
+circle(545,350,4)
+circle(560,350,4)
+circle(575,350,4)
+circle(590,350,4)
+circle(605,350,4)
+circle(620,350,4)
+circle(635,350,4)
+circle(350,365,4)
+circle(365,365,4)
+circle(380,365,4)
+circle(395,365,4)
+circle(410,365,4)
+circle(425,365,4)
+circle(440,365,4)
+circle(455,365,4)
+circle(470,365,4)
+circle(485,365,4)
+circle(500,365,4)
+circle(515,365,4)
+circle(530,365,4)
+circle(545,365,4)
+circle(560,365,4)
+circle(575,365,4)
+circle(590,365,4)
+circle(605,365,4)
+circle(620,365,4)
+circle(635,365,4)
+circle(350,380,4)
+circle(365,380,4)
+circle(380,380,4)
+circle(395,380,4)
+circle(410,380,4)
+circle(425,380,4)
+circle(440,380,4)
+circle(455,380,4)
+circle(470,380,4)
+circle(485,380,4)
+circle(500,380,4)
+circle(515,380,4)
+circle(530,380,4)
+circle(545,380,4)
+circle(560,380,4)
+circle(575,380,4)
+circle(590,380,4)
+circle(605,380,4)
+circle(620,380,4)
+circle(635,380,4)
+circle(350,395,4)
+circle(365,395,4)
+circle(380,395,4)
+circle(395,395,4)
+circle(410,395,4)
+circle(425,395,4)
+circle(440,395,4)
+circle(455,395,4)
+circle(470,395,4)
+circle(485,395,4)
+circle(500,395,4)
+circle(515,395,4)
+circle(530,395,4)
+circle(545,395,4)
+circle(560,395,4)
+circle(575,395,4)
+circle(590,395,4)
+circle(605,395,4)
+circle(620,395,4)
+circle(635,395,4)
+circle(350,410,4)
+circle(365,410,4)
+circle(380,410,4)
+circle(395,410,4)
+circle(410,410,4)
+circle(425,410,4)
+circle(440,410,4)
+circle(455,410,4)
+circle(470,410,4)
+circle(485,410,4)
+circle(500,410,4)
+circle(515,410,4)
+circle(530,410,4)
+circle(545,410,4)
+circle(560,410,4)
+circle(575,410,4)
+circle(590,410,4)
+circle(605,410,4)
+circle(620,410,4)
+circle(635,410,4)
+circle(350,425,4)
+circle(365,425,4)
+circle(380,425,4)
+circle(395,425,4)
+circle(410,425,4)
+circle(425,425,4)
+circle(440,425,4)
+circle(455,425,4)
+circle(470,425,4)
+circle(485,425,4)
+circle(500,425,4)
+circle(515,425,4)
+circle(530,425,4)
+circle(545,425,4)
+circle(560,425,4)
+circle(575,425,4)
+circle(590,425,4)
+circle(605,425,4)
+circle(620,425,4)
+circle(635,425,4)
+circle(350,440,4)
+circle(365,440,4)
+circle(380,440,4)
+circle(395,440,4)
+circle(410,440,4)
+circle(425,440,4)
+circle(440,440,4)
+circle(455,440,4)
+circle(470,440,4)
+circle(485,440,4)
+circle(500,440,4)
+circle(515,440,4)
+circle(530,440,4)
+circle(545,440,4)
+circle(560,440,4)
+circle(575,440,4)
+circle(590,440,4)
+circle(605,440,4)
+circle(620,440,4)
+circle(635,440,4)
+circle(350,455,4)
+circle(365,455,4)
+circle(380,455,4)
+circle(395,455,4)
+circle(410,455,4)
+circle(425,455,4)
+circle(440,455,4)
+circle(455,455,4)
+circle(470,455,4)
+circle(485,455,4)
+circle(500,455,4)
+circle(515,455,4)
+circle(530,455,4)
+circle(545,455,4)
+circle(560,455,4)
+circle(575,455,4)
+circle(590,455,4)
+circle(605,455,4)
+circle(620,455,4)
+circle(635,455,4)
+circle(350,470,4)
+circle(365,470,4)
+circle(380,470,4)
+circle(395,470,4)
+circle(410,470,4)
+circle(425,470,4)
+circle(440,470,4)
+circle(455,470,4)
+circle(470,470,4)
+circle(485,470,4)
+circle(500,470,4)
+circle(515,470,4)
+circle(530,470,4)
+circle(545,470,4)
+circle(560,470,4)
+circle(575,470,4)
+circle(590,470,4)
+circle(605,470,4)
+circle(620,470,4)
+circle(635,470,4)
+circle(350,485,4)
+circle(365,485,4)
+circle(380,485,4)
+circle(395,485,4)
+circle(410,485,4)
+circle(425,485,4)
+circle(440,485,4)
+circle(455,485,4)
+circle(470,485,4)
+circle(485,485,4)
+circle(500,485,4)
+circle(515,485,4)
+circle(530,485,4)
+circle(545,485,4)
+circle(560,485,4)
+circle(575,485,4)
+circle(590,485,4)
+circle(605,485,4)
+circle(620,485,4)
+circle(635,485,4)
+circle(350,500,4)
+circle(365,500,4)
+circle(380,500,4)
+circle(395,500,4)
+circle(410,500,4)
+circle(425,500,4)
+circle(440,500,4)
+circle(455,500,4)
+circle(470,500,4)
+circle(485,500,4)
+circle(500,500,4)
+circle(515,500,4)
+circle(530,500,4)
+circle(545,500,4)
+circle(560,500,4)
+circle(575,500,4)
+circle(590,500,4)
+circle(605,500,4)
+circle(620,500,4)
+circle(635,500,4)
+circle(350,515,4)
+circle(365,515,4)
+circle(380,515,4)
+circle(395,515,4)
+circle(410,515,4)
+circle(425,515,4)
+circle(440,515,4)
+circle(455,515,4)
+circle(470,515,4)
+circle(485,515,4)
+circle(500,515,4)
+circle(515,515,4)
+circle(530,515,4)
+circle(545,515,4)
+circle(560,515,4)
+circle(575,515,4)
+circle(590,515,4)
+circle(605,515,4)
+circle(620,515,4)
+circle(635,515,4)
+circle(350,530,4)
+circle(365,530,4)
+circle(380,530,4)
+circle(395,530,4)
+circle(410,530,4)
+circle(425,530,4)
+circle(440,530,4)
+circle(455,530,4)
+circle(470,530,4)
+circle(485,530,4)
+circle(500,530,4)
+circle(515,530,4)
+circle(530,530,4)
+circle(545,530,4)
+circle(560,530,4)
+circle(575,530,4)
+circle(590,530,4)
+circle(605,530,4)
+circle(620,530,4)
+circle(635,530,4)
+circle(350,545,4)
+circle(365,545,4)
+circle(380,545,4)
+circle(395,545,4)
+circle(410,545,4)
+circle(425,545,4)
+circle(440,545,4)
+circle(455,545,4)
+circle(470,545,4)
+circle(485,545,4)
+circle(500,545,4)
+circle(515,545,4)
+circle(530,545,4)
+circle(545,545,4)
+circle(560,545,4)
+circle(575,545,4)
+circle(590,545,4)
+circle(605,545,4)
+circle(620,545,4)
+circle(635,545,4)
+circle(350,560,4)
+circle(365,560,4)
+circle(380,560,4)
+circle(395,560,4)
+circle(410,560,4)
+circle(425,560,4)
+circle(440,560,4)
+circle(455,560,4)
+circle(470,560,4)
+circle(485,560,4)
+circle(500,560,4)
+circle(515,560,4)
+circle(530,560,4)
+circle(545,560,4)
+circle(560,560,4)
+circle(575,560,4)
+circle(590,560,4)
+circle(605,560,4)
+circle(620,560,4)
+circle(635,560,4)
+circle(350,575,4)
+circle(365,575,4)
+circle(380,575,4)
+circle(395,575,4)
+circle(410,575,4)
+circle(425,575,4)
+circle(440,575,4)
+circle(455,575,4)
+circle(470,575,4)
+circle(485,575,4)
+circle(500,575,4)
+circle(515,575,4)
+circle(530,575,4)
+circle(545,575,4)
+circle(560,575,4)
+circle(575,575,4)
+circle(590,575,4)
+circle(605,575,4)
+circle(620,575,4)
+circle(635,575,4)
+circle(350,590,4)
+circle(365,590,4)
+circle(380,590,4)
+circle(395,590,4)
+circle(410,590,4)
+circle(425,590,4)
+circle(440,590,4)
+circle(455,590,4)
+circle(470,590,4)
+circle(485,590,4)
+circle(500,590,4)
+circle(515,590,4)
+circle(530,590,4)
+circle(545,590,4)
+circle(560,590,4)
+circle(575,590,4)
+circle(590,590,4)
+circle(605,590,4)
+circle(620,590,4)
+circle(635,590,4)
+circle(350,605,4)
+circle(365,605,4)
+circle(380,605,4)
+circle(395,605,4)
+circle(410,605,4)
+circle(425,605,4)
+circle(440,605,4)
+circle(455,605,4)
+circle(470,605,4)
+circle(485,605,4)
+circle(500,605,4)
+circle(515,605,4)
+circle(530,605,4)
+circle(545,605,4)
+circle(560,605,4)
+circle(575,605,4)
+circle(590,605,4)
+circle(605,605,4)
+circle(620,605,4)
+circle(635,605,4)
+circle(350,620,4)
+circle(365,620,4)
+circle(380,620,4)
+circle(395,620,4)
+circle(410,620,4)
+circle(425,620,4)
+circle(440,620,4)
+circle(455,620,4)
+circle(470,620,4)
+circle(485,620,4)
+circle(500,620,4)
+circle(515,620,4)
+circle(530,620,4)
+circle(545,620,4)
+circle(560,620,4)
+circle(575,620,4)
+circle(590,620,4)
+circle(605,620,4)
+circle(620,620,4)
+circle(635,620,4)
+circle(350,635,4)
+circle(365,635,4)
+circle(380,635,4)
+circle(395,635,4)
+circle(410,635,4)
+circle(425,635,4)
+circle(440,635,4)
+circle(455,635,4)
+circle(470,635,4)
+circle(485,635,4)
+circle(500,635,4)
+circle(515,635,4)
+circle(530,635,4)
+circle(545,635,4)
+circle(560,635,4)
+circle(575,635,4)
+circle(590,635,4)
+circle(605,635,4)
+circle(620,635,4)
+circle(635,635,4)
diff --git a/funtools/funtest/snr900.reg b/funtools/funtest/snr900.reg
new file mode 100644
index 0000000..a8dccca
--- /dev/null
+++ b/funtools/funtest/snr900.reg
@@ -0,0 +1,900 @@
+circle(350,350,4)
+circle(360,350,4)
+circle(370,350,4)
+circle(380,350,4)
+circle(390,350,4)
+circle(400,350,4)
+circle(410,350,4)
+circle(420,350,4)
+circle(430,350,4)
+circle(440,350,4)
+circle(450,350,4)
+circle(460,350,4)
+circle(470,350,4)
+circle(480,350,4)
+circle(490,350,4)
+circle(500,350,4)
+circle(510,350,4)
+circle(520,350,4)
+circle(530,350,4)
+circle(540,350,4)
+circle(550,350,4)
+circle(560,350,4)
+circle(570,350,4)
+circle(580,350,4)
+circle(590,350,4)
+circle(600,350,4)
+circle(610,350,4)
+circle(620,350,4)
+circle(630,350,4)
+circle(640,350,4)
+circle(350,360,4)
+circle(360,360,4)
+circle(370,360,4)
+circle(380,360,4)
+circle(390,360,4)
+circle(400,360,4)
+circle(410,360,4)
+circle(420,360,4)
+circle(430,360,4)
+circle(440,360,4)
+circle(450,360,4)
+circle(460,360,4)
+circle(470,360,4)
+circle(480,360,4)
+circle(490,360,4)
+circle(500,360,4)
+circle(510,360,4)
+circle(520,360,4)
+circle(530,360,4)
+circle(540,360,4)
+circle(550,360,4)
+circle(560,360,4)
+circle(570,360,4)
+circle(580,360,4)
+circle(590,360,4)
+circle(600,360,4)
+circle(610,360,4)
+circle(620,360,4)
+circle(630,360,4)
+circle(640,360,4)
+circle(350,370,4)
+circle(360,370,4)
+circle(370,370,4)
+circle(380,370,4)
+circle(390,370,4)
+circle(400,370,4)
+circle(410,370,4)
+circle(420,370,4)
+circle(430,370,4)
+circle(440,370,4)
+circle(450,370,4)
+circle(460,370,4)
+circle(470,370,4)
+circle(480,370,4)
+circle(490,370,4)
+circle(500,370,4)
+circle(510,370,4)
+circle(520,370,4)
+circle(530,370,4)
+circle(540,370,4)
+circle(550,370,4)
+circle(560,370,4)
+circle(570,370,4)
+circle(580,370,4)
+circle(590,370,4)
+circle(600,370,4)
+circle(610,370,4)
+circle(620,370,4)
+circle(630,370,4)
+circle(640,370,4)
+circle(350,380,4)
+circle(360,380,4)
+circle(370,380,4)
+circle(380,380,4)
+circle(390,380,4)
+circle(400,380,4)
+circle(410,380,4)
+circle(420,380,4)
+circle(430,380,4)
+circle(440,380,4)
+circle(450,380,4)
+circle(460,380,4)
+circle(470,380,4)
+circle(480,380,4)
+circle(490,380,4)
+circle(500,380,4)
+circle(510,380,4)
+circle(520,380,4)
+circle(530,380,4)
+circle(540,380,4)
+circle(550,380,4)
+circle(560,380,4)
+circle(570,380,4)
+circle(580,380,4)
+circle(590,380,4)
+circle(600,380,4)
+circle(610,380,4)
+circle(620,380,4)
+circle(630,380,4)
+circle(640,380,4)
+circle(350,390,4)
+circle(360,390,4)
+circle(370,390,4)
+circle(380,390,4)
+circle(390,390,4)
+circle(400,390,4)
+circle(410,390,4)
+circle(420,390,4)
+circle(430,390,4)
+circle(440,390,4)
+circle(450,390,4)
+circle(460,390,4)
+circle(470,390,4)
+circle(480,390,4)
+circle(490,390,4)
+circle(500,390,4)
+circle(510,390,4)
+circle(520,390,4)
+circle(530,390,4)
+circle(540,390,4)
+circle(550,390,4)
+circle(560,390,4)
+circle(570,390,4)
+circle(580,390,4)
+circle(590,390,4)
+circle(600,390,4)
+circle(610,390,4)
+circle(620,390,4)
+circle(630,390,4)
+circle(640,390,4)
+circle(350,400,4)
+circle(360,400,4)
+circle(370,400,4)
+circle(380,400,4)
+circle(390,400,4)
+circle(400,400,4)
+circle(410,400,4)
+circle(420,400,4)
+circle(430,400,4)
+circle(440,400,4)
+circle(450,400,4)
+circle(460,400,4)
+circle(470,400,4)
+circle(480,400,4)
+circle(490,400,4)
+circle(500,400,4)
+circle(510,400,4)
+circle(520,400,4)
+circle(530,400,4)
+circle(540,400,4)
+circle(550,400,4)
+circle(560,400,4)
+circle(570,400,4)
+circle(580,400,4)
+circle(590,400,4)
+circle(600,400,4)
+circle(610,400,4)
+circle(620,400,4)
+circle(630,400,4)
+circle(640,400,4)
+circle(350,410,4)
+circle(360,410,4)
+circle(370,410,4)
+circle(380,410,4)
+circle(390,410,4)
+circle(400,410,4)
+circle(410,410,4)
+circle(420,410,4)
+circle(430,410,4)
+circle(440,410,4)
+circle(450,410,4)
+circle(460,410,4)
+circle(470,410,4)
+circle(480,410,4)
+circle(490,410,4)
+circle(500,410,4)
+circle(510,410,4)
+circle(520,410,4)
+circle(530,410,4)
+circle(540,410,4)
+circle(550,410,4)
+circle(560,410,4)
+circle(570,410,4)
+circle(580,410,4)
+circle(590,410,4)
+circle(600,410,4)
+circle(610,410,4)
+circle(620,410,4)
+circle(630,410,4)
+circle(640,410,4)
+circle(350,420,4)
+circle(360,420,4)
+circle(370,420,4)
+circle(380,420,4)
+circle(390,420,4)
+circle(400,420,4)
+circle(410,420,4)
+circle(420,420,4)
+circle(430,420,4)
+circle(440,420,4)
+circle(450,420,4)
+circle(460,420,4)
+circle(470,420,4)
+circle(480,420,4)
+circle(490,420,4)
+circle(500,420,4)
+circle(510,420,4)
+circle(520,420,4)
+circle(530,420,4)
+circle(540,420,4)
+circle(550,420,4)
+circle(560,420,4)
+circle(570,420,4)
+circle(580,420,4)
+circle(590,420,4)
+circle(600,420,4)
+circle(610,420,4)
+circle(620,420,4)
+circle(630,420,4)
+circle(640,420,4)
+circle(350,430,4)
+circle(360,430,4)
+circle(370,430,4)
+circle(380,430,4)
+circle(390,430,4)
+circle(400,430,4)
+circle(410,430,4)
+circle(420,430,4)
+circle(430,430,4)
+circle(440,430,4)
+circle(450,430,4)
+circle(460,430,4)
+circle(470,430,4)
+circle(480,430,4)
+circle(490,430,4)
+circle(500,430,4)
+circle(510,430,4)
+circle(520,430,4)
+circle(530,430,4)
+circle(540,430,4)
+circle(550,430,4)
+circle(560,430,4)
+circle(570,430,4)
+circle(580,430,4)
+circle(590,430,4)
+circle(600,430,4)
+circle(610,430,4)
+circle(620,430,4)
+circle(630,430,4)
+circle(640,430,4)
+circle(350,440,4)
+circle(360,440,4)
+circle(370,440,4)
+circle(380,440,4)
+circle(390,440,4)
+circle(400,440,4)
+circle(410,440,4)
+circle(420,440,4)
+circle(430,440,4)
+circle(440,440,4)
+circle(450,440,4)
+circle(460,440,4)
+circle(470,440,4)
+circle(480,440,4)
+circle(490,440,4)
+circle(500,440,4)
+circle(510,440,4)
+circle(520,440,4)
+circle(530,440,4)
+circle(540,440,4)
+circle(550,440,4)
+circle(560,440,4)
+circle(570,440,4)
+circle(580,440,4)
+circle(590,440,4)
+circle(600,440,4)
+circle(610,440,4)
+circle(620,440,4)
+circle(630,440,4)
+circle(640,440,4)
+circle(350,450,4)
+circle(360,450,4)
+circle(370,450,4)
+circle(380,450,4)
+circle(390,450,4)
+circle(400,450,4)
+circle(410,450,4)
+circle(420,450,4)
+circle(430,450,4)
+circle(440,450,4)
+circle(450,450,4)
+circle(460,450,4)
+circle(470,450,4)
+circle(480,450,4)
+circle(490,450,4)
+circle(500,450,4)
+circle(510,450,4)
+circle(520,450,4)
+circle(530,450,4)
+circle(540,450,4)
+circle(550,450,4)
+circle(560,450,4)
+circle(570,450,4)
+circle(580,450,4)
+circle(590,450,4)
+circle(600,450,4)
+circle(610,450,4)
+circle(620,450,4)
+circle(630,450,4)
+circle(640,450,4)
+circle(350,460,4)
+circle(360,460,4)
+circle(370,460,4)
+circle(380,460,4)
+circle(390,460,4)
+circle(400,460,4)
+circle(410,460,4)
+circle(420,460,4)
+circle(430,460,4)
+circle(440,460,4)
+circle(450,460,4)
+circle(460,460,4)
+circle(470,460,4)
+circle(480,460,4)
+circle(490,460,4)
+circle(500,460,4)
+circle(510,460,4)
+circle(520,460,4)
+circle(530,460,4)
+circle(540,460,4)
+circle(550,460,4)
+circle(560,460,4)
+circle(570,460,4)
+circle(580,460,4)
+circle(590,460,4)
+circle(600,460,4)
+circle(610,460,4)
+circle(620,460,4)
+circle(630,460,4)
+circle(640,460,4)
+circle(350,470,4)
+circle(360,470,4)
+circle(370,470,4)
+circle(380,470,4)
+circle(390,470,4)
+circle(400,470,4)
+circle(410,470,4)
+circle(420,470,4)
+circle(430,470,4)
+circle(440,470,4)
+circle(450,470,4)
+circle(460,470,4)
+circle(470,470,4)
+circle(480,470,4)
+circle(490,470,4)
+circle(500,470,4)
+circle(510,470,4)
+circle(520,470,4)
+circle(530,470,4)
+circle(540,470,4)
+circle(550,470,4)
+circle(560,470,4)
+circle(570,470,4)
+circle(580,470,4)
+circle(590,470,4)
+circle(600,470,4)
+circle(610,470,4)
+circle(620,470,4)
+circle(630,470,4)
+circle(640,470,4)
+circle(350,480,4)
+circle(360,480,4)
+circle(370,480,4)
+circle(380,480,4)
+circle(390,480,4)
+circle(400,480,4)
+circle(410,480,4)
+circle(420,480,4)
+circle(430,480,4)
+circle(440,480,4)
+circle(450,480,4)
+circle(460,480,4)
+circle(470,480,4)
+circle(480,480,4)
+circle(490,480,4)
+circle(500,480,4)
+circle(510,480,4)
+circle(520,480,4)
+circle(530,480,4)
+circle(540,480,4)
+circle(550,480,4)
+circle(560,480,4)
+circle(570,480,4)
+circle(580,480,4)
+circle(590,480,4)
+circle(600,480,4)
+circle(610,480,4)
+circle(620,480,4)
+circle(630,480,4)
+circle(640,480,4)
+circle(350,490,4)
+circle(360,490,4)
+circle(370,490,4)
+circle(380,490,4)
+circle(390,490,4)
+circle(400,490,4)
+circle(410,490,4)
+circle(420,490,4)
+circle(430,490,4)
+circle(440,490,4)
+circle(450,490,4)
+circle(460,490,4)
+circle(470,490,4)
+circle(480,490,4)
+circle(490,490,4)
+circle(500,490,4)
+circle(510,490,4)
+circle(520,490,4)
+circle(530,490,4)
+circle(540,490,4)
+circle(550,490,4)
+circle(560,490,4)
+circle(570,490,4)
+circle(580,490,4)
+circle(590,490,4)
+circle(600,490,4)
+circle(610,490,4)
+circle(620,490,4)
+circle(630,490,4)
+circle(640,490,4)
+circle(350,500,4)
+circle(360,500,4)
+circle(370,500,4)
+circle(380,500,4)
+circle(390,500,4)
+circle(400,500,4)
+circle(410,500,4)
+circle(420,500,4)
+circle(430,500,4)
+circle(440,500,4)
+circle(450,500,4)
+circle(460,500,4)
+circle(470,500,4)
+circle(480,500,4)
+circle(490,500,4)
+circle(500,500,4)
+circle(510,500,4)
+circle(520,500,4)
+circle(530,500,4)
+circle(540,500,4)
+circle(550,500,4)
+circle(560,500,4)
+circle(570,500,4)
+circle(580,500,4)
+circle(590,500,4)
+circle(600,500,4)
+circle(610,500,4)
+circle(620,500,4)
+circle(630,500,4)
+circle(640,500,4)
+circle(350,510,4)
+circle(360,510,4)
+circle(370,510,4)
+circle(380,510,4)
+circle(390,510,4)
+circle(400,510,4)
+circle(410,510,4)
+circle(420,510,4)
+circle(430,510,4)
+circle(440,510,4)
+circle(450,510,4)
+circle(460,510,4)
+circle(470,510,4)
+circle(480,510,4)
+circle(490,510,4)
+circle(500,510,4)
+circle(510,510,4)
+circle(520,510,4)
+circle(530,510,4)
+circle(540,510,4)
+circle(550,510,4)
+circle(560,510,4)
+circle(570,510,4)
+circle(580,510,4)
+circle(590,510,4)
+circle(600,510,4)
+circle(610,510,4)
+circle(620,510,4)
+circle(630,510,4)
+circle(640,510,4)
+circle(350,520,4)
+circle(360,520,4)
+circle(370,520,4)
+circle(380,520,4)
+circle(390,520,4)
+circle(400,520,4)
+circle(410,520,4)
+circle(420,520,4)
+circle(430,520,4)
+circle(440,520,4)
+circle(450,520,4)
+circle(460,520,4)
+circle(470,520,4)
+circle(480,520,4)
+circle(490,520,4)
+circle(500,520,4)
+circle(510,520,4)
+circle(520,520,4)
+circle(530,520,4)
+circle(540,520,4)
+circle(550,520,4)
+circle(560,520,4)
+circle(570,520,4)
+circle(580,520,4)
+circle(590,520,4)
+circle(600,520,4)
+circle(610,520,4)
+circle(620,520,4)
+circle(630,520,4)
+circle(640,520,4)
+circle(350,530,4)
+circle(360,530,4)
+circle(370,530,4)
+circle(380,530,4)
+circle(390,530,4)
+circle(400,530,4)
+circle(410,530,4)
+circle(420,530,4)
+circle(430,530,4)
+circle(440,530,4)
+circle(450,530,4)
+circle(460,530,4)
+circle(470,530,4)
+circle(480,530,4)
+circle(490,530,4)
+circle(500,530,4)
+circle(510,530,4)
+circle(520,530,4)
+circle(530,530,4)
+circle(540,530,4)
+circle(550,530,4)
+circle(560,530,4)
+circle(570,530,4)
+circle(580,530,4)
+circle(590,530,4)
+circle(600,530,4)
+circle(610,530,4)
+circle(620,530,4)
+circle(630,530,4)
+circle(640,530,4)
+circle(350,540,4)
+circle(360,540,4)
+circle(370,540,4)
+circle(380,540,4)
+circle(390,540,4)
+circle(400,540,4)
+circle(410,540,4)
+circle(420,540,4)
+circle(430,540,4)
+circle(440,540,4)
+circle(450,540,4)
+circle(460,540,4)
+circle(470,540,4)
+circle(480,540,4)
+circle(490,540,4)
+circle(500,540,4)
+circle(510,540,4)
+circle(520,540,4)
+circle(530,540,4)
+circle(540,540,4)
+circle(550,540,4)
+circle(560,540,4)
+circle(570,540,4)
+circle(580,540,4)
+circle(590,540,4)
+circle(600,540,4)
+circle(610,540,4)
+circle(620,540,4)
+circle(630,540,4)
+circle(640,540,4)
+circle(350,550,4)
+circle(360,550,4)
+circle(370,550,4)
+circle(380,550,4)
+circle(390,550,4)
+circle(400,550,4)
+circle(410,550,4)
+circle(420,550,4)
+circle(430,550,4)
+circle(440,550,4)
+circle(450,550,4)
+circle(460,550,4)
+circle(470,550,4)
+circle(480,550,4)
+circle(490,550,4)
+circle(500,550,4)
+circle(510,550,4)
+circle(520,550,4)
+circle(530,550,4)
+circle(540,550,4)
+circle(550,550,4)
+circle(560,550,4)
+circle(570,550,4)
+circle(580,550,4)
+circle(590,550,4)
+circle(600,550,4)
+circle(610,550,4)
+circle(620,550,4)
+circle(630,550,4)
+circle(640,550,4)
+circle(350,560,4)
+circle(360,560,4)
+circle(370,560,4)
+circle(380,560,4)
+circle(390,560,4)
+circle(400,560,4)
+circle(410,560,4)
+circle(420,560,4)
+circle(430,560,4)
+circle(440,560,4)
+circle(450,560,4)
+circle(460,560,4)
+circle(470,560,4)
+circle(480,560,4)
+circle(490,560,4)
+circle(500,560,4)
+circle(510,560,4)
+circle(520,560,4)
+circle(530,560,4)
+circle(540,560,4)
+circle(550,560,4)
+circle(560,560,4)
+circle(570,560,4)
+circle(580,560,4)
+circle(590,560,4)
+circle(600,560,4)
+circle(610,560,4)
+circle(620,560,4)
+circle(630,560,4)
+circle(640,560,4)
+circle(350,570,4)
+circle(360,570,4)
+circle(370,570,4)
+circle(380,570,4)
+circle(390,570,4)
+circle(400,570,4)
+circle(410,570,4)
+circle(420,570,4)
+circle(430,570,4)
+circle(440,570,4)
+circle(450,570,4)
+circle(460,570,4)
+circle(470,570,4)
+circle(480,570,4)
+circle(490,570,4)
+circle(500,570,4)
+circle(510,570,4)
+circle(520,570,4)
+circle(530,570,4)
+circle(540,570,4)
+circle(550,570,4)
+circle(560,570,4)
+circle(570,570,4)
+circle(580,570,4)
+circle(590,570,4)
+circle(600,570,4)
+circle(610,570,4)
+circle(620,570,4)
+circle(630,570,4)
+circle(640,570,4)
+circle(350,580,4)
+circle(360,580,4)
+circle(370,580,4)
+circle(380,580,4)
+circle(390,580,4)
+circle(400,580,4)
+circle(410,580,4)
+circle(420,580,4)
+circle(430,580,4)
+circle(440,580,4)
+circle(450,580,4)
+circle(460,580,4)
+circle(470,580,4)
+circle(480,580,4)
+circle(490,580,4)
+circle(500,580,4)
+circle(510,580,4)
+circle(520,580,4)
+circle(530,580,4)
+circle(540,580,4)
+circle(550,580,4)
+circle(560,580,4)
+circle(570,580,4)
+circle(580,580,4)
+circle(590,580,4)
+circle(600,580,4)
+circle(610,580,4)
+circle(620,580,4)
+circle(630,580,4)
+circle(640,580,4)
+circle(350,590,4)
+circle(360,590,4)
+circle(370,590,4)
+circle(380,590,4)
+circle(390,590,4)
+circle(400,590,4)
+circle(410,590,4)
+circle(420,590,4)
+circle(430,590,4)
+circle(440,590,4)
+circle(450,590,4)
+circle(460,590,4)
+circle(470,590,4)
+circle(480,590,4)
+circle(490,590,4)
+circle(500,590,4)
+circle(510,590,4)
+circle(520,590,4)
+circle(530,590,4)
+circle(540,590,4)
+circle(550,590,4)
+circle(560,590,4)
+circle(570,590,4)
+circle(580,590,4)
+circle(590,590,4)
+circle(600,590,4)
+circle(610,590,4)
+circle(620,590,4)
+circle(630,590,4)
+circle(640,590,4)
+circle(350,600,4)
+circle(360,600,4)
+circle(370,600,4)
+circle(380,600,4)
+circle(390,600,4)
+circle(400,600,4)
+circle(410,600,4)
+circle(420,600,4)
+circle(430,600,4)
+circle(440,600,4)
+circle(450,600,4)
+circle(460,600,4)
+circle(470,600,4)
+circle(480,600,4)
+circle(490,600,4)
+circle(500,600,4)
+circle(510,600,4)
+circle(520,600,4)
+circle(530,600,4)
+circle(540,600,4)
+circle(550,600,4)
+circle(560,600,4)
+circle(570,600,4)
+circle(580,600,4)
+circle(590,600,4)
+circle(600,600,4)
+circle(610,600,4)
+circle(620,600,4)
+circle(630,600,4)
+circle(640,600,4)
+circle(350,610,4)
+circle(360,610,4)
+circle(370,610,4)
+circle(380,610,4)
+circle(390,610,4)
+circle(400,610,4)
+circle(410,610,4)
+circle(420,610,4)
+circle(430,610,4)
+circle(440,610,4)
+circle(450,610,4)
+circle(460,610,4)
+circle(470,610,4)
+circle(480,610,4)
+circle(490,610,4)
+circle(500,610,4)
+circle(510,610,4)
+circle(520,610,4)
+circle(530,610,4)
+circle(540,610,4)
+circle(550,610,4)
+circle(560,610,4)
+circle(570,610,4)
+circle(580,610,4)
+circle(590,610,4)
+circle(600,610,4)
+circle(610,610,4)
+circle(620,610,4)
+circle(630,610,4)
+circle(640,610,4)
+circle(350,620,4)
+circle(360,620,4)
+circle(370,620,4)
+circle(380,620,4)
+circle(390,620,4)
+circle(400,620,4)
+circle(410,620,4)
+circle(420,620,4)
+circle(430,620,4)
+circle(440,620,4)
+circle(450,620,4)
+circle(460,620,4)
+circle(470,620,4)
+circle(480,620,4)
+circle(490,620,4)
+circle(500,620,4)
+circle(510,620,4)
+circle(520,620,4)
+circle(530,620,4)
+circle(540,620,4)
+circle(550,620,4)
+circle(560,620,4)
+circle(570,620,4)
+circle(580,620,4)
+circle(590,620,4)
+circle(600,620,4)
+circle(610,620,4)
+circle(620,620,4)
+circle(630,620,4)
+circle(640,620,4)
+circle(350,630,4)
+circle(360,630,4)
+circle(370,630,4)
+circle(380,630,4)
+circle(390,630,4)
+circle(400,630,4)
+circle(410,630,4)
+circle(420,630,4)
+circle(430,630,4)
+circle(440,630,4)
+circle(450,630,4)
+circle(460,630,4)
+circle(470,630,4)
+circle(480,630,4)
+circle(490,630,4)
+circle(500,630,4)
+circle(510,630,4)
+circle(520,630,4)
+circle(530,630,4)
+circle(540,630,4)
+circle(550,630,4)
+circle(560,630,4)
+circle(570,630,4)
+circle(580,630,4)
+circle(590,630,4)
+circle(600,630,4)
+circle(610,630,4)
+circle(620,630,4)
+circle(630,630,4)
+circle(640,630,4)
+circle(350,640,4)
+circle(360,640,4)
+circle(370,640,4)
+circle(380,640,4)
+circle(390,640,4)
+circle(400,640,4)
+circle(410,640,4)
+circle(420,640,4)
+circle(430,640,4)
+circle(440,640,4)
+circle(450,640,4)
+circle(460,640,4)
+circle(470,640,4)
+circle(480,640,4)
+circle(490,640,4)
+circle(500,640,4)
+circle(510,640,4)
+circle(520,640,4)
+circle(530,640,4)
+circle(540,640,4)
+circle(550,640,4)
+circle(560,640,4)
+circle(570,640,4)
+circle(580,640,4)
+circle(590,640,4)
+circle(600,640,4)
+circle(610,640,4)
+circle(620,640,4)
+circle(630,640,4)
+circle(640,640,4)
diff --git a/funtools/funtest/swap b/funtools/funtest/swap
new file mode 100644
index 0000000..fc72efc
--- /dev/null
+++ b/funtools/funtest/swap
@@ -0,0 +1,5 @@
+ if( cur->x:D == cur->y:D ) continue;
+ a = cur->x;
+ cur->x = cur->y;
+ cur->y = a;
+ cur->avg:E = (cur->x+cur->y)/2.0;
diff --git a/funtools/funtest/swap1 b/funtools/funtest/swap1
new file mode 100644
index 0000000..be9672e
--- /dev/null
+++ b/funtools/funtest/swap1
@@ -0,0 +1,8 @@
+ double a; # this is not passed to the generated C file
+ # nor is this
+ if( cur->x == cur->y ) continue;
+ a = cur->x;
+ cur->x = cur->y;
+ cur->y = a;
+ /* this comment is passed to the C file */
+ cur->avg:E = (cur->x+cur->y)/2.0;
diff --git a/funtools/funtest/t1.reg b/funtools/funtest/t1.reg
new file mode 100644
index 0000000..ec28a17
--- /dev/null
+++ b/funtools/funtest/t1.reg
@@ -0,0 +1,6 @@
+# Region file format: DS9 version 3.0
+# Filename: /home/eric/data/snr.fits
+global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
+fk5
+circle(345.2926,58.879817,151.99998")
+circle(344.86479,59.014261,223.99998")
diff --git a/funtools/funtest/t2.reg b/funtools/funtest/t2.reg
new file mode 100644
index 0000000..c90cf83
--- /dev/null
+++ b/funtools/funtest/t2.reg
@@ -0,0 +1,5 @@
+# Region file format: DS9 version 3.0
+# Filename: /home/eric/data/snr.fits
+global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
+fk5;circle(345.2926,58.879817,151.99998") # color=red
+fk5;circle(344.86479,59.014261,223.99998") # color=red
diff --git a/funtools/funtest/t3.reg b/funtools/funtest/t3.reg
new file mode 100644
index 0000000..b5ca9e6
--- /dev/null
+++ b/funtools/funtest/t3.reg
@@ -0,0 +1,4 @@
+# Region file format: DS9 version 3.0
+# Filename: /home/eric/data/snr.fits
+global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
+fk5, circle(345.2926,58.879817,151.99998"), circle(344.86479,59.014261,223.99998") # color=red
diff --git a/funtools/funtest/t4.reg b/funtools/funtest/t4.reg
new file mode 100644
index 0000000..01e908b
--- /dev/null
+++ b/funtools/funtest/t4.reg
@@ -0,0 +1 @@
+fk5; circle(345.2926,58.879817,151.99998"); circle(344.86479,59.014261,223.99998")
diff --git a/funtools/funtest/tboxell.in b/funtools/funtest/tboxell.in
new file mode 100644
index 0000000..ffb46cd
--- /dev/null
+++ b/funtools/funtest/tboxell.in
@@ -0,0 +1,50 @@
+#OPROG funcnts
+#NPROG ../funcnts
+#OFILE /home/eric/data/snr.ev
+#NFILE /home/eric/data/snr.ev
+
+#CMD Old Region New region
+#--- ----------------- ---------------------
+EXACT ell $X $Y 10 20 ell $X $Y 10 20
+EXACT ell $X $Y 10 20 0 ell $X $Y 10 20 0
+EXACT ell $X $Y 10 20 90 ell $X $Y 10 20 90
+EXACT ell $X $Y 10 20 180 ell $X $Y 10 20 180
+EXACT ell $X $Y 10 20 270 ell $X $Y 10 20 270
+EXACT ell $X $Y 10 20 360 ell $X $Y 10 20 360
+
+EXACT ell $X $Y 10 20 1 ell $X $Y 10 20 1
+EXACT ell $X $Y 10 20 27 ell $X $Y 10 20 27
+EXACT ell $X $Y 10 20 54 ell $X $Y 10 20 54
+EXACT ell $X $Y 10 20 81 ell $X $Y 10 20 81
+EXACT ell $X $Y 10 20 108 ell $X $Y 10 20 108
+EXACT ell $X $Y 10 20 135 ell $X $Y 10 20 135
+EXACT ell $X $Y 10 20 162 ell $X $Y 10 20 162
+EXACT ell $X $Y 10 20 189 ell $X $Y 10 20 189
+EXACT ell $X $Y 10 20 216 ell $X $Y 10 20 216
+EXACT ell $X $Y 10 20 243 ell $X $Y 10 20 243
+EXACT ell $X $Y 10 20 270 ell $X $Y 10 20 270
+EXACT ell $X $Y 10 20 297 ell $X $Y 10 20 297
+EXACT ell $X $Y 10 20 324 ell $X $Y 10 20 324
+EXACT ell $X $Y 10 20 351 ell $X $Y 10 20 351
+
+EXACT box $X $Y 10 20 box $X $Y 10 20
+EXACT box $X $Y 10 20 0 box $X $Y 10 20 0
+EXACT box $X $Y 10 20 90 box $X $Y 10 20 90
+EXACT box $X $Y 10 20 180 box $X $Y 10 20 180
+EXACT box $X $Y 10 20 270 box $X $Y 10 20 270
+EXACT box $X $Y 10 20 360 box $X $Y 10 20 360
+EXACT box $X $Y 10 20 1 box $X $Y 10 20 1
+EXACT box $X $Y 10 20 27 box $X $Y 10 20 27
+EXACT box $X $Y 10 20 54 box $X $Y 10 20 54
+EXACT box $X $Y 10 20 81 box $X $Y 10 20 81
+EXACT box $X $Y 10 20 108 box $X $Y 10 20 108
+EXACT box $X $Y 10 20 135 box $X $Y 10 20 135
+EXACT box $X $Y 10 20 162 box $X $Y 10 20 162
+EXACT box $X $Y 10 20 189 box $X $Y 10 20 189
+EXACT box $X $Y 10 20 216 box $X $Y 10 20 216
+EXACT box $X $Y 10 20 243 box $X $Y 10 20 243
+EXACT box $X $Y 10 20 270 box $X $Y 10 20 270
+EXACT box $X $Y 10 20 297 box $X $Y 10 20 297
+EXACT box $X $Y 10 20 324 box $X $Y 10 20 324
+EXACT box $X $Y 10 20 351 box $X $Y 10 20 351
+
diff --git a/funtools/funtest/tcalc.in b/funtools/funtest/tcalc.in
new file mode 100644
index 0000000..1421d6d
--- /dev/null
+++ b/funtools/funtest/tcalc.in
@@ -0,0 +1,14 @@
+#OPROG funcalc
+#NPROG ../funcalc
+#OFILE /home/eric/data/snr.ev
+#NFILE /home/eric/data/snr.ev.gz
+
+#CMD #files funcalc expression
+#--- ------ ---------------------
+EXACT 1 fprintf(stdout,"%d %d %d %d %f\\n",cur->x,cur->y,cur->pha,cur->pi,cur->time);
+EXACT 1 cur->avg:E=(cur->x+cur->y)/2.0;fprintf(stdout,"%d %d %d %d %f %f\\n",cur->x,cur->y,cur->pha,cur->pi,cur->avg,cur->time);
+EXACT 2 a=cur->x;cur->x=cur->y;cur->y=a;
+EXACT 2 cur->avg:E=(cur->x+cur->y)/2.0;
+EXACT 2 if(cur->x==cur->y:D )continue;a=cur->x;cur->x=cur->y;cur->y=a;
+EXACT 2 cur->val[0]:3D = cur->x; cur->val[1] = cur->y; cur->val[2] = cur->pha;
+EXACT 2 cur->diff:E=cur->x-prev->x;cur->px:I=prev->x;
diff --git a/funtools/funtest/tcols.in b/funtools/funtest/tcols.in
new file mode 100644
index 0000000..206b0cb
--- /dev/null
+++ b/funtools/funtest/tcols.in
@@ -0,0 +1,56 @@
+#OPROG fundisp
+#NPROG ../fundisp
+#OFILE ./test.ev
+#NFILE ./test.ev
+
+#CMD Old Filter New Filter
+#--- ----------------- ---------------------
+EXACT pha=1:3&&pi=5:6 pha=1:3&&pi=5:6
+EXACT pha=1:3&&pi=5:6 pha=1,2,3&&pi=5,6
+EXACT pha=1,3&&pi=6 pha=1,3&&pi=6
+EXACT pha=1,3&&pi==6 pha=1,3&&pi=6
+EXACT pha=1,3&&pi>5 pha=1,3&&pi>5
+EXACT pha=1,3,pi>5 pha=1,3,pi>5
+EXACT pi=3:4&&pha>4 pi=3:4&&pha>4
+EXACT pi=3:4&&pha>4 pi=3,4,pha>4
+EXACT pi=3:4&&4<pha pi=3:4&&4<pha
+EXACT pi=3:4&&4<pha pi=3:4,4<pha
+EXACT pi=3:4,4<pha pi=3:4,4<pha
+EXACT pi=3:4,4<pha pi=3:4,(4<pha)
+EXACT pi=3:4,4<pha pi=3:4,((4<pha))
+EXACT pi=3:4,(4<pha) pi=3:4,(4<pha)
+EXACT pi=3:4&&(pha>4) pi=3:4&&(pha>4)
+EXACT pi=3:4&&(4<pha) pi=3:4&&(4<pha)
+EXACT pi=3:4,(pha>4) pi=3:4,(pha>4)
+EXACT pi=3:4,pha>4 pi=3:4,pha>4
+EXACT pha=1,79494600<time pha==1,79494600<time
+EXACT pi>pha+3 pi>pha+3
+EXACT pha=1,3,5:7,pi=2,4,6:8&&time>79494600 pha=1,3,5:7,pi=2,4,6:8&&time>79494600
+EXACT pha=1,3,5:7,pi=2,4,6:8,time<79487100 pha=1,3,5:7,pi=2,4,6:8,time<79487100
+EXACT pi=1,pha=3 pi=1,pha=3
+EXACT pi=1,pha=3 pi=1,pha==3
+EXACT pi=1&&pha=3 pi=1,pha=3
+EXACT pha=1,3,5:7,pi=2:4 pha=1,3,5:7,pi=2:4
+EXACT pha=1,3,5:7,pi=2:4 pha=1,3,5:7&&pi=2:4
+EXACT pha=1,3,5:7,pi=2,4,6:8 pha=1,3,5:7,pi=2,4,6:8
+EXACT pi=3:4,max(pi,pha)==pi+1 pi=3:4,max(pi,pha)==pi+1
+EXACT pi=3:4,max(pi,pha)==pi+1 pi=3:4,(max(pi,pha)==pi+1)
+EXACT (pow(x-$X,2)+pow(y-$Y,2))<=4 (pow(x-$X,2)+pow(y-$Y,2))<=4
+EXACT min(pi,pha)==2&&max(pi,pha)==3 min(pi,pha)==2&&max(pi,pha)==3
+EXACT min(pi,pha)*64==x min(pi,pha)*64==x
+EXACT max(pi,pha)==(pi+1) max(pi,pha)==(pi+1)
+EXACT (pi-pha)>(2+pha-log(pi)) (pi-pha)>(2+pha-log(pi))
+EXACT (pi<=2)&&(pi==pha) (pi<=2)&&(pi==pha)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==017)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0xf)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0b1111)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&017)==017)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0xf)==0xf)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0b1111)==0b1111)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=017)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0xf)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0b1111)
+
+
+
+
diff --git a/funtools/funtest/tcone.in b/funtools/funtest/tcone.in
new file mode 100644
index 0000000..30fc72b
--- /dev/null
+++ b/funtools/funtest/tcone.in
@@ -0,0 +1,8 @@
+#CMD CMD1 CMD2(def: use cmd1)
+#--- ---------- -------------------
+EXACT -r RA_N:d -d Dec_N:d cat.txt stdout 216.103d 35.665d ".1'"
+EXACT -l cat.ls -r RA_N:d -d Dec_N:d cat.txt stdout RA_N:d DEC_N:d ".1'"
+EXACT -r RA_N:d -d Dec_N:d cat.txt stdout 216.103d 35.665d ".1'" -l cat.ls -r RA_N:d -d Dec_N:d cat.txt stdout RA_N:d DEC_N:d ".1'"
+EXACT -l cat.ls -r RA_N:d -d Dec_N:d cat.txt stdout RA_N:d DEC_N:d ".1'" -r RA_N:d -d Dec_N:d cat.txt stdout 216.103d 35.665d ".1'"
+
+
diff --git a/funtools/funtest/tenv b/funtools/funtest/tenv
new file mode 100755
index 0000000..7190649
--- /dev/null
+++ b/funtools/funtest/tenv
@@ -0,0 +1,24 @@
+#!/bin/sh
+# set -x
+
+X=504
+Y=512
+X2=`echo "$X + 10" | bc`
+Y2=`echo "$Y + 10" | bc`
+X3=`echo "$X + 20" | bc`
+Y3=$Y
+X4=`echo "$X + 10" | bc`
+Y4=`echo "$Y - 10" | bc`
+
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ echo before: $ARG3
+ ARG3=`eval "echo \"${C}${ARG3}\""`
+ echo after: $ARG3
+done
diff --git a/funtools/funtest/test.asc b/funtools/funtest/test.asc
new file mode 100644
index 0000000..dfab34c
--- /dev/null
+++ b/funtools/funtest/test.asc
@@ -0,0 +1,298 @@
+# X Y PHA TIME
+#------- -------- -------- ---------------------
+ -7 -7 -7 6.85000000
+ -7 -7 -7 6.86000000
+ -7 -7 -7 6.87000000
+ -7 -7 -7 6.88000000
+ -7 -7 -7 6.89000000
+ -7 -7 -7 6.90000000
+ -7 -7 -7 6.91000000
+ -6 -7 -6 7.86000000
+ -5 -7 -5 8.87000000
+ -4 -7 -4 9.88000000
+ -3 -7 -3 10.89000000
+ -2 -7 -2 11.90000000
+ -1 -7 -1 12.91000000
+ 0 -7 0 13.92000000
+ 0 -7 0 14.93000000
+ 1 -7 1 15.94000000
+ 2 -7 2 16.95000000
+ 3 -7 3 17.96000000
+ 4 -7 4 18.97000000
+ 5 -7 5 19.98000000
+ 6 -7 6 20.99000000
+ 7 -7 7 22.00000000
+ -7 -6 -7 22.86000000
+ -6 -6 -6 28.87000000
+ -6 -6 -6 28.88000000
+ -6 -6 -6 28.89000000
+ -6 -6 -6 28.90000000
+ -6 -6 -6 28.91000000
+ -6 -6 -6 28.92000000
+ -5 -6 -5 29.88000000
+ -4 -6 -4 30.89000000
+ -3 -6 -3 31.90000000
+ -2 -6 -2 32.91000000
+ -1 -6 -1 33.92000000
+ 0 -6 0 34.93000000
+ 0 -6 0 35.94000000
+ 1 -6 1 36.95000000
+ 2 -6 2 37.96000000
+ 3 -6 3 38.97000000
+ 4 -6 4 39.98000000
+ 5 -6 5 40.99000000
+ 6 -6 6 42.00000000
+ 7 -6 7 43.01000000
+ -7 -5 -7 43.87000000
+ -6 -5 -6 44.88000000
+ -5 -5 -5 49.89000000
+ -5 -5 -5 49.90000000
+ -5 -5 -5 49.91000000
+ -5 -5 -5 49.92000000
+ -5 -5 -5 49.93000000
+ -4 -5 -4 50.90000000
+ -3 -5 -3 51.91000000
+ -2 -5 -2 52.92000000
+ -1 -5 -1 53.93000000
+ 0 -5 0 54.94000000
+ 0 -5 0 55.95000000
+ 1 -5 1 56.96000000
+ 2 -5 2 57.97000000
+ 3 -5 3 58.98000000
+ 4 -5 4 59.99000000
+ 5 -5 5 61.00000000
+ 6 -5 6 62.01000000
+ 7 -5 7 63.02000000
+ -7 -4 -7 63.88000000
+ -6 -4 -6 64.89000000
+ -5 -4 -5 65.90000000
+ -4 -4 -4 69.91000000
+ -4 -4 -4 69.92000000
+ -4 -4 -4 69.93000000
+ -4 -4 -4 69.94000000
+ -3 -4 -3 70.92000000
+ -2 -4 -2 71.93000000
+ -1 -4 -1 72.94000000
+ 0 -4 0 73.95000000
+ 0 -4 0 74.96000000
+ 1 -4 1 75.97000000
+ 2 -4 2 76.98000000
+ 3 -4 3 77.99000000
+ 4 -4 4 79.00000000
+ 5 -4 5 80.01000000
+ 6 -4 6 81.02000000
+ 7 -4 7 82.03000000
+ -7 -3 -7 82.89000000
+ -6 -3 -6 83.90000000
+ -5 -3 -5 84.91000000
+ -4 -3 -4 85.92000000
+ -3 -3 -3 88.93000000
+ -3 -3 -3 88.94000000
+ -3 -3 -3 88.95000000
+ -2 -3 -2 89.94000000
+ -1 -3 -1 90.95000000
+ 0 -3 0 91.96000000
+ 0 -3 0 92.97000000
+ 1 -3 1 93.98000000
+ 2 -3 2 94.99000000
+ 3 -3 3 96.00000000
+ 4 -3 4 97.01000000
+ 5 -3 5 98.02000000
+ 6 -3 6 99.03000000
+ 7 -3 7 100.04000000
+ -7 -2 -7 100.90000000
+ -6 -2 -6 101.91000000
+ -5 -2 -5 102.92000000
+ -4 -2 -4 103.93000000
+ -3 -2 -3 104.94000000
+ -2 -2 -2 106.95000000
+ -2 -2 -2 106.96000000
+ -1 -2 -1 107.96000000
+ 0 -2 0 108.97000000
+ 0 -2 0 109.98000000
+ 1 -2 1 110.99000000
+ 2 -2 2 112.00000000
+ 3 -2 3 113.01000000
+ 4 -2 4 114.02000000
+ 5 -2 5 115.03000000
+ 6 -2 6 116.04000000
+ 7 -2 7 117.05000000
+ -7 -1 -7 117.91000000
+ -6 -1 -6 118.92000000
+ -5 -1 -5 119.93000000
+ -4 -1 -4 120.94000000
+ -3 -1 -3 121.95000000
+ -2 -1 -2 122.96000000
+ -1 -1 -1 123.97000000
+ 0 -1 0 124.98000000
+ 0 -1 0 125.99000000
+ 1 -1 1 127.00000000
+ 2 -1 2 128.01000000
+ 3 -1 3 129.02000000
+ 4 -1 4 130.03000000
+ 5 -1 5 131.04000000
+ 6 -1 6 132.05000000
+ 7 -1 7 133.06000000
+ -7 0 -7 133.92000000
+ -6 0 -6 134.93000000
+ -5 0 -5 135.94000000
+ -4 0 -4 136.95000000
+ -3 0 -3 137.96000000
+ -2 0 -2 138.97000000
+ -1 0 -1 139.98000000
+ 0 0 0 141.00000000
+ 1 0 1 142.01000000
+ 2 0 2 143.02000000
+ 3 0 3 144.03000000
+ 4 0 4 145.04000000
+ 5 0 5 146.05000000
+ 6 0 6 147.06000000
+ 7 0 7 148.07000000
+ -7 0 -7 148.93000000
+ -6 0 -6 149.94000000
+ -5 0 -5 150.95000000
+ -4 0 -4 151.96000000
+ -3 0 -3 152.97000000
+ -2 0 -2 153.98000000
+ -1 0 -1 154.99000000
+ 0 0 0 156.00000000
+ 1 0 1 157.02000000
+ 2 0 2 158.03000000
+ 3 0 3 159.04000000
+ 4 0 4 160.05000000
+ 5 0 5 161.06000000
+ 6 0 6 162.07000000
+ 7 0 7 163.08000000
+ -7 1 -7 163.94000000
+ -6 1 -6 164.95000000
+ -5 1 -5 165.96000000
+ -4 1 -4 166.97000000
+ -3 1 -3 167.98000000
+ -2 1 -2 168.99000000
+ -1 1 -1 170.00000000
+ 0 1 0 171.01000000
+ 0 1 0 172.02000000
+ 1 1 1 173.03000000
+ 2 1 2 174.04000000
+ 3 1 3 175.05000000
+ 4 1 4 176.06000000
+ 5 1 5 177.07000000
+ 6 1 6 178.08000000
+ 7 1 7 179.09000000
+ -7 2 -7 179.95000000
+ -6 2 -6 180.96000000
+ -5 2 -5 181.97000000
+ -4 2 -4 182.98000000
+ -3 2 -3 183.99000000
+ -2 2 -2 185.00000000
+ -1 2 -1 186.01000000
+ 0 2 0 187.02000000
+ 0 2 0 188.03000000
+ 1 2 1 189.04000000
+ 2 2 2 191.05000000
+ 2 2 2 191.06000000
+ 3 2 3 192.06000000
+ 4 2 4 193.07000000
+ 5 2 5 194.08000000
+ 6 2 6 195.09000000
+ 7 2 7 196.10000000
+ -7 3 -7 196.96000000
+ -6 3 -6 197.97000000
+ -5 3 -5 198.98000000
+ -4 3 -4 199.99000000
+ -3 3 -3 201.00000000
+ -2 3 -2 202.01000000
+ -1 3 -1 203.02000000
+ 0 3 0 204.03000000
+ 0 3 0 205.04000000
+ 1 3 1 206.05000000
+ 2 3 2 207.06000000
+ 3 3 3 210.07000000
+ 3 3 3 210.08000000
+ 3 3 3 210.09000000
+ 4 3 4 211.08000000
+ 5 3 5 212.09000000
+ 6 3 6 213.10000000
+ 7 3 7 214.11000000
+ -7 4 -7 214.97000000
+ -6 4 -6 215.98000000
+ -5 4 -5 216.99000000
+ -4 4 -4 218.00000000
+ -3 4 -3 219.01000000
+ -2 4 -2 220.02000000
+ -1 4 -1 221.03000000
+ 0 4 0 222.04000000
+ 0 4 0 223.05000000
+ 1 4 1 224.06000000
+ 2 4 2 225.07000000
+ 3 4 3 226.08000000
+ 4 4 4 230.09000000
+ 4 4 4 230.10000000
+ 4 4 4 230.11000000
+ 4 4 4 230.12000000
+ 5 4 5 231.10000000
+ 6 4 6 232.11000000
+ 7 4 7 233.12000000
+ -7 5 -7 233.98000000
+ -6 5 -6 234.99000000
+ -5 5 -5 236.00000000
+ -4 5 -4 237.01000000
+ -3 5 -3 238.02000000
+ -2 5 -2 239.03000000
+ -1 5 -1 240.04000000
+ 0 5 0 241.05000000
+ 0 5 0 242.06000000
+ 1 5 1 243.07000000
+ 2 5 2 244.08000000
+ 3 5 3 245.09000000
+ 4 5 4 246.10000000
+ 5 5 5 251.11000000
+ 5 5 5 251.12000000
+ 5 5 5 251.13000000
+ 5 5 5 251.14000000
+ 5 5 5 251.15000000
+ 6 5 6 252.12000000
+ 7 5 7 253.13000000
+ -7 6 -7 253.99000000
+ -6 6 -6 255.00000000
+ -5 6 -5 256.01000000
+ -4 6 -4 257.02000000
+ -3 6 -3 258.03000000
+ -2 6 -2 259.04000000
+ -1 6 -1 260.05000000
+ 0 6 0 261.06000000
+ 0 6 0 262.07000000
+ 1 6 1 263.08000000
+ 2 6 2 264.09000000
+ 3 6 3 265.10000000
+ 4 6 4 266.11000000
+ 5 6 5 267.12000000
+ 6 6 6 273.13000000
+ 6 6 6 273.14000000
+ 6 6 6 273.15000000
+ 6 6 6 273.16000000
+ 6 6 6 273.17000000
+ 6 6 6 273.18000000
+ 7 6 7 274.14000000
+ -7 7 -7 275.00000000
+ -6 7 -6 276.01000000
+ -5 7 -5 277.02000000
+ -4 7 -4 278.03000000
+ -3 7 -3 279.04000000
+ -2 7 -2 280.05000000
+ -1 7 -1 281.06000000
+ 0 7 0 282.07000000
+ 0 7 0 283.08000000
+ 1 7 1 284.09000000
+ 2 7 2 285.10000000
+ 3 7 3 286.11000000
+ 4 7 4 287.12000000
+ 5 7 5 288.13000000
+ 6 7 6 289.14000000
+ 7 7 7 296.15000000
+ 7 7 7 296.16000000
+ 7 7 7 296.17000000
+ 7 7 7 296.18000000
+ 7 7 7 296.19000000
+ 7 7 7 296.20000000
+ 7 7 7 296.21000000
diff --git a/funtools/funtest/test.ev b/funtools/funtest/test.ev
new file mode 100644
index 0000000..7b7c8e4
--- /dev/null
+++ b/funtools/funtest/test.ev
@@ -0,0 +1,62 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / There may be standard extensions END XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 26 / Width of table in bytes NAXIS2 = 296 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Table name EXTVER = 1 / Version number of table TFORM1 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TUNIT1 = ' ' / Physical units for field TFORM2 = '1I ' / Data type for field TTYPE2 = 'Y ' / Label for field TUNIT2 = ' ' / Physical units for field TFORM3 = '1I ' / Data type for field TTYPE3 = 'PHA ' / Label for field TUNIT3 = ' ' / Physical units for field TFORM4 = '1J ' / Data type for field TTYPE4 = 'PI ' / Label for field TUNIT4 = ' ' / Physical units for field TFORM5 = '1D ' / Data type for field TTYPE5 = 'TIME ' / Label for field TUNIT5 = ' ' / Physical units for field TFORM6 = '1E ' / Data type for field TTYPE6 = 'DX ' / Label for field TUNIT6 = ' ' / Physical units for field TFORM7 = '1E ' / Data type for field TTYPE7 = 'DY ' / Label for field TUNIT7 = ' ' / Physical units for field RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) EQUINOX = 2.000000E3 / equinox (epoch) for WCS TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 9.000000000000000E1 / sky coord (deg.) TCRVL2 = 6.000000000000000E1 / sky coord (deg.) TCDLT1 = -1.00000000000000E-1 / degrees per pixel TCDLT2 = 1.000000000000002E-1 / degrees per pixel TCRPX1 = 5.000000000000000E0 / pixel of tangent plane direc. TCRPX2 = 5.000000000000000E0 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) TLMIN1 = -7 / Min. axis value TLMAX1 = 7 / Max. axis value TLMIN2 = -7 / Min. axis value TLMAX2 = 7 / Max. axis value TLMIN6 = -7.50 / Min. axis value TLMAX6 = 7.50 / Max. axis value TLMIN7 = -7.50 / Min. axis value TLMAX7 = 7.50 / Max. axis value END ÿùÿùÿùÿÿÿù@ffffffÀð
+=qÀð
+=p¤Àð
+=qÀÐ
+=À°
+=p£×¿
+=@Ð
+=p¤ÀÐ
+=p¤À
+=p£×¿
+=@
+=qÀÐ
+=p£×À°
+=p£×¿À
+=@`
+=qÀð
+=?
+=q@°
+À°
+=¿
+=q@
+ÀÐ
+=À
+=¿À
+=q@`
+Àð
+=À
+=q@`
+=Àð
+=p£×À
+=q@
+@ð
+=p£×À`
+=q?À
+@Ð
+=p£×À
+=q?
+@°
+=p£×À°
+=q¿
+@
+=p£×ÀÐ
+=q¿À
+@`
+=p£×Àð
+=qÀ
+@
+=p¤@
+=p¤@ð
+=qÀ`
+?À
+=p¤@°
+=p¤@Ð
+=qÀ
+=@
+@Ð
+@ð
+=qÀ`
+=?À
+@Ð
+=p£×@ð
diff --git a/funtools/funtest/test.fits b/funtools/funtest/test.fits
new file mode 100644
index 0000000..8a58321
--- /dev/null
+++ b/funtools/funtest/test.fits
Binary files differ
diff --git a/funtools/funtest/test2.ev b/funtools/funtest/test2.ev
new file mode 100644
index 0000000..852f476
--- /dev/null
+++ b/funtools/funtest/test2.ev
@@ -0,0 +1,113 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / There may be standard extensions END XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 26 / Width of table in bytes NAXIS2 = 145 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Table name EXTVER = 1 / Version number of table TFORM1 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TSCAL1 = 10.0 / Label for field TZERO1 = 1.0 / Label for field TUNIT1 = ' ' / Physical units for field TFORM2 = '1I ' / Data type for field TTYPE2 = 'Y ' / Label for field TSCAL2 = 20.0 / Label for field TZERO2 = 2.0 / Label for field TUNIT2 = ' ' / Physical units for field TFORM3 = '1I ' / Data type for field TTYPE3 = 'PHA ' / Label for field TUNIT3 = ' ' / Physical units for field TFORM4 = '1J ' / Data type for field TTYPE4 = 'PI ' / Label for field TUNIT4 = ' ' / Physical units for field TFORM5 = '1D ' / Data type for field TTYPE5 = 'TIME ' / Label for field TUNIT5 = ' ' / Physical units for field TFORM6 = '1E ' / Data type for field TTYPE6 = 'DX ' / Label for field TUNIT6 = ' ' / Physical units for field TFORM7 = '1E ' / Data type for field TTYPE7 = 'DY ' / Label for field TUNIT7 = ' ' / Physical units for field RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) EQUINOX = 2.000000E3 / equinox (epoch) for WCS TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 9.000000000000000E1 / sky coord (deg.) TCRVL2 = 6.000000000000000E1 / sky coord (deg.) TCDLT1 = -1.00000000000000E-1 / degrees per pixel TCDLT2 = 1.000000000000002E-1 / degrees per pixel TCRPX1 = 5.000000000000000E0 / pixel of tangent plane direc. TCRPX2 = 5.000000000000000E0 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) TLMIN1 = 1 / Min. axis value TLMAX1 = 10 / Max. axis value TLMIN2 = 1 / Min. axis value TLMAX2 = 10 / Max. axis value TLMIN6 = 1.00 / Min. axis value TLMAX6 = 10.00 / Max. axis value TLMIN7 = 1.00 / Min. axis value TLMAX7 = 10.00 / Max. axis value END
+=@
+=@ 
+
+
+=p£×@à
+
+
+=p£×
+?€
+=p£×@À
+
+
+=qA
+=p£×
+@€
+=qA
+
+
+@@
+=q@ 
+=qA
+
+
+=p£×
+@
+=p£×@ 
+@À
+
+
+A
+=p£×@€
+=p£×
+@à
+áG®{@à
+A
+
+
+=p£×@@
+A
+=A
+
+
+=p£×@
+@à
+áG®{A
+=A
+=qA
+
+
+
+@_Ç
+=p£×?€
+
+@`×
+=p¤@
+
+@`$(õÂ\@@
+
+@`DzáG®@€
+
+@`dÌÌÌÌÍ@ 
+
+@`…¸Që…@À
+
+@`¥p£×
+=@à
+
+@`ÅÂ\(öA
+
+@`æzáG®A
+
+
+
+@b&fffffA
+
+
+
+@b&¸Që…A
+
+
+
+@b'
+=p£×A
+
+
+
+@b'\(õÂA
+
+
+
+@b'®záHA
+
+
+
+@b(
+
+
+
+@b(Që…¸A
+
+
+
+@b(£×
+=qA
+
+
+
+@b(õÂ\)A
+
+
+
+@b)G®záA
diff --git a/funtools/funtest/test2.raw b/funtools/funtest/test2.raw
new file mode 100644
index 0000000..24d57fb
--- /dev/null
+++ b/funtools/funtest/test2.raw
Binary files differ
diff --git a/funtools/funtest/tevread b/funtools/funtest/tevread
new file mode 100755
index 0000000..407953c
--- /dev/null
+++ b/funtools/funtest/tevread
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+if [ ! -x evread ]; then
+ echo "making evread ..."
+ make evread
+fi
+
+PRE=foo
+S=${HOME}/data/snr.ev
+PROG=./evread
+X=504
+Y=512
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -P)
+ PROG=./evread.pure
+ shift
+ continue;;
+ -f)
+ shift
+ S=$1
+ shift
+ S=$1
+ shift
+ continue;;
+ -x)
+ shift
+ X=$1
+ shift
+ continue;;
+ -y)
+ shift
+ Y=$1
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+X2=`echo "$X + 10" | bc`
+Y2=`echo "$Y + 10" | bc`
+X3=`echo "$X + 20" | bc`
+Y3=$Y
+X4=`echo "$X + 10" | bc`
+Y4=`echo "$Y - 10" | bc`
+
+echo "${PRE}: array of structs, funtools alloc ..."
+echo "${PRE}1: array of structs, user alloc ..."
+echo "${PRE}2: struct of arrays, funtools alloc ..."
+echo "${PRE}3: struct of arrays, user alloc ..."
+echo "${PRE}4: struct of pointers, funtools alloc ..."
+echo "${PRE}5: struct of pointers, user alloc ..."
+echo "${PRE}6: array of pointers, funtools alloc ..."
+echo "${PRE}7: array of pointers, user alloc ..."
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ eval "E=\"[$ARG2]\""
+ echo FILE $S"$E"
+ ${PROG} -w ${PRE}.fits $S"$E" > ${PRE}.ls
+ ${PROG} -u -w ${PRE}1.fits $S"$E" > ${PRE}1.ls
+ ${PROG} -a -w ${PRE}2.fits $S"$E" > ${PRE}2.ls
+ ${PROG} -a -u -w ${PRE}3.fits $S"$E" > ${PRE}3.ls
+ ${PROG} -p -w ${PRE}4.fits $S"$E" > ${PRE}4.ls
+ ${PROG} -p -u -w ${PRE}5.fits $S"$E" > ${PRE}5.ls
+ ${PROG} -e -w ${PRE}6.fits $S"$E" > ${PRE}6.ls
+ ${PROG} -e -u -w ${PRE}7.fits $S"$E" > ${PRE}7.ls
+ for i in 1 2 3 4 5 6 7
+ do
+ echo "EXACT ${PRE} and ${PRE}${i} ..."
+ cmp ${PRE}.fits ${PRE}${i}.fits
+# if [ $? != 0 ]; then
+# exit
+# fi
+ diff ${PRE}.ls ${PRE}${i}.ls
+# if [ $? != 0 ]; then
+# exit
+# fi
+ done
+ rm -f ${PRE}*.fits
+ rm -f ${PRE}*.ls
+
+done
+
diff --git a/funtools/funtest/tfile.in b/funtools/funtest/tfile.in
new file mode 100644
index 0000000..ecc3b6e
--- /dev/null
+++ b/funtools/funtest/tfile.in
@@ -0,0 +1,17 @@
+#OPROG funcnts
+#NPROG ../funcnts
+#OFILE /home/eric/data/snr.ev
+#NFILE /home/eric/data/snr.ev
+
+#CMD Old Region New region
+#--- ----------------- ---------------------
+EXACT @t1.reg @t1.reg
+EXACT @t2.reg @t2.reg
+EXACT @t3.reg @t3.reg
+EXACT @t4.reg @t4.reg
+EXACT @t1.reg @t2.reg
+EXACT @t1.reg @t3.reg
+EXACT @t1.reg @t4.reg
+EXACT @t2.reg @t3.reg
+EXACT @t2.reg @t4.reg
+EXACT @t3.reg @t4.reg
diff --git a/funtools/funtest/tfuncalc b/funtools/funtest/tfuncalc
new file mode 100755
index 0000000..6f532b6
--- /dev/null
+++ b/funtools/funtest/tfuncalc
@@ -0,0 +1,178 @@
+#!/bin/sh
+#set -x
+
+VERBOSE=0
+OPROG=funcalc
+NPROG=../funcalc
+R="cir(511,512,1)"
+OFILE="${HOME}/data/snr.ev"
+NFILE="${HOME}/data/snr.ev.gz"
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -f2)
+ shift
+ OFILE=$1
+ shift
+ NFILE=$1
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../funcalc.pure
+ shift
+ continue;;
+ -V)
+ DO1=YES
+ NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funcalc"
+ shift
+ continue;;
+ -r)
+ shift
+ R=$1
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -v2)
+ VERBOSE=2
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+OFILE="${OFILE}[${R}]"
+NFILE="${NFILE}[${R}]"
+$ECHO "OPROG="${OPROG} "FILE="${OFILE}
+$ECHO "NPROG="${NPROG} "FILE="${NFILE}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=${ARG1}
+ if [ x"$ARG2" = x1 ]; then
+ OUT=FALSE
+ else
+ OUT=TRUE
+ fi
+ EXPR=${ARG3}
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ ;;
+ OFILE)
+ OFILE=$ARG2
+ ;;
+ NFILE)
+ NFILE=$ARG2
+ ;;
+ REGION)
+ R=$ARG2
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT|SUM|REV)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "DO1: $EXPR"
+ if [ x"$OUT" = xFALSE ]; then
+ $NPROG -l "-L.." -e "${EXPR}" ${NFILE} > funcalc1.out
+ else
+ $NPROG -l "-L.." -e "${EXPR}" ${NFILE} stdout | fundisp stdin > funcalc1.out
+ fi
+ else
+ $ECHO "EXACT: $EXPR"
+ CMP=yes
+ XPROG=""
+ if [ x"$OUT" = xFALSE ]; then
+ $OPROG -e ${EXPR} ${OFILE} > tfuncalc1.out 2>err.log
+ else
+ $OPROG -e ${EXPR} ${OFILE} stdout | fundisp stdin > tfuncalc1.out 2>err.log
+ fi
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+ if [ x"$OUT" = xFALSE ]; then
+ $NPROG -l "-L.." -e ${EXPR} ${NFILE} > tfuncalc2.out
+ else
+ $NPROG -l "-L.." -e ${EXPR} ${NFILE} stdout | fundisp stdin > tfuncalc2.out
+ fi
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-""}${XPROG:+" "}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ mv tfuncalc1.out funcalc1.out
+ mv tfuncalc2.out funcalc2.out
+ diff funcalc1.out funcalc2.out
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** funcalc1.out *****"
+ cat funcalc1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** funcalc1.out *****"
+ cat funcalc1.out
+ $ECHO "***** funcalc2.out *****"
+ cat funcalc2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funcalc1.out funcalc2.out tfuncalc1.out tfuncalc2.out
diff --git a/funtools/funtest/tfuncnts b/funtools/funtest/tfuncnts
new file mode 100755
index 0000000..8ad5539
--- /dev/null
+++ b/funtools/funtest/tfuncnts
@@ -0,0 +1,307 @@
+#!/bin/sh
+# set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+SW="-r"
+X=504
+Y=512
+STDIN=/dev/null
+OPROG=funcnts
+NPROG=../funcnts
+OFILE=${HOME}/data/snr.ev
+NFILE=${HOME}/data/snr.ev.gz
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+EAWK='start==1&&NF>0{tpix += $2; tarea +=$3; print $0};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
+
+SAWK='start==1&&NF>0{tpix += $2; tarea +=$3};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
+
+FAWK='{tpix = $1};END{print tpix}'
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -b)
+ shift
+ B="$1"
+ shift
+ continue;;
+ -c)
+ shift
+ C="$1;"
+ shift
+ continue;;
+ -E)
+ DOEXACT=YES
+ shift
+ continue;;
+ -e)
+ FIELD=`${OPROG} ${OFILE} "field" | awk "$SAWK" | awk "$FAWK"`
+ $ECHO "FIELD: $FIELD"
+ $ECHO " "
+ M="-"
+ shift
+ continue;;
+ -f1)
+ shift
+ OFILE=$1
+ NFILE=$1
+ shift
+ continue;;
+ -f2)
+ shift
+ OFILE=$1
+ shift
+ NFILE=$1
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$1
+ if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ continue;;
+ -P)
+ PURE=YES
+ NPROG=../funcnts.pure
+ shift
+ continue;;
+ -V)
+ DO1=YES
+ NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funcnts"
+ shift
+ continue;;
+ -s)
+ shift
+ SW=$1
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -v2)
+ VERBOSE=2
+ shift
+ continue;;
+ -x)
+ shift
+ X=$1
+ shift
+ continue;;
+ -y)
+ shift
+ Y=$1
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$B" != x ]; then
+ OFILE=${OFILE}"[$B]"
+ NFILE=${NFILE}"[$B]"
+fi
+
+X2=`$ECHO "$X + 10" | bc`
+Y2=`$ECHO "$Y + 10" | bc`
+X3=`$ECHO "$X + 20" | bc`
+Y3=$Y
+X4=`$ECHO "$X + 10" | bc`
+Y4=`$ECHO "$Y - 10" | bc`
+
+$ECHO "OPROG="${OPROG} "OFILE="${OFILE}
+$ECHO "NPROG="${NPROG} "NFILE="${NFILE}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ eval "ARG2=\"${C}$ARG2\""
+ eval "ARG3=\"${C}$ARG3\""
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ ;;
+ OFILE)
+ OFILE=$ARG2
+ ;;
+ NFILE)
+ NFILE=$ARG2
+ ;;
+ EXCLUDE)
+ FIELD=`$OPROG ${OFILE} "field" | awk "$SAWK" | awk "$FAWK"`
+ $ECHO "FIELD: $FIELD"
+ $ECHO " "
+ M="-"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
+ else
+ $ECHO "${M}EXACT: $ARG2 ... $ARG3"
+ if [ x"$DOEXACT" = xYES ]; then
+ CMP=yes
+ XPROG=""
+ $OPROG ${SW} ${OFILE} "$ARG2" > funcnts1.out 2>err.log
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ cat err.log
+ fi
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-''}${XPROG:+' '}$NPROG"
+ fi
+ else
+ CMP=yes
+ XPROG=""
+ $OPROG ${SW} ${OFILE} "$ARG2" | awk $EAWK > funcnts1.out 2>err.log
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ cat err.log
+ fi
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" |awk $EAWK >funcnts2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-''}${XPROG:+' '}$NPROG"
+ fi
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x$M = x ]; then
+ diff funcnts1.out funcnts2.out
+ else
+ V1=`cat funcnts1.out | awk $FAWK`
+ V2=`cat funcnts2.out | awk $FAWK`
+ V2=`$ECHO "$FIELD-$V2" | bc`
+ if [ $V1 != $V2 ]; then
+ $ECHO "V1=$V1 V2=$V2"
+ fi
+ fi
+ fi
+ fi
+ $ECHO " "
+ ;;
+ REV)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
+ else
+ $ECHO "${M}REV: $ARG2 ... $ARG3"
+ $OPROG ${SW} ${OFILE} "$ARG2" | awk $EAWK > tfuncnts1.out
+ if test $? -ne 0; then
+ $ECHO "skipping $NPROG due to error"
+ else
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" | awk $EAWK > tfuncnts2.out
+ if [ x$M = x ]; then
+ awk 'NF==3{print $0}' < tfuncnts1.out | sort -r | awk '{print $2,$3}' > funcnts1.out
+ awk 'NF==3{print $2,$3}' < tfuncnts2.out > funcnts2.out
+ diff funcnts1.out funcnts2.out
+ else
+ V1=`cat funcnts1.out | awk $FAWK`
+ V2=`cat funcnts2.out | awk $FAWK`
+ V2=`$ECHO "$FIELD-$V2" | bc`
+ if [ $V1 != $V2 ]; then
+ $ECHO "V1=$V1 V2=$V2"
+ fi
+ fi
+ fi
+ fi
+ $ECHO " "
+ ;;
+ SUM)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
+ else
+ $ECHO "${M}SUM: $ARG2 ... $ARG3"
+ $OPROG ${SW} ${OFILE} "$ARG2" | awk $SAWK > funcnts1.out
+ if test $? -ne 0; then
+ $ECHO "skipping $NPROG due to error"
+ else
+ cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" | awk $SAWK > funcnts2.out
+ if [ x$M = x ]; then
+ diff funcnts1.out funcnts2.out
+ else
+ V1=`cat funcnts1.out | awk $FAWK`
+ V2=`cat funcnts2.out | awk $FAWK`
+ V2=`$ECHO "$FIELD-$V2" | bc`
+ if [ $V1 != $V2 ]; then
+ $ECHO "V1=$V1 V2=$V2"
+ fi
+ fi
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** funcnts1.out *****"
+ cat funcnts1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** funcnts1.out *****"
+ cat funcnts1.out
+ $ECHO "***** funcnts2.out *****"
+ cat funcnts2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funcnts1.out funcnts2.out tfuncnts1.out tfuncnts2.out
diff --git a/funtools/funtest/tfuncone b/funtools/funtest/tfuncone
new file mode 100755
index 0000000..7b307c4
--- /dev/null
+++ b/funtools/funtest/tfuncone
@@ -0,0 +1,131 @@
+#!/bin/sh
+#set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+OPROG=funcone
+NPROG=../funcone
+STDIN=/dev/null
+FILE=cat.txt
+LIST="cat.ls"
+
+# avoid setting EXTNAME since we are not using
+if [ x$TEXT_EXTNAME != x ]; then
+ unset TEXT_EXTNAME
+fi
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../funcone.pure
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -V)
+ VERBOSE=2
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+$ECHO "OPROG="${OPROG}
+$ECHO "NPROG="${NPROG}
+
+IFS=" "
+while read ARG1 ARG2 ARG3 ARG4; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+
+ if [ x$ARG3 = x ]; then
+ ARG3="$ARG2"
+ fi
+
+ case $CMD in
+ EXIT)
+ exit
+ ;;
+ EXACT)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ eval "$NPROG $ARG3" | fundisp stdin > funcone2.out
+ else
+ $ECHO "${M}EXACT: $ARG2 ... $ARG3"
+ CMP=yes
+ XPROG=""
+ eval "$OPROG $ARG2" | fundisp stdin > tfuncone1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+
+ eval "$NPROG $ARG3" | fundisp stdin > tfuncone2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfuncone1.out > funcone1.out
+ sed "/^ *$X $Y.*$/d" < tfuncone2.out > funcone2.out
+ else
+ mv tfuncone1.out funcone1.out
+ mv tfuncone2.out funcone2.out
+ fi
+ diff funcone1.out funcone2.out
+ else
+ $ECHO "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** funcone1.out *****"
+ cat funcone1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** funcone1.out *****"
+ cat funcone1.out
+ $ECHO "***** funcone2.out *****"
+ cat funcone2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funcone1.out funcone2.out tfuncone1.out tfuncone2.out
diff --git a/funtools/funtest/tfundisp b/funtools/funtest/tfundisp
new file mode 100755
index 0000000..6edfb82
--- /dev/null
+++ b/funtools/funtest/tfundisp
@@ -0,0 +1,227 @@
+#!/bin/sh
+# set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+OPROG=fundisp
+NPROG=../fundisp
+STDIN=/dev/null
+OFILE=${HOME}/data/snr.ev
+NFILE=${HOME}/data/snr.ev.gz
+X=504
+Y=512
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -b)
+ shift
+ B="$1("
+ B2=")"
+ shift
+ continue;;
+ -c)
+ shift
+ C="$1\;"
+ shift
+ continue;;
+ -e)
+ OM="field;-"
+ NM="-"
+ shift
+ continue;;
+ -f2)
+ shift
+ OFILE=$1
+ shift
+ NFILE=$1
+ shift
+ continue;;
+ -i)
+ DOINC=YES
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$1
+ if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../fundisp.pure
+ shift
+ continue;;
+ -V)
+ DO1=YES
+ NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../fundisp"
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -v2)
+ VERBOSE=2
+ shift
+ continue;;
+ -x)
+ shift
+ X=$1
+ shift
+ continue;;
+ -y)
+ shift
+ Y=$1
+ shift
+ continue;;
+ -z)
+ ZBUG=true
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+X2=`$ECHO "$X + 10" | bc`
+Y2=`$ECHO "$Y + 10" | bc`
+X3=`$ECHO "$X + 20" | bc`
+Y3=$Y
+X4=`$ECHO "$X + 10" | bc`
+Y4=`$ECHO "$Y - 10" | bc`
+
+$ECHO "OPROG="${OPROG} "FILE="${OFILE}
+$ECHO "NPROG="${NPROG} "FILE="${NFILE}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ eval "ARG2=\"${C}$ARG2\""
+ eval "ARG3=\"${C}$ARG3\""
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ $ECHO OPROG="${OPROG}"
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ $ECHO NPROG="${NPROG}"
+ ;;
+ OFILE)
+ OFILE=$ARG2
+ $ECHO OFILE="${OFILE}"
+ ;;
+ NFILE)
+ NFILE=$ARG2
+ $ECHO NFILE="${NFILE}"
+ ;;
+ EXCLUDE)
+ OM="field;-"
+ NM="-"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT|SUM|REV)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ eval "cat $STDIN | $NPROG ${NFILE}\"[${NM}$ARG3]\" > fundisp2.out"
+ else
+ if [ x"$DOINC" = xYES ]; then
+ $ECHO "$ARG3" > arg3.inc
+ $ECHO "${M}EXACT: ${B}$ARG2${B2} ... ${B}@include($ARG3)${B2}"
+ ARG3="@arg3.inc"
+ else
+ $ECHO "${M}EXACT: ${B}$ARG2 ... ${B}$ARG3"
+ fi
+ CMP=yes
+ XPROG=""
+ $OPROG ${OFILE}"[${B}${OM}$ARG2${B2}]" > tfundisp1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+ cat $STDIN | $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" > tfundisp2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfundisp1.out > fundisp1.out
+ sed "/^ *$X $Y.*$/d" < tfundisp2.out > fundisp2.out
+ else
+ mv tfundisp1.out fundisp1.out
+ mv tfundisp2.out fundisp2.out
+ fi
+ diff fundisp1.out fundisp2.out
+ else
+ $ECHO "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** fundisp1.out *****"
+ cat fundisp1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** fundisp1.out *****"
+ cat fundisp1.out
+ $ECHO "***** fundisp2.out *****"
+ cat fundisp2.out
+ fi
+ rm -f err.log
+done
+
+rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
diff --git a/funtools/funtest/tfunhead b/funtools/funtest/tfunhead
new file mode 100755
index 0000000..7c2a742
--- /dev/null
+++ b/funtools/funtest/tfunhead
@@ -0,0 +1,241 @@
+#!/bin/sh
+# set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+TEXT=0
+OPROG=funhead
+NPROG=../funhead
+STDIN=/dev/null
+OFILE=${HOME}/data/snr.ev
+NFILE=${HOME}/data/snr.ev.gz
+X=504
+Y=512
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -b)
+ shift
+ B="$1("
+ B2=")"
+ shift
+ continue;;
+ -c)
+ shift
+ C="$1\;"
+ shift
+ continue;;
+ -e)
+ OM="field;-"
+ NM="-"
+ shift
+ continue;;
+ -f2)
+ shift
+ OFILE=$1
+ shift
+ NFILE=$1
+ shift
+ continue;;
+ -i)
+ DOINC=YES
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$NFILE
+ if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../funhead.pure
+ shift
+ continue;;
+ -V)
+ DO1=YES
+ NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funhead"
+ shift
+ continue;;
+ -t)
+ TEXT=1
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -v2)
+ VERBOSE=2
+ shift
+ continue;;
+ -x)
+ shift
+ X=$1
+ shift
+ continue;;
+ -y)
+ shift
+ Y=$1
+ shift
+ continue;;
+ -z)
+ ZBUG=true
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+X2=`$ECHO "$X + 10" | bc`
+Y2=`$ECHO "$Y + 10" | bc`
+X3=`$ECHO "$X + 20" | bc`
+Y3=$Y
+X4=`$ECHO "$X + 10" | bc`
+Y4=`$ECHO "$Y - 10" | bc`
+
+$ECHO "OPROG="${OPROG} "FILE="${OFILE}
+$ECHO "NPROG="${NPROG} "FILE="${NFILE}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ eval "ARG2=\"${C}$ARG2\""
+ eval "ARG3=\"${C}$ARG3\""
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ $ECHO OPROG="${OPROG}"
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ $ECHO NPROG="${NPROG}"
+ ;;
+ OFILE)
+ OFILE=$ARG2
+ $ECHO OFILE="${OFILE}"
+ ;;
+ NFILE)
+ NFILE=$ARG2
+ $ECHO NFILE="${NFILE}"
+ ;;
+ EXCLUDE)
+ OM="field;-"
+ NM="-"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT|SUM|REV)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ $NPROG ${NFILE}"[${NM}$ARG3]" < $STDIN | egrep -v OBS_ID | \
+ sed 's/ */ /g' | sort | \
+ awk -F/ '{print $1}' | awk -F= '$2 ~ /'\''/{print $1,$2; next}{printf("%s %f\n", $1, $2)}' > funhead2.out
+ else
+ if [ x"$DOINC" = xYES ]; then
+ $ECHO "$ARG3" > arg3.inc
+ $ECHO "${M}EXACT: ${B}$ARG2${B2} ... ${B}@include($ARG3)${B2}"
+ ARG3="@arg3.inc"
+ else
+ $ECHO "${M}EXACT: ${B}$ARG2 ... ${B}$ARG3"
+ fi
+ CMP=yes
+ XPROG=""
+ $OPROG ${OFILE}"[${B}${OM}$ARG2${B2}]" | egrep -v OBS_ID | \
+ sed 's/ */ /g' | sort | \
+ awk -F/ '{print $1}' | awk -F= '$2 ~ /'\''/{print $1,$2; next}{printf("%s %f\n", $1, $2)}' > tfunhead1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+ if [ x$TEXT = x1 ]; then
+ ARG3=`$ECHO "$ARG3-1" | bc`
+ fi
+ $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" < $STDIN | egrep -v OBS_ID | \
+ sed 's/ */ /g' | sort | \
+ awk -F/ '{print $1}' | awk -F= '$2 ~ /'\''/{print $1,$2; next}{printf("%s %f\n", $1, $2)}' > tfunhead2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfunhead1.out > funhead1.out
+ sed "/^ *$X $Y.*$/d" < tfunhead2.out > funhead2.out
+ else
+ mv tfunhead1.out funhead1.out
+ mv tfunhead2.out funhead2.out
+ fi
+ diff funhead1.out funhead2.out
+ else
+ $ECHO "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** funhead1.out *****"
+ cat funhead1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** funhead1.out *****"
+ cat funhead1.out
+ $ECHO "***** funhead2.out *****"
+ cat funhead2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funhead1.out funhead2.out tfunhead1.out tfunhead2.out
diff --git a/funtools/funtest/tfunimage b/funtools/funtest/tfunimage
new file mode 100755
index 0000000..ee8b5a8
--- /dev/null
+++ b/funtools/funtest/tfunimage
@@ -0,0 +1,227 @@
+#!/bin/sh
+# set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+OPROG=../fundisp
+NPROG=../funimage
+STDIN=/dev/null
+OFILE=${HOME}/data/snr.fits
+NFILE=${HOME}/data/bzero.fits
+X=504
+Y=512
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -b)
+ shift
+ B="$1("
+ B2=")"
+ shift
+ continue;;
+ -c)
+ shift
+ C="$1\;"
+ shift
+ continue;;
+ -e)
+ OM="field;-"
+ NM="-"
+ shift
+ continue;;
+ -f2)
+ shift
+ OFILE=$1
+ shift
+ NFILE=$1
+ shift
+ continue;;
+ -i)
+ DOINC=YES
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$NFILE
+ if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../funimage.pure
+ shift
+ continue;;
+ -V)
+ DO1=YES
+ NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funimage"
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -v2)
+ VERBOSE=2
+ shift
+ continue;;
+ -x)
+ shift
+ X=$1
+ shift
+ continue;;
+ -y)
+ shift
+ Y=$1
+ shift
+ continue;;
+ -z)
+ ZBUG=true
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+X2=`$ECHO "$X + 10" | bc`
+Y2=`$ECHO "$Y + 10" | bc`
+X3=`$ECHO "$X + 20" | bc`
+Y3=$Y
+X4=`$ECHO "$X + 10" | bc`
+Y4=`$ECHO "$Y - 10" | bc`
+
+$ECHO "OPROG="${OPROG} "FILE="${OFILE}
+$ECHO "NPROG="${NPROG} "FILE="${NFILE}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ eval "ARG2=\"${C}$ARG2\""
+ eval "ARG3=\"${C}$ARG3\""
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ $ECHO OPROG="${OPROG}"
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ $ECHO NPROG="${NPROG}"
+ ;;
+ OFILE)
+ OFILE=$ARG2
+ $ECHO OFILE="${OFILE}"
+ ;;
+ NFILE)
+ NFILE=$ARG2
+ $ECHO NFILE="${NFILE}"
+ ;;
+ EXCLUDE)
+ OM="field;-"
+ NM="-"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT|SUM|REV)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ cat $STDIN | $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" stdout | $OPROG stdin| sed -e '1,2d;s/[0-9]*://g;s/ +/ /g' | awk '{for(i=1;i<=NF;i++){printf("%.2f ",$i)}printf("\n");}' > funimage2.out
+ else
+ if [ x"$DOINC" = xYES ]; then
+ $ECHO "$ARG3" > arg3.inc
+ $ECHO "${M}EXACT: ${B}$ARG2${B2} ... ${B}@include($ARG3)${B2}"
+ ARG3="@arg3.inc"
+ else
+ $ECHO "${M}EXACT: ${B}$ARG2 ... ${B}$ARG3"
+ fi
+ CMP=yes
+ XPROG=""
+ $OPROG ${OFILE}"[${B}${OM}$ARG2${B2}]" | sed -e '1,2d;s/[0-9]*://g;s/ +/ /g' | awk '{for(i=1;i<=NF;i++){printf("%.2f ",$i)}printf("\n");}'> tfunimage1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+ cat $STDIN | $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" stdout | $OPROG stdin| sed -e '1,2d;s/[0-9]*://g;s/ +/ /g' | awk '{for(i=1;i<=NF;i++){printf("%.2f ",$i)}printf("\n");}' > tfunimage2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfunimage1.out > funimage1.out
+ sed "/^ *$X $Y.*$/d" < tfunimage2.out > funimage2.out
+ else
+ mv tfunimage1.out funimage1.out
+ mv tfunimage2.out funimage2.out
+ fi
+ diff funimage1.out funimage2.out
+ else
+ $ECHO "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** funimage1.out *****"
+ cat funimage1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** funimage1.out *****"
+ cat funimage1.out
+ $ECHO "***** funimage2.out *****"
+ cat funimage2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funimage1.out funimage2.out tfunimage1.out tfunimage2.out
diff --git a/funtools/funtest/tfunmerge b/funtools/funtest/tfunmerge
new file mode 100755
index 0000000..674381c
--- /dev/null
+++ b/funtools/funtest/tfunmerge
@@ -0,0 +1,126 @@
+#!/bin/sh
+#set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+OPROG=funmerge
+NPROG=../funmerge
+STDIN=/dev/null
+DIR=../txt/
+FILES="mif1.fits mif2.fits mif3.fits mif4.fits"
+LIST="@mif.lst"
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../funmerge.pure
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -V)
+ VERBOSE=2
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+$ECHO "OPROG="${OPROG}
+$ECHO "NPROG="${NPROG}
+
+IFS=" "
+while read ARG1 ARG2 ARG3 ARG4; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+
+ eval "ARG3=\"$ARG3\""
+ eval "ARG4=\"$ARG4\""
+
+ case $CMD in
+ EXIT)
+ exit
+ ;;
+ EXACT)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG2"
+ eval "$NPROG $ARG2 $ARG3 stdout" | fundisp stdin > funmerge2.out
+ else
+ $ECHO "${M}EXACT: $ARG2 $ARG3 ... $ARG2 $ARG4"
+ CMP=yes
+ XPROG=""
+ eval "$OPROG $ARG2 $ARG3 stdout" | fundisp stdin > tfunmerge1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+
+ eval "$NPROG $ARG2 $ARG4 stdout" | fundisp stdin > tfunmerge2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfunmerge1.out > funmerge1.out
+ sed "/^ *$X $Y.*$/d" < tfunmerge2.out > funmerge2.out
+ else
+ mv tfunmerge1.out funmerge1.out
+ mv tfunmerge2.out funmerge2.out
+ fi
+ diff funmerge1.out funmerge2.out
+ else
+ $ECHO "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** funmerge1.out *****"
+ cat funmerge1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** funmerge1.out *****"
+ cat funmerge1.out
+ $ECHO "***** funmerge2.out *****"
+ cat funmerge2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funmerge1.out funmerge2.out tfunmerge1.out tfunmerge2.out
diff --git a/funtools/funtest/tfuntext b/funtools/funtest/tfuntext
new file mode 100755
index 0000000..70547fb
--- /dev/null
+++ b/funtools/funtest/tfuntext
@@ -0,0 +1,140 @@
+#!/bin/sh
+#set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+OPROG=fundisp
+NPROG=../fundisp
+STDIN=/dev/null
+DIR=../txt/
+
+if [ -r /usr/ucb/echo ]; then
+ ECHO=/usr/ucb/echo
+else
+ ECHO=echo
+fi
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$1
+ if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ NPROG=../fundisp.pure
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -V)
+ VERBOSE=2
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+$ECHO "OPROG="${OPROG}
+$ECHO "NPROG="${NPROG}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ ARG2=${DIR}${ARG2}
+ ARG3=${DIR}${ARG3}
+
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ $ECHO OPROG="${OPROG}"
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ $ECHO NPROG="${NPROG}"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT|SUM|REV)
+ if [ x"$DO1" = xYES ]; then
+ $ECHO "${M}DO1: $ARG3"
+ cat $STDIN | $NPROG $ARG3 > fundisp1.out
+ else
+ $ECHO "${M}EXACT: $ARG2 ... $ARG3"
+ CMP=yes
+ XPROG=""
+ $OPROG $ARG2 > tfundisp1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+ cat $STDIN | $NPROG $ARG3 > tfundisp2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfundisp1.out > fundisp1.out
+ sed "/^ *$X $Y.*$/d" < tfundisp2.out > fundisp2.out
+ else
+ mv tfundisp1.out fundisp1.out
+ mv tfundisp2.out fundisp2.out
+ fi
+ diff fundisp1.out fundisp2.out
+ else
+ $ECHO "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ $ECHO " "
+ ;;
+ *)
+ $ECHO "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ $ECHO "***** fundisp1.out *****"
+ cat fundisp1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ $ECHO "***** fundisp1.out *****"
+ cat fundisp1.out
+ $ECHO "***** fundisp2.out *****"
+ cat fundisp2.out
+ fi
+ rm -f err.log
+done
+
+rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
diff --git a/funtools/funtest/tfunview b/funtools/funtest/tfunview
new file mode 100755
index 0000000..93f4710
--- /dev/null
+++ b/funtools/funtest/tfunview
@@ -0,0 +1,163 @@
+#!/bin/sh
+#set -x
+
+rm -f tview.fits tview.fit
+ln -s $HOME/data/snr.ev tview.fits
+ln -s $HOME/data/snr.ev tview.fit
+
+FUN_VIEWFILE=./funtools1.vu
+export FUN_VIEWFILE
+
+PLATFORM=`uname`
+VERBOSE=0
+OPROG=../fundisp
+NPROG=../fundisp
+STDIN=/dev/null
+# DIR=../txt/
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -f)
+ shift
+ FUN_VIEWFILE=$1
+ export FUN_VIEWFILE
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$1
+ if [ x`echo $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ shift
+ continue;;
+ -P)
+ DO1=YES
+ OPROG=../fundisp.pure
+ NPROG=../fundisp.pure
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -V)
+ VERBOSE=2
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+echo "OPROG ="${OPROG}
+echo "NPROG ="${NPROG}
+echo "VIEWFILE="${FUN_VIEWFILE}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+# ARG2=${DIR}${ARG2}
+# ARG3=${DIR}${ARG3}
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ echo OPROG="${OPROG}"
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ echo NPROG="${NPROG}"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT|SUM|REV)
+ if [ x"$DO1" = xYES ]; then
+ echo "${M}DO1: $ARG2"
+ eval $OPROG $ARG2 > fundisp1.out
+ else
+ echo "${M}EXACT: $ARG2 ... $ARG3"
+ CMP=yes
+ XPROG=""
+ eval $OPROG $ARG2 > tfundisp1.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="$OPROG"
+ fi
+ eval $NPROG $ARG3 > tfundisp2.out
+ if test $? -ne 0; then
+ CMP=no
+ XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
+ fi
+ if [ x"$CMP" = xyes ]; then
+ if [ x"$ZBUG" = xtrue ]; then
+ sed "/^ *$X $Y.*$/d" < tfundisp1.out > fundisp1.out
+ sed "/^ *$X $Y.*$/d" < tfundisp2.out > fundisp2.out
+ else
+ mv tfundisp1.out fundisp1.out
+ mv tfundisp2.out fundisp2.out
+ fi
+ diff fundisp1.out fundisp2.out
+ else
+ echo "skipping compare due to errors in $XPROG"
+ fi
+ fi
+ echo " "
+ ;;
+ *)
+ echo "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ echo "***** fundisp1.out *****"
+ cat fundisp1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ echo "***** fundisp1.out *****"
+ cat fundisp1.out
+ echo "***** fundisp2.out *****"
+ cat fundisp2.out
+ fi
+ rm -f err.log
+done
+
+rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
+rm -f tview.fits tview.fit
diff --git a/funtools/funtest/thead.in b/funtools/funtest/thead.in
new file mode 100644
index 0000000..2ec5d43
--- /dev/null
+++ b/funtools/funtest/thead.in
@@ -0,0 +1,12 @@
+#OPROG fundisp
+#NPROG ../funimage
+#OFILE ./test.ev
+#NFILE ./test.ev
+
+#CMD Old Filter New Filter
+#--- ----------------- ---------------------
+EXACT 1 1
+EXACT 2 2
+EXACT 3 3
+EXACT 4 4
+
diff --git a/funtools/funtest/timev b/funtools/funtest/timev
new file mode 100755
index 0000000..d5e71e3
--- /dev/null
+++ b/funtools/funtest/timev
@@ -0,0 +1,264 @@
+#!/bin/sh
+# set -x
+
+PLATFORM=`uname`
+VERBOSE=0
+SW="-r"
+X=504
+Y=512
+
+STDIN=/dev/null
+OPROG=funcnts
+NPROG=../funcnts
+OFILE=${HOME}/data/snr.fits
+NFILE=${HOME}/data/snr.ev.gz
+
+
+EAWK='start==1&&NF>0{tpix += $2; tarea +=$3; print $0};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
+
+SAWK='start==1&&NF>0{tpix += $2; tarea +=$3};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
+
+FAWK='{tpix = $1};END{print tpix}'
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -1)
+ DO1=YES
+ shift
+ continue;;
+ -b)
+ shift
+ B=$1
+ shift
+ continue;;
+ -c)
+ shift
+ C="$1\;"
+ shift
+ continue;;
+ -e)
+ FIELD=`${OPROG} ${OFILE}${B} "field" | awk "$SAWK" | awk "$FAWK"`
+ echo "FIELD: $FIELD"
+ echo " "
+ M="-"
+ shift
+ continue;;
+ -f)
+ shift
+ FILE=$1
+ shift
+ continue;;
+ -n)
+ shift
+ NPROG=$1
+ shift
+ continue;;
+ -o)
+ shift
+ OPROG=$1
+ shift
+ continue;;
+ -p)
+ shift
+ STDIN=$1
+ if [ x`echo $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
+ NFILE=stdin.gz
+ else
+ NFILE=stdin
+ fi
+ shift
+ continue;;
+ -P)
+ PURE=YES
+ DO1=YES
+ NPROG=../funcnts.pure
+ shift
+ continue;;
+ -s)
+ shift
+ SW=$1
+ shift
+ continue;;
+ -v)
+ VERBOSE=1
+ shift
+ continue;;
+ -V)
+ VERBOSE=2
+ shift
+ continue;;
+ -x)
+ shift
+ X=$1
+ shift
+ continue;;
+ -y)
+ shift
+ Y=$1
+ shift
+ continue;;
+ *)
+ shift
+ continue;;
+ esac
+done
+
+X2=`echo "$X + 10" | bc`
+Y2=`echo "$Y + 10" | bc`
+X3=`echo "$X + 20" | bc`
+Y3=$Y
+X4=`echo "$X + 10" | bc`
+Y4=`echo "$Y - 10" | bc`
+
+B1=`echo "$X - 100" | bc`
+B2=`echo "$X + 99" | bc`
+B3=`echo "$Y - 100" | bc`
+B4=`echo "$Y + 99" | bc`
+if [ x"$B" = x ]; then
+ B="[$B1:$B2,$B3:$B4,3]"
+fi
+
+echo "OPROG="${OPROG} "OFILE="${OFILE}${B} X=${X} Y=${Y}
+echo "NPROG="${NPROG} "NFILE="${NFILE}${B} X=${X} Y=${Y}
+
+IFS=" "
+while read ARG1 ARG2 ARG3; do
+ if [ x"$ARG1" = x ]; then
+ continue
+ fi
+ if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
+ continue
+ fi
+ CMD=$ARG1
+ eval "ARG2=\"${C}$ARG2\""
+ eval "ARG3=\"${C}$ARG3\""
+ if [ x$CMD = xZIEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ continue
+ else
+ CMD=EXACT
+ fi
+ fi
+ if [ x$CMD = xZEXACT ]; then
+ if [ x$FILTER_PAINT = xtrue ]; then
+ CMD=SUM
+ else
+ CMD=EXACT
+ fi
+ fi
+ case $CMD in
+ OPROG)
+ OPROG=$ARG2
+ ;;
+ NPROG)
+ NPROG=$ARG2
+ ;;
+ FILE)
+ FILE=$ARG2
+ ;;
+ EXCLUDE)
+ FIELD=`$OPROG ${OFILE}${B} "field" | awk "$SAWK" | awk "$FAWK"`
+ echo "FIELD: $FIELD"
+ echo " "
+ M="-"
+ ;;
+ EXIT)
+ exit
+ ;;
+ EXACT)
+ if [ x"$DO1" = xYES ]; then
+ echo "${M}DO1: $ARG3"
+ ($NPROG ${SW} ${NFILE}${B} "${M}$ARG3") >funcnts2.out 2>&1
+ else
+ echo "${M}EXACT: $ARG2 ... $ARG3"
+ ($OPROG ${SW} ${OFILE}${B} "$ARG2" | awk $EAWK) >funcnts1.out 2>err.log
+ if test $? -ne 0; then
+ echo "skipping $NPROG due to error"
+ else
+ (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3" | awk $EAWK) >funcnts2.out 2>&1
+ if [ x$M = x ]; then
+ diff funcnts1.out funcnts2.out
+ else
+ V1=`cat funcnts1.out | awk $FAWK`
+ V2=`cat funcnts2.out | awk $FAWK`
+ V2=`echo "$FIELD-$V2" | bc`
+ if [ $V1 != $V2 ]; then
+ echo "V1=$V1 V2=$V2"
+ fi
+ fi
+ fi
+ fi
+ echo " "
+ ;;
+ REV)
+ if [ x"$DO1" = xYES ]; then
+ echo "${M}DO1: $ARG3"
+ (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3") >funcnts2.out 2>&1
+ else
+ echo "${M}REV: $ARG2 ... $ARG3"
+ ($OPROG ${SW} ${OFILE}${B} "$ARG2" | awk $EAWK) >tfuncnts1.out 2>err.log
+ if test $? -ne 0; then
+ echo "skipping $NPROG due to error"
+ else
+ (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3" | awk $EAWK) >tfuncnts2.out 2>&1
+ if [ x$M = x ]; then
+ awk 'NF==3{print $0}' < tfuncnts1.out | sort -r | awk '{print $2,$3}' > funcnts1.out
+ awk 'NF==3{print $2,$3}' < tfuncnts2.out >funcnts2.out 2>&1
+ diff funcnts1.out funcnts2.out
+ else
+ V1=`cat funcnts1.out | awk $FAWK`
+ V2=`cat funcnts2.out | awk $FAWK`
+ V2=`echo "$FIELD-$V2" | bc`
+ if [ $V1 != $V2 ]; then
+ echo "V1=$V1 V2=$V2"
+ fi
+ fi
+ fi
+ fi
+ echo " "
+ ;;
+ SUM)
+ if [ x"$DO1" = xYES ]; then
+ echo "${M}DO1: $ARG3"
+ (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3") >funcnts2.out 2>&1
+ else
+ echo "${M}SUM: $ARG2 ... $ARG3"
+ ($OPROG ${SW} ${OFILE}${B} "$ARG2" | awk $SAWK) >funcnts1.out 2>err.log
+ if test $? -ne 0; then
+ echo "skipping $NPROG due to error"
+ else
+ (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3" | awk $SAWK) >funcnts2.out 2>&1
+ if [ x$M = x ]; then
+ diff funcnts1.out funcnts2.out
+ else
+ V1=`cat funcnts1.out | awk $FAWK`
+ V2=`cat funcnts2.out | awk $FAWK`
+ V2=`echo "$FIELD-$V2" | bc`
+ if [ $V1 != $V2 ]; then
+ echo "V1=$V1 V2=$V2"
+ fi
+ fi
+ fi
+ fi
+ echo " "
+ ;;
+ *)
+ echo "ERROR: unknown command: $CMD"
+ exit 1
+ ;;
+ esac
+ if [ $VERBOSE = 1 ]; then
+ echo "***** funcnts1.out *****"
+ cat funcnts1.out
+ fi
+ if [ $VERBOSE = 2 ]; then
+ echo "***** funcnts1.out *****"
+ cat funcnts1.out
+ echo "***** funcnts2.out *****"
+ cat funcnts2.out
+ fi
+ rm -f err.log
+done
+
+rm -f funcnts1.out funcnts2.out tfuncnts1.out tfuncnts2.out
+
diff --git a/funtools/funtest/tmerge.in b/funtools/funtest/tmerge.in
new file mode 100644
index 0000000..11eb989
--- /dev/null
+++ b/funtools/funtest/tmerge.in
@@ -0,0 +1,16 @@
+#CMD FLAGS FILES1 FILES2
+#--- ---------- ------ ------
+EXACT -I $FILES $FILES
+EXACT -w $FILES $FILES
+EXACT -x $FILES $FILES
+EXACT -f foo $FILES $FILES
+EXACT -f foo -w $FILES $FILES
+EXACT -f foo -x $FILES $FILES
+
+EXACT -I $FILES $LIST
+EXACT -w $FILES $LIST
+EXACT -x $FILES $LIST
+EXACT -f foo $FILES $LIST
+EXACT -f foo -w $FILES $LIST
+EXACT -f foo -x $FILES $LIST
+
diff --git a/funtools/funtest/tnum.in b/funtools/funtest/tnum.in
new file mode 100644
index 0000000..f3fa3c6
--- /dev/null
+++ b/funtools/funtest/tnum.in
@@ -0,0 +1,9 @@
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==017)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0xf)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0b1111)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&017)==017)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0xf)==0xf)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0b1111)==0b1111)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=017)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0xf)
+EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0b1111)
diff --git a/funtools/funtest/tparen.in b/funtools/funtest/tparen.in
new file mode 100644
index 0000000..514edb0
--- /dev/null
+++ b/funtools/funtest/tparen.in
@@ -0,0 +1,50 @@
+#OPROG fundisp
+#NPROG ../fundisp
+#OFILE ./test.ev
+#NFILE ./test.ev
+
+#CMD Old Filter New Filter
+#--- ----------------- ---------------------
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
+
+EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
+
+EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
+
+EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
+
+EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
+
+EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
+
+EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
+
+EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
+
+EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
+
+EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2),cir($X2,$Y2,5),-cir($X2,$Y2,2)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),cir($X2,$Y2,5),-cir($X2,$Y2,2)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
+
+EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
+
+EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
+
+EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2),cir($X2,$Y2,5),-cir($X2,$Y2,2)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),cir($X2,$Y2,5),-cir($X2,$Y2,2)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
+
+EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
+
+EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
+
+EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
diff --git a/funtools/funtest/tregions.in b/funtools/funtest/tregions.in
new file mode 100644
index 0000000..56520f0
--- /dev/null
+++ b/funtools/funtest/tregions.in
@@ -0,0 +1,67 @@
+#OPROG funcnts
+#NPROG ../funcnts
+#OFILE /home/eric/data/snr.ev
+#NFILE /home/eric/data/snr.ev
+
+#CMD Old Region New region
+#--- ----------------- ---------------------
+EXACT cir $X $Y .1 cir $X $Y .1
+EXACT ann $X $Y 0 5 10 15 20 (ann $X $Y 0 5 10 15 20)
+EXACT ann $X $Y 0 5 10 15 20 (ann $X $Y 0 20 n=4 # color=red\\n)
+EXACT cir $X $Y 20 cir $X $Y 20
+EXACT box $X $Y 10 20 box $X $Y 10 20 # color=red\\n
+EXACT box $X $Y 10 20 45 box $X $Y 10 20 45 # color=red\\n
+EXACT box $X $Y 10 20 115 box $X $Y 10 20 115 # color=red\\n
+EXACT ell $X $Y 10 20 (ell $X $Y 10 20)
+EXACT ell $X $Y 10 20 20 40 40 60 (ell $X $Y 10 20 20 40 40 60 # color=red\\n)
+EXACT ell $X $Y 10 20 45 (ell $X $Y 10 20 45)
+EXACT ell $X $Y 10 20 115 (ell $X $Y 10 20 115)
+EXACT lin $X $Y $X2 $Y2 lin $X2 $Y2 $X $Y
+REV poi $X $Y $X2 $Y2 (poi $X2 $Y2 $X $Y)
+ZIEXACT -cir $X $Y 20 (-cir $X $Y 20)
+EXACT box $X $Y 5 10,box $X $Y 10 20 box $X $Y 0 0 10 20 n=2 # color=red\\n
+EXACT ell $X $Y 5 10,ell $X $Y 10 20 (ell $X $Y 0 0 10 20 n=2)
+EXACT box $X $Y 5 10,box $X $Y 7 12 (box $X $Y 0 0 5 10 7 12 # color=red\\n)
+EXACT ell $X $Y 5 10,ell $X $Y 7 12 ell $X $Y 0 0 5 10 7 12
+EXACT ell $X $Y 5 10,ell $X $Y 10 20,ell $X $Y 20 40 ell $X $Y 0 0 5 10 10 20 20 40 # color=red\\n
+EXACT ell $X $Y 7 12,-ell $X $Y 5 10 (ell $X $Y 5 10 7 12)
+EXACT box $X $Y 7 12,-box $X $Y 5 10 (box $X $Y 5 10 7 12 # color=red\\n)
+ZEXACT ell $X $Y 10 20 20 40 40 60 ell $X $Y 20 40, ell $X $Y 40 60, -ell $X $Y 10 20 # color=red\\n
+
+EXACT cir $X $Y 20 ell $X $Y 20 20
+EXACT cir $X $Y 20 ann $X $Y 0 20 # color=red\\n
+EXACT cir $X $Y 20 (pan $X $Y 0 360 1 0 20 1)
+ZEXACT pan $X $Y 0 360 1 0 20 4 cir $X $Y 5, cir $X $Y 10, cir $X $Y 15, cir $X $Y 20 # color=red\\n
+EXACT pan $X $Y 0 360 1 0 20 4 cir $X $Y 0 5 10 15 20 # color=red\\n
+
+EXACT ann $X $Y 0 20 n=4 (ell $X $Y 0 0 20 20 n=4 # color=red\\n)
+EXACT ann $X $Y 0 5 10 15 20 ell $X $Y 0 0 20 20 n=4
+EXACT ann $X $Y 5 20 n=3 ell $X $Y 5 5 10 10 15 15 20 20 # color=red\\n
+EXACT ann $X $Y 0 20 n=4 (cir $X $Y 0 20 n=4)
+EXACT ann $X $Y 0 20 n=4 (cir $X $Y 0 5 10 15 20 # color=red\\n)
+EXACT ann $X $Y 0 20 n=4 pan $X $Y 0 360 1 0 20 4
+
+SUM cir $X $Y 20 cir $X $Y 0 20 n=10
+SUM cir $X $Y 20 cir $X $Y 0 5 10 20 # color=red\\n
+SUM cir $X $Y 20 (ell $X $Y 0 0 10 10 15 15 20 20 # color=red\\n)
+SUM cir $X $Y 20 (ell $X $Y 0 0 20 20 n=10 # color=red\\n)
+SUM cir $X $Y 20 (ann $X $Y 0 5 10 15 20 # color=red\\n)
+SUM cir $X $Y 20 (ann $X $Y 0 20 n=10 # color=red\\n)
+
+SUM ell $X $Y 10 20 (ell $X $Y 0 0 10 20 n=4 # color=red\\n)
+SUM ell $X $Y 10 20 (ell $X $Y 0 0 5 10 7 15 10 20 # color=red\\n)
+SUM box $X $Y 10 20 (box $X $Y 0 0 10 20 n=4 # color=red\\n)
+SUM box $X $Y 10 20 (box $X $Y 0 0 5 10 7 15 10 20 # color=red\\n)
+
+SUM ell $X $Y 20 10 (epa $X $Y 0 360 4 0 0 20 10 4 # color=red\\n)
+SUM box $X $Y 20 10 (bpa $X $Y 0 360 4 0 0 20 10 4 # color=red\\n)
+SUM cir $X $Y 20 (cpa $X $Y 0 360 4 0 20 4 # color=red\\n)
+
+EXACT pie $X $Y 0 5 10 15 20 pie $X $Y 0 5 10 15 20
+EXACT pie $X $Y 0 5 10 15 20 pie $X $Y 0 20 n=4 # color=red\\n
+EXACT pie $X $Y 0 5 10 15 20 pie $X $Y 0 5, pie $X $Y 5 10, pie $X $Y 10 15, pie $X $Y 15 20
+EXACT pan $X $Y 35 80 3 0 20 4 pan $X $Y 35 80 3 0 20 4 # color=red\\n
+EXACT cir $X $Y 20, -pie $X $Y 0 90 (cir $X $Y 20,-panda $X $Y 0 90 5 0 20 5)
+EXACT cir $X $Y 20, -pie $X $Y 0 90,-pie $X $Y 180 270 cir $X $Y 20,-panda $X $Y 0 90 1 0 20 1,-panda $X $Y 180 270 1 0 20 1 # color=red\\n
+
+# EXACT pol $X $Y $X2 $Y2 $X3 $Y3 $X4 $Y4 (pol $X3 $Y3 $X4 $Y4 $X $Y $X2 $Y2 # color=red\\n)
diff --git a/funtools/funtest/tsections.in b/funtools/funtest/tsections.in
new file mode 100644
index 0000000..71f0665
--- /dev/null
+++ b/funtools/funtest/tsections.in
@@ -0,0 +1,11 @@
+#OPROG fundisp
+#NPROG ../funimage
+#OFILE ./test.ev
+#NFILE ./test.ev
+
+#CMD Old Filter New Filter
+#--- ----------------- ---------------------
+EXACT 509:515,509:515 509:515,509:515
+EXACT 6@512,6@512 6@512,6@512
+EXACT 509:515,509:515 6@512,6@512
+EXACT 6@512,6@512 509:515,509:515
diff --git a/funtools/funtest/ttext.in b/funtools/funtest/ttext.in
new file mode 100644
index 0000000..7bb7648
--- /dev/null
+++ b/funtools/funtest/ttext.in
@@ -0,0 +1,91 @@
+#CMD File Spec 1 File Spec 2
+#--- ----------------- ---------------------
+EXACT blank.txt blank2.txt
+EXACT crtab.txt nltab.txt
+EXACT crcomma.txt nlcomma.txt
+EXACT int64.fits[1] int64.tab
+EXACT int64.fits[Value=-9223372036854775806:9223372036854775805] int64.tab[Value=-9223372036854775806:9223372036854775805]
+EXACT test.fits tab.txt
+EXACT test.fits[1] tab.txt[1]
+EXACT test.fits[2] tab.txt[2]
+EXACT test.fits bar.txt
+EXACT test.fits[1] bar.txt[1]
+EXACT test.fits[2] bar.txt[2]
+EXACT test.fits comma.txt
+EXACT test.fits comma3.txt
+EXACT test.fits[1] comma.txt[1]
+EXACT test.fits[1] comma3.txt[1]
+EXACT test.fits[2] comma.txt[2]
+EXACT test.fits rdb.txt
+EXACT test.fits[1] rdb.txt[1]
+EXACT test.fits[2] rdb.txt[2]
+
+EXACT test.fits eot.txt[TEXT(eot=EOT)]
+EXACT test.fits[2] eot.txt[2,TEXT(eot=EOT)]
+EXACT test.fits[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
+EXACT test.fits[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
+
+EXACT tab.txt bar.txt
+EXACT tab.txt comma.txt
+EXACT tab.txt rdb.txt
+EXACT tab.txt space.txt
+
+EXACT space.txt sptab.txt
+EXACT tab.txt sptab.txt
+EXACT comma.txt sptab.txt
+EXACT rdb.txt sptab.txt
+
+EXACT bar.txt comma.txt
+EXACT bar.txt rdb.txt
+EXACT bar.txt space.txt
+EXACT comma.txt rdb.txt
+EXACT comma.txt space.txt
+EXACT rdb.txt space.txt
+
+EXACT tab.txt bar.txt[1]
+EXACT tab.txt comma.txt[1]
+EXACT tab.txt rdb.txt[1]
+EXACT tab.txt space.txt[1]
+EXACT bar.txt comma.txt[1]
+EXACT bar.txt rdb.txt[1]
+EXACT bar.txt space.txt[1]
+EXACT comma.txt rdb.txt[1]
+EXACT comma.txt space.txt[1]
+EXACT rdb.txt space.txt[1]
+
+EXACT tab.txt[2] bar.txt[2]
+EXACT tab.txt[2] comma.txt[2]
+EXACT tab.txt[2] rdb.txt[2]
+EXACT tab.txt[2] space.txt[2]
+EXACT bar.txt[2] comma.txt[2]
+EXACT bar.txt[2] rdb.txt[2]
+EXACT bar.txt[2] space.txt[2]
+EXACT comma.txt[2] rdb.txt[2]
+EXACT comma.txt[2] space.txt[2]
+EXACT rdb.txt[2] space.txt[2]
+
+EXACT tab.txt eot.txt[TEXT(eot=EOT)]
+EXACT bar.txt eot.txt[TEXT(eot=EOT)]
+EXACT comma.txt eot.txt[TEXT(eot=EOT)]
+EXACT rdb.txt eot.txt[TEXT(eot=EOT)]
+EXACT space.txt eot.txt[TEXT(eot=EOT)]
+
+EXACT tab.txt[2] eot.txt[2,TEXT(eot=EOT)]
+EXACT bar.txt[2] eot.txt[2,TEXT(eot=EOT)]
+EXACT comma.txt[2] eot.txt[2,TEXT(eot=EOT)]
+EXACT rdb.txt[2] eot.txt[2,TEXT(eot=EOT)]
+EXACT space.txt[2] eot.txt[2,TEXT(eot=EOT)]
+
+EXACT tab.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
+EXACT bar.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
+EXACT comma.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
+EXACT rdb.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
+EXACT space.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
+
+EXACT tab.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
+EXACT bar.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
+EXACT comma.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
+EXACT rdb.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
+EXACT space.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
+
+EXACT headone.txt one.txt
diff --git a/funtools/funtest/tview.in b/funtools/funtest/tview.in
new file mode 100644
index 0000000..b9b7976
--- /dev/null
+++ b/funtools/funtest/tview.in
@@ -0,0 +1,11 @@
+#CMD File Spec 1 File Spec 2
+#--- ----------- ---------------------
+EXACT v:x3 -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT v:snr.ev -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT v:snr.ev'[4]' -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT v:snr.ev'[cir(400,400,3)]' -f "I=%4d" $HOME/data/snr.ev'[cir(400,400,3)]' "x y pi pha"
+EXACT v::xf,xc,xr:tview.fits -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT -f "I=%4d" v:x2 -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT v::xf:tview.fit -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT v::xf:tview.fit'[4]' -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
+EXACT v:-xf:tview.fit'[cir(512,512,.1)]' -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]'
diff --git a/funtools/funtest/twcs.c b/funtools/funtest/twcs.c
new file mode 100644
index 0000000..2da9319
--- /dev/null
+++ b/funtools/funtest/twcs.c
@@ -0,0 +1,61 @@
+/*
+ *
+ * twcs.c -- example using WCS Library
+ *
+ */
+
+#include <funtools.h>
+
+int main(int argc, char **argv)
+{
+ int i;
+ Fun fun;
+ struct WorldCoor *wcs; /* WCS info */
+ double x,y,ra,dec,xr,yr;
+
+ if(argc == 1){
+ fprintf(stderr, "usage: twcs iname\n");
+ exit(1);
+ }
+
+ /* open Funtools file */
+ /* Funopen makes initial WCS library call: wcs = wcsinit(header_string) */
+ if( !(fun = FunOpen(argv[1], "r ", NULL)) ){
+ fprintf(stderr, "ERROR can't open file: %s\n", argv[1]);
+ exit(1);
+ }
+
+ /* get wcs structure */
+ FunInfoGet(fun,FUN_WCS,&wcs,0);
+ if( !wcs || !iswcs(wcs) ){
+ fprintf(stderr,"No WCS data");
+ return(1);
+ }
+
+ /* read input, convert pixels to wcs and back */
+ while(1){
+ fprintf(stdout,"\nInput x y: ");
+ if(scanf("%lf %lf", &x, &y) != EOF){
+ if(x <= -999)
+ break;
+ /* convert image pixels to sky coords */
+ pix2wcs(wcs, x, y, &ra, &dec);
+ fprintf(stdout,"Convert from pixels to ra,dec using pix2wcs()\n");
+ fprintf(stdout, "x=%.10g y=%.10g -> ra=%.10g dec=%.10g\n",
+ x, y, ra, dec);
+ /* convert sky coords to image pixels */
+ fprintf(stdout,"Convert from ra,dec -> pixels using wcs2pix()\n");
+ wcs2pix(wcs, ra, dec, &xr, &yr, &i);
+ fprintf(stdout, "ra=%.10g dec=%.10g -> x=%.10g y=%.10g offscale=%d\n",
+ ra, dec, xr, yr, i);
+ }
+ else
+ break;
+ }
+
+ /* clean up */
+ /* FunClose makes final WCS library call: wcsfree(wcs) */
+ FunClose(fun);
+ return(0);
+}
+
diff --git a/funtools/funtest/unwcs.in b/funtools/funtest/unwcs.in
new file mode 100644
index 0000000..f8cc6e3
--- /dev/null
+++ b/funtools/funtest/unwcs.in
@@ -0,0 +1,12 @@
+local
+double dval1, dval2;
+FITSHead wcs;
+int offscl;
+int init=0;
+end
+
+if( !init++ ) FunInfoGet(fun, FUN_WCS, &wcs, 0);
+wcs2pix(wcs, (double)cur->ra, (double)cur->dec, &dval1, &dval2, &offscl);
+cur->nx:J:1:1024 = (int)(dval1+0.5);
+cur->ny:J:1:1024 = (int)(dval2+0.5);
+
diff --git a/funtools/funtest/wcs.in b/funtools/funtest/wcs.in
new file mode 100644
index 0000000..4464246
--- /dev/null
+++ b/funtools/funtest/wcs.in
@@ -0,0 +1,12 @@
+/* ./funcalc -f wcs.in $S foo.fits */
+local
+double dval1, dval2;
+void *wcs;
+int init=0;
+end
+
+if( !init++ ) FunInfoGet(fun, FUN_WCS, &wcs, 0);
+pix2wcs(wcs, (double)cur->x, (double)cur->y, &dval1, &dval2);
+cur->RA:D = dval1;
+cur->Dec:D = dval2;
+
diff --git a/funtools/funtest/wtest.c b/funtools/funtest/wtest.c
new file mode 100644
index 0000000..500d6fc
--- /dev/null
+++ b/funtools/funtest/wtest.c
@@ -0,0 +1,123 @@
+#include <funtools.h>
+#include <stdlib.h>
+#include <file.h>
+
+extern char *optarg;
+extern int optind;
+
+#define DIM1 5
+#define DIM2 8
+
+#ifdef ANSI_FUNC
+int
+main (int argc, char **argv)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ int c;
+ int i;
+ int args;
+ int doext=0;
+ int doover=0;
+ int dim1=DIM1;
+ int dim2=DIM2;
+ int bitpix1=32;
+ int bitpix2=-32;
+ int buf1[DIM1*DIM2];
+ float buf2[DIM1*DIM2];
+ char *oname;
+ Fun ofun=NULL;
+
+ /* fill in data buffers */
+ for(i=0; i<DIM1*DIM2; i++){
+ buf1[i] = i;
+ buf2[i] = (float)(DIM1*DIM2)-(float)i;
+ }
+
+ /* exit on gio errors */
+ setgerror(2);
+
+ /* we want the args in the same order in which they arrived, and
+ gnu getopt sometimes changes things without this */
+ putenv("POSIXLY_CORRECT=true");
+
+ /* process switch arguments */
+ while ((c = getopt(argc, argv, "eo")) != -1){
+ switch(c){
+ case 'e':
+ doext=1;
+ break;
+ case 'o':
+ doover=1;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* check for required arguments */
+ args = argc - optind;
+ if( args < 1 )
+ gerror(stderr, "usage: %s fname\n", argv[0]);
+ oname = argv[optind++];
+
+ /* open the output FITS file */
+ if( oname ){
+ if( !(ofun = FunOpen(oname, "w", NULL)) )
+ gerror(stderr, "could not FunOpen output file: %s\n", argv[optind-1]);
+ }
+
+ /* write params, if necessary */
+ FunParamPuts(ofun, "", 0, "this is a comment", "Blank Keyword", 0);
+ FunParamPuts(ofun, " ", 0, "a 2nd comment", "Blank Keyword", 0);
+ FunParamPuts(ofun, "BPAR", 0, "", "Blank Param", 0);
+ FunParamPuts(ofun, "BPAR", 1, NULL, "Blank Param", 0);
+ FunParamPuti(ofun, "IPAR", 0, -100, "INTEGER Param", 0);
+ FunParamPuti(ofun, "IPAR", 1, -101, "INTEGER Param", 0);
+ FunParamPutd(ofun, "DPAR", 0, 123456789.9876, 12, "DOUBLE Param", 0);
+ FunParamPutd(ofun, "DPAR", 1, 123456.780, 4, "DOUBLE Param", 0);
+ FunParamPuts(ofun, "SPAR", 0, argv[0],
+ "long comment string that will test column alignment", 0);
+ FunParamPuts(ofun, "SPAR", 1, argv[1], "STRING Param", 0);
+
+ /* write the primary output image */
+ if( !FunImagePut(ofun, buf1, dim1, dim2, bitpix1, NULL) ){
+ gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
+ }
+ if( doover ){
+ FunParamPuti(ofun, "IPAR", 1, 101, "OVERWRITTEN INT Param", 0);
+ FunParamPuts(ofun, "SPAR", 1, argv[0], "OVERWRITTEN STR Param", 0);
+ }
+
+ /* we have to finish the first image if we want to write a second one */
+ FunFlush(ofun, NULL);
+
+ /* write the image extension */
+ if( doext ){
+ FunParamPuts(ofun, "", 0, "this is a comment", "Blank Keyword", 0);
+ FunParamPuts(ofun, " ", 0, "a 2nd comment", "Blank Keyword", 0);
+ FunParamPuts(ofun, "XBPAR", 0, "", "Blank Param", 0);
+ FunParamPuts(ofun, "XBPAR", 1, NULL, "Blank Param", 0);
+ FunParamPuti(ofun, "XIPAR", 0, 100, "INTEGER Param", 0);
+ FunParamPuti(ofun, "XIPAR", 1, 101, "INTEGER Param", 0);
+ FunParamPutd(ofun, "XDPAR", 0, -123456789.9876, 12, "DOUBLE Param", 0);
+ FunParamPutd(ofun, "XDPAR", 1, -123456.780, 4, "DOUBLE Param", 0);
+ FunParamPuts(ofun, "XSPAR", 0, argv[0],
+ "long comment string that will test column alignment", 0);
+ FunParamPuts(ofun, "XSPAR", 1, argv[1], "STRING Param", 0);
+ if( !FunImagePut(ofun, buf2, dim1, dim2, bitpix2, NULL) ){
+ gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
+ }
+ if( doover ){
+ FunParamPuti(ofun, "XIPAR", 1, -101, "OVERWRITTEN EXT INT Param", 0);
+ /* NB: this param does not exist in this header and should be ignored */
+ FunParamPuts(ofun, "SPAR", 1, argv[0], "OVERWRITTEN EXT STR Param", 0);
+ }
+ }
+
+ if( ofun ) FunClose(ofun);
+ return(0);
+}
diff --git a/funtools/funtest/x.fits b/funtools/funtest/x.fits
new file mode 100644
index 0000000..051b435
--- /dev/null
+++ b/funtools/funtest/x.fits
@@ -0,0 +1 @@
+SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 4 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.120000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.129999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END øì