Index: trunk/Ohana/src/opihi/dvo/pmeasure.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/pmeasure.c	(revision 5320)
+++ 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:
