Index: /trunk/Ohana/src/addstar/Makefile
===================================================================
--- /trunk/Ohana/src/addstar/Makefile	(revision 3401)
+++ /trunk/Ohana/src/addstar/Makefile	(revision 3402)
@@ -1,4 +1,2 @@
-#install:
-#	@echo "addstar under re-construction"
 default: addstar
 help:
@@ -31,4 +29,5 @@
 $(SRC)/ConfigInit.$(ARCH).o \
 $(SRC)/conversions.$(ARCH).o \
+$(SRC)/dump.$(ARCH).o \
 $(SRC)/edge_check.$(ARCH).o \
 $(SRC)/find_matches.$(ARCH).o \
@@ -112,5 +111,5 @@
 # utilities #################################################
 
-# install:
+install:
 	for i in $(INSTALL); do make $$i.install; done
 
Index: /trunk/Ohana/src/addstar/include/addstar.h
===================================================================
--- /trunk/Ohana/src/addstar/include/addstar.h	(revision 3401)
+++ /trunk/Ohana/src/addstar/include/addstar.h	(revision 3402)
@@ -87,4 +87,5 @@
 
 int MODE;
+char *DUMP;
 
 time_t TIMEREF;
Index: /trunk/Ohana/src/addstar/src/addstar.c
===================================================================
--- /trunk/Ohana/src/addstar/src/addstar.c	(revision 3401)
+++ /trunk/Ohana/src/addstar/src/addstar.c	(revision 3402)
@@ -24,4 +24,5 @@
   case M_IMAGE:
     stars = gstars (argv[1], &Nstars, &image);
+    if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
     regions = gregion_image (&image, &Nregions);
     overlap = gimages (&image, &Noverlap);
Index: /trunk/Ohana/src/addstar/src/args.c
===================================================================
--- /trunk/Ohana/src/addstar/src/args.c	(revision 3401)
+++ /trunk/Ohana/src/addstar/src/args.c	(revision 3402)
@@ -149,4 +149,10 @@
     remove_argument (N, &argc, argv);
   }
+  DUMP = NULL;
+  if ((N = get_argument (argc, argv, "-dump"))) {
+    remove_argument (N, &argc, argv);
+    DUMP = strcreate(argv[N]);
+    remove_argument (N, &argc, argv);
+  }
 
   if (argc != 2) {
Index: /trunk/Ohana/src/addstar/src/gstars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/gstars.c	(revision 3401)
+++ /trunk/Ohana/src/addstar/src/gstars.c	(revision 3402)
@@ -44,6 +44,4 @@
     exit (1);
   }
-  while (image[0].coords.crval1 < 0) image[0].coords.crval1 += 360.0;
-  while (image[0].coords.crval1 > 360.0) image[0].coords.crval1 -= 360.0;
   itmp = 0;
   fits_scan (&header, "NASTRO",   "%d", 1, &itmp);
@@ -58,5 +56,9 @@
     }
     RegisterMosaic (MOSAIC);
-  }    
+  } else {
+    /* force image to lie in 0-360 range */
+    while (image[0].coords.crval1 < 0) image[0].coords.crval1 += 360.0;
+    while (image[0].coords.crval1 > 360.0) image[0].coords.crval1 -= 360.0;
+  }
     
   /* get ST (used for airmass calculation) */
Index: /trunk/Ohana/src/libohana/include/loneos.h
===================================================================
--- /trunk/Ohana/src/libohana/include/loneos.h	(revision 3401)
+++ /trunk/Ohana/src/libohana/include/loneos.h	(revision 3402)
@@ -413,4 +413,8 @@
 void RegisterMosaic (Coords *coords);
 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
+int FindMosaicForImage (Image *images, int Nimages, int entry);
+int FindMosaicForImage_TableSearch (Image *images, int Nimages, int entry);
+int FindMosaicForImage_MatchSearch (Image *images, int Nimages, int entry);
+int BuildChipMatch (Image *images, int Nimages);
 
 int FindMosaicForImage (Image *images, int Nimages, int entry);
Index: /trunk/Ohana/src/libohana/src/mosaic_astrom.c
===================================================================
--- /trunk/Ohana/src/libohana/src/mosaic_astrom.c	(revision 3401)
+++ /trunk/Ohana/src/libohana/src/mosaic_astrom.c	(revision 3402)
@@ -117,5 +117,5 @@
 
   got_match:
