Index: trunk/Ohana/src/opihi/dvo/catalog.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/catalog.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/catalog.c	(revision 5448)
@@ -9,4 +9,5 @@
 # define MISSCALE 2
 
+// XXX EAM : should this function be dropped? 
 int catlog (int argc, char **argv) {
   
Index: trunk/Ohana/src/opihi/dvo/dmt.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/dmt.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/dmt.c	(revision 5448)
@@ -4,5 +4,5 @@
 int dmt (int argc, char **argv) {
   
-  int i, m, k, N, Nregions, Ngraph, SaveVectors;
+  int i, m, k, N, Ngraph, SaveVectors;
   int Ns, Nsec, NPTS;
   char catdir[256], filename[256];
@@ -13,5 +13,6 @@
   Catalog catalog;
   Graphdata graphmode, graphsky;
-  RegionFile *regions;
+  SkyTable *sky;
+  SkyList *skylist;
   Vector Xvec, Yvec, Zvec, Rvec, Dvec;
   Vector *vec1, *vec2, *vec3, *vec4, *vec5;
@@ -53,6 +54,10 @@
   Ns = GetPhotcodeNsec (code[0].code);
 
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+
   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
-  regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, &Nregions);
+  skylist = SkyListByRadius (sky, -1, graphsky.coords.crval1, graphsky.coords.crval2, Radius);
   
   N = 0;
@@ -66,9 +71,8 @@
   }
 
