Index: branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/UpdateObjects.c	(revision 35287)
+++ branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/UpdateObjects.c	(revision 35288)
@@ -385,5 +385,5 @@
   }
 
-  fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT"\n",  (NaveSum + NpmSum + NparSum),  NaveSum,  NpmSum,  NparSum,  NskipSum);
+  if (VERBOSE) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT"\n",  (NaveSum + NpmSum + NparSum),  NaveSum,  NpmSum,  NparSum,  NskipSum);
   return (TRUE);
 }
Index: branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/args.c
===================================================================
--- branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/args.c	(revision 35287)
+++ branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/args.c	(revision 35288)
@@ -89,5 +89,5 @@
   if ((N = get_argument (argc, argv, "-high-speed"))) {
     // XXX include a parallax / no-parallax option
-    if (N >= argc - 5) usage();
+    if (N >= argc - 4) usage();
     FIT_TARGET = TARGET_HIGH_SPEED;
     remove_argument (N, &argc, argv);
@@ -103,5 +103,5 @@
 
   if ((N = get_argument (argc, argv, "-hpm"))) {
-    if (N >= argc - 3) usage();
+    if (N >= argc - 2) usage();
     FIT_TARGET = TARGET_HPM;
     remove_argument (N, &argc, argv);
Index: branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/hpm_objects.c
===================================================================
--- branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/hpm_objects.c	(revision 35287)
+++ branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/hpm_objects.c	(revision 35288)
@@ -2,6 +2,6 @@
 # define MAX_TRANGE 180.0
 # define MIN_PS1_DET 3
-# define MAX_CHISQ_PM 10.0
-# define MIN_NPOS_FRAC 0.8
+# define MAX_CHISQ_PM 1000000.0
+# define MIN_NPOS_FRAC 1.0
 
 # define NEXT_I { if (Ngroup < 2) slowMoving[ni] = TRUE; newI = TRUE; i++; continue; }
@@ -56,8 +56,9 @@
   dvo_catalog_init (&testcat, TRUE);
   testcat.Naverage = 1; // this is fixed -- only one obj in testcat
+  testcat.Nsecfilt = Nsecfilt;
   off_t NMEASURE_TESTCAT = 1000;
-  REALLOCATE (catalogOut.average, Average, 1);
-  REALLOCATE (catalogOut.measure, Measure, NMEASURE_TESTCAT);
-  REALLOCATE (catalogOut.secfilt, SecFilt, Nsecfilt);
+  ALLOCATE (testcat.average, Average, 1);
+  ALLOCATE (testcat.measure, Measure, NMEASURE_TESTCAT);
+  ALLOCATE (testcat.secfilt, SecFilt, Nsecfilt);
 
   // mask with which to mark objects to be ignored
@@ -65,4 +66,6 @@
   memset (slowMoving, 0, catalog[0].Naverage*sizeof(int));
   off_t Nslow = 0;
+
+  time_t T2000 = ohana_date_to_sec ("2000/01/01");
 
   // mark (exclude) objects which do not meet the selection criterion
@@ -76,15 +79,17 @@
     }
 
-    // selection criteria : (Nps1 > 2) && (Trange < 180)
-    if (catalog[0].average[i].Trange > MAX_TRANGE) {
-      slowMoving[i] = TRUE;
-      Nslow ++;
-      continue;
-    }
     // count the PS1 detections via explicit photcode ranges?
     // XXX this is a total hard-wired hack...
     int Nps1 = 0;
-    for (j = 0; i < 5; j++) {
-      Nps1 += catalog[0].secfilt[Nsecfilt*i+j].Ncode;
+    double Tmin = +100.0*365.0;  // +/- 100 years
+    double Tmax = -100.0*365.0;  
+    m = catalog[0].average[i].measureOffset;
+    for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {
+      if (catalog[0].measure[m+j].photcode < 10000) continue;
+      if (catalog[0].measure[m+j].photcode > 10600) continue;
+      double To = (catalog[0].measure[m+j].t - T2000) / 86400.0 ; // time in days relative to J2000 in years
+      Tmin = MIN(Tmin, To);
+      Tmax = MAX(Tmax, To);
+      Nps1 ++;
     }
     if (Nps1 < MIN_PS1_DET) {
@@ -93,7 +98,22 @@
       continue;
     }      
+    // selection criteria : (Nps1 > 2) && (Trange < 180)
+    double Trange = Tmax - Tmin;
+    if (Trange > MAX_TRANGE) {
+      slowMoving[i] = TRUE;
+      Nslow ++;
+      continue;
+    }
   }
 
   fprintf (stderr, OFF_T_FMT" slow, "OFF_T_FMT" total objects; "OFF_T_FMT" possible fast\n",  Nslow,  catalog[0].Naverage,  catalog[0].Naverage - Nslow);
+  if (catalog[0].Naverage == Nslow) {
+    fprintf (stderr, "no possible fast objects, skipping this catalog\n");
+    dvo_catalog_save (&catalogOut, VERBOSE2);
+    dvo_catalog_unlock (&catalogOut);
+    dvo_catalog_free (&catalogOut);
+    free (slowMoving);
+    return TRUE;
+  }
     
   // double loop over unmarked objects (sorted in RA / X)
@@ -229,4 +249,6 @@
     }
     testcat.average[0].Nmeasure = Nmatchmeas;
+    testcat.Nmeasure = Nmatchmeas;
+    populate_tiny_values (&testcat, DVO_TV_MEASURE);
 
     // we have now accumulated the measurements for this group, let's try a fit
@@ -240,4 +262,5 @@
     good |= (testcat.average[0].ChiSqPM < MAX_CHISQ_PM);
     good |= (testcat.average[0].Npos > MIN_NPOS_FRAC * testcat.average[0].Nmeasure);
+    good &= ((testcat.average[0].flags & ID_STAR_FIT_PM) > 0);
 
     if (good) {