-    ChipMatch[i] = j;
+    continue;
   }
   return (TRUE);
Index: /trunk/Ohana/src/opihi/dvo/ImageOps.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/ImageOps.c	(revision 3401)
+++ /trunk/Ohana/src/opihi/dvo/ImageOps.c	(revision 3402)
@@ -44,5 +44,4 @@
 	while (flipped && (r > Rmid)) r-= 360.0;
 	status = RD_to_XY (&X, &Y, r, d, &graph[0].coords);
-
 	if (!status) continue;
 	if (X < graph[0].xmin) continue;
@@ -50,16 +49,18 @@
 	if (Y < graph[0].ymin) continue;
 	if (Y > graph[0].ymax) continue;
-	subset[n] = i;
-	n++;
-	if (n > npts - 1) {
-	  npts += 200;
-	  REALLOCATE (subset, int, npts);
-	}
-	break;
+	goto in_region;
+	/** we miss any images which surround the region.  we are also
+	    missing the DIS images for which the corners don't touch
+	    the region, but which are needed for WRP images with
+	    corners touching the region **/
       }
-      /** we miss any images which surround the region.  we are also
-	  missing the DIS images for which the corners don't touch
-	  the region, but which are needed for WRP images with
-	  corners touching the region **/
+      continue;
+    }
+  in_region:
+    subset[n] = i;
+    n++;
+    if (n > npts - 1) {
+      npts += 200;
+      REALLOCATE (subset, int, npts);
     }
   }
Index: /trunk/Ohana/src/opihi/dvo/LoadImages.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/LoadImages.c	(revision 3401)
+++ /trunk/Ohana/src/opihi/dvo/LoadImages.c	(revision 3402)
@@ -1,8 +1,8 @@
 # include "dvo.h"
 
-Image *LoadImages (int *Nimage) {
+Image *LoadImages (int *nimage) {
 
   char filename[256];
-  int nimage, NIMAGE;
+  int Nimage, NIMAGE;
   FILE *f;
   Header header;
@@ -11,4 +11,5 @@
   VarConfig ("IMAGE_CATALOG", "%s", filename);
 
+  *nimage = 0;
   NIMAGE = 0;
   Nimage = 0;
@@ -37,11 +38,11 @@
   ALLOCATE (image, Image, NIMAGE);
   fseek (f, header.size, SEEK_SET); 
-  nimage = Fread (image, sizeof(Image), NIMAGE, f, "image");
-  if (nimage != NIMAGE) {
-    fprintf (stderr, "failed to read in all images (%d of %d)\n", nimage, NIMAGE);
+  Nimage = Fread (image, sizeof(Image), NIMAGE, f, "image");
+  if (Nimage != NIMAGE) {
+    fprintf (stderr, "failed to read in all images (%d of %d)\n", Nimage, NIMAGE);
   }
 
   fclose (f);
-  *Nimage = nimage;
+  *nimage = Nimage;
   return (image);
 }
Index: /trunk/Ohana/src/opihi/dvo/images.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/images.c	(revision 3401)
+++ /trunk/Ohana/src/opihi/dvo/images.c	(revision 3402)
@@ -86,8 +86,16 @@
 
     /* project this image to screen display coords */
-    x[0] = 0;           y[0] = 0;
-    x[1] = image[i].NX; y[1] = 0;
-    x[2] = image[i].NX; y[2] = image[i].NY;
-    x[3] = 0;           y[3] = image[i].NY;
+    /* DIS images represent a field, not a chip */
+    if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
+      x[0] = -0.5*image[i].NX; y[0] = -0.5*image[i].NY;
+      x[1] = +0.5*image[i].NX; y[1] = -0.5*image[i].NY;
+      x[2] = +0.5*image[i].NX; y[2] = +0.5*image[i].NY;
+      x[3] = -0.5*image[i].NX; y[3] = +0.5*image[i].NY;
+    } else {
+      x[0] = 0;           y[0] = 0;
+      x[1] = image[i].NX; y[1] = 0;
+      x[2] = image[i].NX; y[2] = image[i].NY;
+      x[3] = 0;           y[3] = image[i].NY;
+    }
     status = FALSE;
 