-  for (k = 0; k < Nregions; k++) {
+  for (k = 0; k < skylist[0].Nregions; k++) {
 
-    sprintf (filename, "%s/%s", catdir, regions[k].name);
     /* lock, load, unlock catalog */
-    catalog.filename = filename;
+    catalog.filename = skylist[0].regions[k][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
     case 2:
Index: trunk/Ohana/src/opihi/dvo/extract.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/extract.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/extract.c	(revision 5448)
@@ -1,3 +1,4 @@
 # include "dvo1.h"
+// XXX EAM : this function is deprecated
 
 enum {ZERO, RA, DEC, MAG, dMAG, Xm, Xp, NMEAS, NMISS, REF, TYPE, NPHOT, NCODE, FLAG};
Index: trunk/Ohana/src/opihi/dvo/gcat.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/gcat.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/gcat.c	(revision 5448)
@@ -3,9 +3,9 @@
 int gcat (int argc, char **argv) {
   
-  int i, Nregions;
-  RegionFile *regions;
-  char filename[128];
+  int i;
   struct stat filestat;
   double Ra, Dec, Radius;
+  SkyTable *sky;
+  SkyList *skylist;
   char catdir[256];
 
@@ -17,4 +17,8 @@
   }
 
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+
   Ra = atof (argv[1]);
   Dec = atof (argv[2]);
@@ -24,9 +28,8 @@
     Radius = 0.0001;
 
-  regions = find_regions (Ra, Dec, Radius, &Nregions);
+  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
 
-  for (i = 0; i < Nregions; i++) {
-    sprintf (filename, "%s/%s", catdir, regions[i].name);
-    if (stat (filename, &filestat) != -1) {
+  for (i = 0; i < skylist[0].Nregions; i++) {
+    if (stat (skylist[0].regions[i][0].filename, &filestat) != -1) {
       fprintf (stderr, "%3d %s *\n", i, regions[i].name);
     } else {
@@ -37,6 +40,4 @@
 
   return (TRUE);
-  free (regions);
-
+  SkyListFree (regions);
 }
-
Index: trunk/Ohana/src/opihi/dvo/gstar.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/gstar.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/gstar.c	(revision 5448)
@@ -9,9 +9,10 @@
   double Mcat, Mrel;
   float *RA, *DEC;
-  int i, j, k, m, N, *N1, Nregions, Nsec, NPTS;
+  int i, j, k, m, N, *N1, Nsec, NPTS;
   int Nstars, found, GetMeasures, Nlo, Nhi;
   int SaveVectors;
   Vector *vec1, *vec2, *vec3, *vec4;
-  RegionFile *regions;
+  SkyTable *sky;
+  SkyList *skylist;
   Catalog catalog;
   PhotCode *code;
@@ -52,14 +53,15 @@
   while (Ra > 360.0) Ra -= 360.0;
   
-  regions = find_regions (Ra, Dec, Radius, &Nregions);
-
-  if (Nregions > 1) {
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
+
+  if (skylist[0].Nregions > 1) {
     fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
   }
 
-  /* set filename, read in header */
-  sprintf (filename, "%s/%s", catdir, regions[0].name);
   /* lock, load, unlock catalog */
-  catalog.filename = filename;
+  catalog.filename = skylist[0].regions[0][0].filename;
   switch (lock_catalog (&catalog, LCK_SOFT)) {
   case 2:
Index: trunk/Ohana/src/opihi/dvo/imdata.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/imdata.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/imdata.c	(revision 5448)
@@ -1,4 +1,3 @@
 # include "dvo1.h"
-void copy_region (GSCRegion *in, GSCRegion *out);
 
 int imdata (int argc, char **argv) {
@@ -13,5 +12,6 @@
   Image *image;
   Catalog catalog;
-  GSCRegion *region, *tregion;
+  SkyTable *sky;
+  SkyList *skylist, *skyset;
   Vector *vec;
 
@@ -80,27 +80,35 @@
   GetTimeFormat (&TimeReference, &TimeFormat);
 
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+
+  Nregions = 0;
+  NREGIONS = 10;
+  ALLOCATE (skylist, SkyList, 1);
+  ALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS);
+
   /* for each image of interest, find the appropriate region files */
-  Nregion = 0;
-  ALLOCATE (region, GSCRegion, 1);
   for (i = 0; i < Nsubset; i++) {
     I = subset[i];
+
     if (!FindMosaicForImage (image, Nimage, I)) continue;
-    tregion = get_regions (&image[I], &Ntregion);
-    REALLOCATE (region, GSCRegion, MAX (1, Nregion + Ntregion));
-    for (j = 0; j < Ntregion; j++) {
-      skip = FALSE;
-      for (k = 0; (k < Nregion) && !skip; k++) {
-	if (!strcmp (region[k].filename, tregion[j].filename)) skip = TRUE;
-      }
-      if (!skip) {
-	copy_region (&tregion[j], &region[Nregion]);
-	Nregion ++;
-      }
-    }
-    free (tregion);
+    skyset = SkyListByImage (table, -1, &image[I]);
+
+    for (j = 0; j < skyset[0].Nregions; j++) {
+      found = FALSE;
+      for (k = 0; (k < skylist[0].Nregion) && !found; k++) {
+	found = !strcmp (skylist[0].regions[k].name, skyset[0].regions[j].name);
+      }
+      if (found) continue;
+      skylist[0].regions[Nregions] = skyset[0].regions[j];
+      Nregions ++;
+      CHECK_REALLOCATE (skylist[0].regions, SkyRegions *, NREGIONS, Nregions, 10);
+    }
+    SkyListFree (skyset);
   }	
   free (subset);
-  for (i = 0; i < Nregion; i++) {
-    fprintf (stderr, "try %s\n", region[i].filename);
+  for (i = 0; i < skylist[0].Nregions; i++) {
+    fprintf (stderr, "try %s\n", skylist[0].regions[i][0].name);
   } 
   
@@ -111,9 +119,8 @@
 
   /* for each region file, extract the data of interest in the right time range */
-  for (j = 0; j < Nregion; j++) {
+  for (j = 0; j < skylist[0].Nregions; j++) {
 
     /* get file name and open */
-    strcpy (filename, region[j].filename);
-    catalog.filename = filename;
+    catalog.filename = skylist[0].regions[j][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
     case 2:
@@ -210,13 +217,2 @@
   return (TRUE);
 }
-
-
-void copy_region (GSCRegion *in, GSCRegion *out) {
-    
-  out[0].RA[0]  = in[0].RA[0];
-  out[0].RA[1]  = in[0].RA[1];
-  out[0].DEC[0] = in[0].DEC[0];
-  out[0].DEC[1] = in[0].DEC[1];
-  strcpy (out[0].filename, in[0].filename);
-}
-
Index: trunk/Ohana/src/opihi/dvo/init.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/init.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/init.c	(revision 5448)
@@ -53,4 +53,5 @@
   {"addxtra",     addxtra,      "add extra data to object"},
   {"getxtra",     getxtra,      "get extra data from object"},
+  {"catalog",     catlog,       "plot catalog stars"},
 */
 
@@ -60,5 +61,4 @@
   {"calextract",  calextract,   "extract photometry calibration"},
   {"calmextract", calmextract,  "extract photometry calibration"},
-  {"catalog",     catlog,       "plot catalog stars"},
   {"ccd",         ccd,          "plot color-color diagram"},
   {"cmatch",      cmatch,       "match two catalogs"},
@@ -91,5 +91,5 @@
   {"lightcurve",  lightcurve,   "extract lightcurve for a star"},
   {"mextract",    mextract,     "extract measure data values"},
-  {"pcat",    	  pcat,         "plot catalog boundaries"},
+  {"pcat",    	  skycat,       "plot catalog boundaries"},
   {"photcodes",   photcodes,    "list photometry codes"},
   {"pmeasure",    pmeasure,     "plot individual measurements"},
Index: trunk/Ohana/src/opihi/dvo/lcat.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/lcat.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/lcat.c	(revision 5448)
@@ -5,5 +5,4 @@
   double Radius;
   int i, N, Nregions, ShowAll;
-  RegionFile *regions;
   char filename[128], exists;
   struct stat filestat;
@@ -11,4 +10,6 @@
   Graphdata graphmode;
   int Ngraph;
+  SkyTable *sky;
+  SkyList *skylist;
 
   Ngraph = 0;
@@ -16,4 +17,8 @@
 
   VarConfig ("CATDIR", "%s", catdir);
+
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
 
   ShowAll = FALSE;
@@ -28,15 +33,14 @@
 
   Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
-  regions = find_regions (graphmode.coords.crval1, graphmode.coords.crval2, Radius, &Nregions);
+  skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
 
-  for (i = 0; i < Nregions; i++) {
-    sprintf (filename, "%s/%s", catdir, regions[i].name);
+  for (i = 0; i < skylist[0].Nregions; i++) {
     exists = 'Y';
-    if (stat (filename, &filestat) == -1) exists = 'N';
+    if (stat (skylist[0].regions[i][0].filename, &filestat) == -1) exists = 'N';
     if (ShowAll) {
-      fprintf (stderr, "%3d %s  %c\n", i, regions[i].name, exists);
+      fprintf (stderr, "%3d %s  %c\n", i, skylist[0].regions[i][0].name, exists);
     } else {
       if (exists == 'Y') {
-	fprintf (stderr, "%3d %s\n", i, regions[i].name);
+	fprintf (stderr, "%3d %s\n", i, skylist[0].regions[i][0].name);
       }
     }
@@ -44,7 +48,5 @@
 
   return (TRUE);
-
-  free (regions);
-
+  SkyListFree (regions);
 }
 
Index: trunk/Ohana/src/opihi/dvo/lcurve.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/lcurve.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/lcurve.c	(revision 5448)
@@ -8,12 +8,13 @@
   int Ngraph, Xgraph, TimeFormat;
   int Nstars, found, AutoLimits, ErrorBars, GalMag, AbsPhot, SaveVectors;
-  int i, j, m, N, NPTS, *N1, Nregions;
+  int i, j, m, N, NPTS, *N1;
   time_t TimeReference;
   struct tm *timeptr;
-  RegionFile *regions;
   Vector *xvec, *yvec;
   Vector Xvec, Yvec, dYvec;
   Catalog catalog;
   Graphdata graphmode;
+  SkyTable *sky;
+  SkyList *skylist;
 
   VarConfig ("CATDIR", "%s", catdir);
@@ -69,17 +70,20 @@
   }
   
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+
   Ra = atof (argv[1]);
   Dec = atof (argv[2]);
   Radius = atof (argv[3]);
 
-  regions = find_regions (Ra, Dec, Radius, &Nregions);
-
-  if (Nregions > 1) {
+  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
+
+  if (skylist[0].Nregions > 1) {
     fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
   }
 
   /* set filename, read in header */
-  sprintf (filename, "%s/%s", catdir, regions[0].name);
-  catalog.filename = filename;
+  catalog.filename = skylist[0].regions[0][0].filename;
   switch (lock_catalog (&catalog, LCK_SOFT)) {
   case 2:
@@ -198,5 +202,5 @@
   if (catalog.measure != 0) free (catalog.measure);
  
+  SkyListFree (skylist);
   return (TRUE);
-
 }
Index: trunk/Ohana/src/opihi/dvo/lightcurve.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/lightcurve.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/lightcurve.c	(revision 5448)
@@ -7,7 +7,6 @@
   float *RA, *DEC;
   int Nstars, found, PhotCodeSelect;
-  int i, j, k, m, N, NPTS, Nsec, RELPHOT, *N1, Nregions, TimeFormat;
+  int i, j, k, m, N, NPTS, Nsec, RELPHOT, *N1, TimeFormat;
   time_t TimeReference;
-  RegionFile *regions;
   Vector *tvec, *mvec, *dmvec;
   Catalog catalog;
@@ -50,13 +49,14 @@
   Radius = atof (argv[3]);
 
-  regions = find_regions (Ra, Dec, Radius, &Nregions);
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
 
-  if (Nregions > 1) {
+  if (skylist[0].Nregions > 1) {
     fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
   }
 
   /* set filename, read in header */
-  sprintf (filename, "%s/%s", catdir, regions[0].name);
-  catalog.filename = filename;
+  catalog.filename = skylist[0].regions[0][0].filename;
   switch (lock_catalog (&catalog, LCK_SOFT)) {
   case 2:
@@ -148,5 +148,5 @@
   if (catalog.secfilt != 0) free (catalog.secfilt);
  
+  SkyListFree (skylist);
   return (TRUE);
-
 }
Index: trunk/Ohana/src/opihi/dvo/pcat.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/pcat.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/pcat.c	(revision 5448)
@@ -2,4 +2,5 @@
 int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside);
 
+// XXX EAM : this function is deprecated (now points at skycat)
 int pcat (int argc, char **argv) {
   
Index: trunk/Ohana/src/opihi/dvo/pmeasure.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/pmeasure.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/pmeasure.c	(revision 5448)
@@ -5,5 +5,5 @@
   FILE *f;
   int i, j, k, m, N;
-  int InRegion, Nregions, Ngraph;
+  int Ngraph;
   char filename[128], catdir[256];
   double Mz, Mr, mag;
@@ -13,6 +13,7 @@
   int PhotcodeClip;
 
+  SkyTable *sky;
+  SkyList *skylist;
   Catalog catalog;
-  RegionFile *regions;
   Graphdata graphmode;
   Vector Xvec, Yvec, Zvec;
@@ -23,5 +24,4 @@
   if (VarConfig ("CATDIR", "%s", catdir) == NULL) return (FALSE);
 
-  regions = (RegionFile *) NULL;
   f = (FILE *) NULL;
   Mz = 17.0;
@@ -68,33 +68,21 @@
   }
 
-  InRegion = FALSE;
-  if ((N = get_argument (argc, argv, "-all"))) {
-    remove_argument (N, &argc, argv);
-    InRegion = TRUE;
-  }
-
-  if ((InRegion || (argc != 2)) && (!InRegion || (argc != 1))) {
-    fprintf (stderr, "USAGE: catalog (filename / -all) [-m M M] [-n N N] [-g] [-a RA DEC MAG] \n");
+  if (argc != 2) {
+    fprintf (stderr, "USAGE: pmeasure (-all) [-m M M] [-p photcode] [-ID ID] [-flag value] [-x]\n");
     return (FALSE);
   }
   
-  if (InRegion) {
-    Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
-    regions = find_regions (graphmode.coords.crval1, graphmode.coords.crval2, Radius, &Nregions);
-  } else {
-    Nregions = 1;
-  }
+  Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
+
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
   
-  for (j = 0; j < Nregions; j++) {
+  for (j = 0; j < skylist[0].Nregions; j++) {
     catalog.average = 0;
     
-    if (InRegion) {
-      sprintf (filename, "%s/%s", catdir, regions[j].name);
-    } else {
-      sprintf (filename, "%s/%s", catdir, argv[1]);
-    }
-    
     /* lock, load, unlock catalog */
-    catalog.filename = filename;
+    catalog.filename = skylist[0].regions[j][0].filename;
     switch (lock_catalog (&catalog, LCK_SOFT)) {
     case 2:
Index: trunk/Ohana/src/opihi/dvo/region_list.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/region_list.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/region_list.c	(revision 5448)
@@ -1,3 +1,7 @@
 # include "dvo1.h"
+
+/* XXX note : for RegionName or RegionList, we need to free the skylist
+   elements, but not in the case of radius selection - this implies 
+   information carried back up */
 
 static int RegionSelect;
@@ -42,25 +46,29 @@
 }
 
-RegionFile *SelectRegions (char *RegionName, char *RegionList, int *nregions) {
+SkyList *SelectRegions (char *RegionName, char *RegionList) {
 
   double Radius;
   int Ngraph;
   Graphdata graphsky;
-  RegionFile *regions;
+  SkyTable *sky;
+  SkyList *skylist;
 
   /* determine region-file names */
   if (RegionName != NULL) {
-    *nregions = 1;
-    ALLOCATE (regions, RegionFile, 1);
-    strcpy (regions[0].name, RegionName);
+    ALLOCATE (skylist, SkyList, 1);
+    ALLOCATE (skylist[0].regions[0], SkyRegion *, 1);
+    ALLOCATE (skylist[0].regions[0][0], SkyRegion, 1);
+    strcpy (skylist[0].regions[0][0].name, RegionName);
+    sprintf (filename, "%s/%s.cpt", CATDIR, RegionName);
+    skylist[0].regions[0][0].filename = strcreate (filename);
     free (RegionName);
     RegionName = NULL;
-    return (regions);
+    return (skylist);
   } 
   if (RegionList != NULL) {
-    regions = region_list (RegionList, nregions);
+    skylist = SkyListLoadFile (RegionList);
     free (RegionList);
     RegionList = NULL;
-    return (regions);
+    return (skylist);
   }
 
@@ -72,31 +80,42 @@
 
   Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax));
-  regions = find_regions (graphsky.coords.crval1, graphsky.coords.crval2, Radius, nregions);
-  return (regions);
+
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  skylist = SkyListByRadius (sky, -1, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
+
+  return (skylist);
 }
 
+/* XXX EAM this should perhaps return a skytable? */
 /* returns a list of region files names from file */
-RegionFile *region_list (char *filename, int *Nregions) {
+SkyList *SkyListFromFile (char *filename) {
   
+  FILE *f;
   int NREGIONS, nregion;
-  RegionFile *regions;
-  FILE *f;
+  SkyList *skylist;
+
+  ALLOCATE (skylist, SkyList, 1);
 
   f = fopen (filename, "r");
   if (f == NULL) {
     fprintf (stderr, "ERROR: can't find region list file %s\n", filename);
-    *Nregions = 0;
-    return (NULL);
+    skylist[0].Nregions = 0;
+    skylist[0].regions = NULL;
+    return (skylist);
   }
   
+  Nregions = 0;
   NREGIONS = 50;
-  ALLOCATE (regions, RegionFile, NREGIONS);
-  nregion = 0;
+  ALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS);
 
-  while (fscanf (f, "%s", regions[nregion].name) != EOF) {
-    nregion ++;
-    if (nregion == NREGIONS) {
-      NREGIONS += 50;
-      REALLOCATE (regions, RegionFile, NREGIONS);
+  while (fscanf (f, "%s", filename) != EOF) {
+    ALLOCATE (skylist[0].regions[Nregions], SkyRegion, 1);
+    strcpy (skylist[0].regions[Nregions][0].name, filename);
+    sprintf (filename, "%s/%s.cpt", CATDIR, skylist[0].regions[Nregions][0].name);
+    skylist[0].regions[Nregions][0].filename = strcreate (filename);
+    Nregions ++;
+    CHECK_REALLOCATE (skylist[0].regions, SkyRegion *, NREGIONS, Nregions, 50);
     }
   }
Index: trunk/Ohana/src/opihi/dvo/subpix.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/subpix.c	(revision 5442)
+++ trunk/Ohana/src/opihi/dvo/subpix.c	(revision 5448)
@@ -5,5 +5,5 @@
 int subpix (int argc, char **argv) {
   
-  int i, j, I, Nlo, Nhi, Nentry, Nstars, Nregions, Nimage, Nmeasure;
+  int i, j, I, Nlo, Nhi, Nentry, Nstars, Nimage, Nmeasure;
   int *index, *entry;
   int Nmin, Nsub, NSUB, status;
@@ -17,5 +17,4 @@
   Measure *measure;
   Image *image;
-  RegionFile *regions;
   Catalog catalog;
 
@@ -35,13 +34,16 @@
   Radius = atof (argv[3]);
 
+  /* load sky from correct table */
+  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, -1, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+
   /* load star nearest position */
-  regions = find_regions (Ra, Dec, Radius, &Nregions);
-  if (Nregions > 1) {
+  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
+  if (skylist[0].Nregions > 1) {
     fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
   }
 
   /* lock, load, unlock catalog */
-  sprintf (filename, "%s/%s", catdir, regions[0].name);
-  catalog.filename = filename;
+  catalog.filename = skylist[0].regions[0][0].filename;
   switch (lock_catalog (&catalog, LCK_SOFT)) {
   case 2:
@@ -92,5 +94,5 @@
     if (catalog.average != 0) free (catalog.average);
     if (catalog.measure != 0) free (catalog.measure);
-    free (regions);
+    SkyListFree (skylist);
     return (TRUE);
   }
@@ -158,5 +160,5 @@
   free (image);
   free (index);
-  free (regions);
+  SkyListFree (regions);
 
   return (TRUE);
