Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/include/relastro.h
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/include/relastro.h	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/include/relastro.h	(revision 38697)
@@ -494,5 +494,5 @@
 int UpdateObjects (Catalog *catalog, int Ncatalog, int Nloop);
 int UpdateSimple (Catalog *catalog, int Ncatalog);
-int UpdateChips (Catalog *catalog, int Ncatalog);
+int UpdateChips (Catalog *catalog, int Ncatalog, int Nloop);
 int UpdateMosaic (Catalog *catalog, int Ncatalog);
 int UpdateMeasures (Catalog *catalog, int Ncatalog);
@@ -727,3 +727,3 @@
 FitStats *FitStatsInit (int Nmax, int Nboot);
 int FitAstromResultSetPM (FitAstromResult *fit, int Nfit, Average *average);
-void AstromErrorSetLoop (int N);
+void AstromErrorSetLoop (int Nloop, int isImageMode);
Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/GetAstromError.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/GetAstromError.c	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/GetAstromError.c	(revision 38697)
@@ -7,8 +7,10 @@
 
 static int Nloop = -1;
+static int isImage = FALSE;
 
 // Nloop is used to modify the per detection errors
-void AstromErrorSetLoop (int N) {
+void AstromErrorSetLoop (int N, int isImageMode) {
   Nloop = N;
+  isImage = isImageMode;
 }
 
@@ -64,8 +66,20 @@
   dPtotal = MAX (dPtotal, MIN_ERROR);
 
-  // early on, we want 2MASS to have a very high weight.  This will force images to match
-  // the 2MASS reference frame.  As Nloop gets higher, the weight needs to drop to allow
-  // the ps1 measurements to drive the solution
-  if ((measure[0].photcode >= 2011) && (measure[0].photcode <= 2013)) {
+  // early on, we want 2MASS and Tycho to have a very high weight.  This will force images
+  // to match the 2MASS / Tycho / ICRS reference frame.  As Nloop gets higher, the weight
+  // needs to drop to allow the ps1 measurements to drive the solution
+  int is2MASS = (measure[0].photcode >= 2011) && (measure[0].photcode <= 2013);
+  int isTycho = (measure[0].photcode >= 2020) && (measure[0].photcode <= 2021);
+
+  // serious hack: if the object has 2MASS, we set this internal bit and adjust the
+  // weight to ensure the image is tied down to the 2mass frame
+
+  // we only adjust the weight if we are applying the galaxy model
+  int modifyWeight = isImage && (measure[0].dbFlags & ID_MEAS_POOR_PHOTOM);
+  modifyWeight |= is2MASS;
+  modifyWeight |= isTycho;
+  modifyWeight &= USE_GALAXY_MODEL;
+
+  if (modifyWeight && is2MASS) {
     switch (Nloop) {
       case 0:
@@ -85,5 +99,5 @@
     }
   }
-  if ((measure[0].photcode >= 2020) && (measure[0].photcode <= 2021)) {
+  if (modifyWeight && isTycho) {
     switch (Nloop) {
       case 0:
Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/ImageOps.c	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/ImageOps.c	(revision 38697)
@@ -752,4 +752,5 @@
     ref[i].D = catalog[c].average[n].D;
     
+    // if we are applying the galaxy model, move the reference position...
     if (USE_GALAXY_MODEL) {
       // apply proper-motion from average position to measure epoch:
@@ -774,8 +775,4 @@
     ref[i].ColorBlue = NAN;
     ref[i].ColorRed = NAN;
-
-    if (USE_GALAXY_MODEL && (measure[0].dbFlags & ID_MEAS_POOR_PHOTOM)) {
-      ref[0].dPos = ref[0].dPos / 100.0;
-    }
 
     if ((DCR_BLUE_NSEC_POS >= 0) && (DCR_BLUE_NSEC_NEG >= -1)) {
Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateChips.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateChips.c	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateChips.c	(revision 38697)
@@ -29,5 +29,5 @@
 // update astrometry of all chips relative to the average positions
 // if NTHREADS is non-zero, call the threaded version of this function
-int UpdateChips (Catalog *catalog, int Ncatalog) {
+int UpdateChips (Catalog *catalog, int Ncatalog, int Nloop) {
 
   off_t Nskip, Nmosaic, NnewFit, NoldFit;
@@ -39,4 +39,6 @@
   double *Ro, *Do;
   char *mode;
+
+  AstromErrorSetLoop (Nloop, TRUE);
 
   if (NTHREADS) {
Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateObjects.c	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateObjects.c	(revision 38697)
@@ -21,5 +21,5 @@
   FitStats *fitStatsStack = FitStatsInit (NmeasureMax, N_BOOTSTRAP_SAMPLES);
 
-  AstromErrorSetLoop (Nloop);
+  AstromErrorSetLoop (Nloop, FALSE);
 
   int i;
Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_images.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_images.c	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_images.c	(revision 38697)
@@ -73,6 +73,6 @@
       if (RESET_IMAGES) UpdateMeasures (catalog, Ncatalog);
       for (i = 0; i < NLOOP; i++) {
-	UpdateObjects (catalog, Ncatalog, (i > 0)); // calculate <R>,<D>; if (i > 0), apply Galaxy Motion Model (if desired)
-	UpdateChips (catalog, Ncatalog);   // measure.X,Y -> R,D, fit image.coords
+	UpdateObjects (catalog, Ncatalog, i); // calculate <R>,<D>; if (i > 0), apply Galaxy Motion Model (if desired)
+	UpdateChips (catalog, Ncatalog, i);   // measure.X,Y -> R,D, fit image.coords
 	MARKTIME("update chips: %f sec\n", dtime);
       }
Index: /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_parallel_images.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_parallel_images.c	(revision 38696)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_parallel_images.c	(revision 38697)
@@ -120,5 +120,5 @@
       }
       for (i = 0; i < NLOOP; i++) {
-	UpdateObjects (catalog, Ncatalog, (i > 0));
+	UpdateObjects (catalog, Ncatalog, i);
 	LOGRTIME("UpdateObjects loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime);
 
@@ -128,5 +128,5 @@
 	LOGRTIME("slurp_mean_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime);
 
-	UpdateChips (catalog, Ncatalog);
+	UpdateChips (catalog, Ncatalog, i);
 	LOGRTIME("UpdateChips loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime);
 
