Index: /trunk/Ohana/src/relastro/src/FitPosPMfixed.c
===================================================================
--- /trunk/Ohana/src/relastro/src/FitPosPMfixed.c	(revision 39366)
+++ /trunk/Ohana/src/relastro/src/FitPosPMfixed.c	(revision 39367)
@@ -229,6 +229,6 @@
   fit->dRo = sqrt(data->A[0][0]);
   fit->dDo = sqrt(data->A[1][1]);
-  fit->duR = NAN;
-  fit->duD = NAN;
+  fit->duR = 0.0;
+  fit->duD = 0.0;
   fit->dp  = 0.0;
 
Index: /trunk/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /trunk/Ohana/src/relastro/src/UpdateObjects.c	(revision 39366)
+++ /trunk/Ohana/src/relastro/src/UpdateObjects.c	(revision 39367)
@@ -255,5 +255,5 @@
 	for (k = 0; k < fitStats->NfitAlloc; k++) {
 	  BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask);
-	  if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, fitStats->Npoints)) continue;
+	  if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, Nnomask)) continue;
 	  fitStats->Nfit ++;
 	}
@@ -296,4 +296,5 @@
 
     FitAstromResultSetPM (&fitPos, 1, average);
+    // fprintf (stderr, "fit 1: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD);
     if ((average[0].flags & ID_STAR_USE_PAR) || (average[0].flags & ID_STAR_USE_PM)) {
       if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 
@@ -301,8 +302,8 @@
       }
     } else {
-      FitAstromResultSetPM (&fitPos, 1, average);
       if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
 	goto doneWithFit;
       }
+      // fprintf (stderr, "fit 2: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD);
       if (N_BOOTSTRAP_SAMPLES) {
 	fitStats->Nfit = 0;
@@ -314,5 +315,5 @@
 	for (k = 0; k < fitStats->NfitAlloc; k++) {
 	  BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask);
-	  if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, fitStats->Npoints)) continue;
+	  if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, Nnomask)) continue;
 	  fitStats->Nfit ++;
 	}
@@ -325,5 +326,5 @@
     // project Ro, Do back to RA,DEC
     XY_to_RD (&fitPos.Ro, &fitPos.Do, fitPos.Ro, fitPos.Do, &fitStats->coords);
-    if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
+    if (fabs(fitPos.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
 
     average[0].flags |= ID_STAR_FIT_AVE;
Index: /trunk/Ohana/src/relastro/src/fitobj.c
===================================================================
--- /trunk/Ohana/src/relastro/src/fitobj.c	(revision 39366)
+++ /trunk/Ohana/src/relastro/src/fitobj.c	(revision 39367)
@@ -66,4 +66,5 @@
   }
 
+
   if (argc != 2) {
     fprintf (stderr, "USAGE: %s (mode)\n", argv[0]);
@@ -72,4 +73,26 @@
     exit (2);
   }
+
+  FIT_MODE = FIT_NONE;
+  if (!strcasecmp(argv[1], "pos")) {
+    FIT_MODE = FIT_AVERAGE;
+  }
+  if (!strcasecmp(argv[1], "pm")) {
+    FIT_MODE = FIT_PM_ONLY;
+  }
+  if (!strcasecmp(argv[1], "plx")) {
+    FIT_MODE = FIT_PM_AND_PAR;
+  }
+  if (FIT_MODE == FIT_NONE) {
+    fprintf (stderr, "USAGE: %s (mode)\n", argv[0]);
+    fprintf (stderr, "  mode: pos, pm, plx\n");
+    fprintf (stderr, " options: -Nstars [3000], -Npoints [100], -Noutliers [10], -Nbootstrap [100]\n");
+    exit (2);
+  }
+
+  // some relastro globals need to be set
+  N_BOOTSTRAP_SAMPLES = N_BOOTSTRAP;
+  USE_GALAXY_MODEL = TRUE;
+  MaxMeanOffset = 10.0;
 
   // load reference table here
@@ -104,5 +127,5 @@
     double uD  = 0.5*(drand48() - 0.5);
 
-    double plx = 0.5*(drand48() + 0.0);
+    double plx = (FIT_MODE == FIT_PM_AND_PAR) ? 0.5*(drand48() + 0.0) : 0.0;
 
     // generate a single fake star with N_POINTS real points and N_OUTLIERS bad points
@@ -112,7 +135,8 @@
 
     double Tmean = ohana_sec_to_mjd(catalog->average->Tmean);
+    double Tyear = (Tmean - MJD_J2000) / 365.25;
     fprintf (stdout, "%12.8f %12.8f %8.6f %8.6f %8.6f | %12.8f %12.8f %8.6f %8.6f %8.6f | %12.8f |  %8.6f %8.6f %8.6f %8.6f %8.6f  %d | %f %f %f\n",
 	     Ro, Do, uR, uD, plx, 
-	     catalog->average->R,  catalog->average->D,  catalog->average->uR,  catalog->average->uD,  catalog->average->P, Tmean, 
+	     catalog->average->R,  catalog->average->D,  catalog->average->uR,  catalog->average->uD,  catalog->average->P, Tyear, 
 	     catalog->average->dR, catalog->average->dD, catalog->average->duR, catalog->average->duD, catalog->average->dP, catalog->average->Npos,
 	     catalog->average->ChiSqAve, catalog->average->ChiSqPM, catalog->average->ChiSqPar);
@@ -146,4 +170,13 @@
   }
 
+  catalog->average->objID = 1;
+  catalog->average->catID = 1;
+
+  catalog->average->R = Ro;
+  catalog->average->D = Do;
+  catalog->average->uR = uR;
+  catalog->average->uD = uD;
+  catalog->average->uRgal = uR;
+  catalog->average->uDgal = uD;
   for (i = 0; i < Npoints; i++) {
     // ParFactor expects a time which is in years since J2000 (MJD_..._YRS is so defined)
@@ -162,8 +195,13 @@
     catalog->measureT[i].D = Do + (dD + plx*pD + uD*(Tyears - MJD_REF_YRS))/3600;
 
-    catalog->measureT[i].dXccd = POS_ERROR;
-    catalog->measureT[i].dYccd = POS_ERROR;
+    catalog->measureT[i].dXccd = ToShortPixels(POS_ERROR);
+    catalog->measureT[i].dYccd = ToShortPixels(POS_ERROR);
 
     catalog->measureT[i].photcode = 10233;
+
+    // nominal values to avoid dropping in MeasFilterTest
+    catalog->measureT[i].M = 20.0;
+    catalog->measureT[i].dM = 0.02;
+    catalog->measureT[i].dt = 2.5*log10(30.0);
   }
 
@@ -188,4 +226,9 @@
 
     catalog->measureT[i].photcode = 10233;
+
+    // nominal values to avoid dropping in MeasFilterTest
+    catalog->measureT[i].M = 20.0;
+    catalog->measureT[i].dM = 0.02;
+    catalog->measureT[i].dt = 2.5*log10(30.0);
   }
   catalog->average->Nmeasure = Ntotal;
Index: /trunk/Ohana/src/relastro/test/mana.sh
===================================================================
--- /trunk/Ohana/src/relastro/test/mana.sh	(revision 39366)
+++ /trunk/Ohana/src/relastro/test/mana.sh	(revision 39367)
@@ -37,5 +37,5 @@
 
   foreach nboot 20 30 100 300 1000
-    exec bin/fitpm.lin64 -Nstars 3000 -Noutliers 20 -Npoints 100 -Nbootstrap $nboot $1 > test.$1.dat
+    exec ../bin/fitpm.lin64 -Nstars 3000 -Noutliers 20 -Npoints 100 -Nbootstrap $nboot $1 > test.$1.dat
     reload test.$1.dat
 
@@ -51,5 +51,5 @@
 
   foreach outliers 0 3 10 30 100 
-    exec bin/fitpm.lin64 -Nstars 3000 -Noutliers $outliers -Npoints 100 -Nbootstrap 100 $1 > test.$1.dat
+    exec ../bin/fitpm.lin64 -Nstars 3000 -Noutliers $outliers -Npoints 100 -Nbootstrap 100 $1 > test.$1.dat
     reload test.$1.dat
 
