Index: /trunk/Ohana/src/addstar/Makefile
===================================================================
--- /trunk/Ohana/src/addstar/Makefile	(revision 7741)
+++ /trunk/Ohana/src/addstar/Makefile	(revision 7742)
@@ -94,4 +94,5 @@
 $(SRC)/load2mass.$(ARCH).o \
 $(SRC)/load2mass_as_rawdata.$(ARCH).o \
+$(SRC)/load2mass_catalog.$(ARCH).o \
 $(SRC)/get2mass_ops.$(ARCH).o \
 $(SRC)/find_matches_refstars.$(ARCH).o \
Index: /trunk/Ohana/src/addstar/include/2mass.h
===================================================================
--- /trunk/Ohana/src/addstar/include/2mass.h	(revision 7741)
+++ /trunk/Ohana/src/addstar/include/2mass.h	(revision 7742)
@@ -35,2 +35,3 @@
 SkyTable *load2mass_acc (char *path, char *accel);
 int get2mass_3star (Stars *star, char *line, int Nmax);
+int load2mass_catalog (Catalog *catalog, Stars *stars, int Nstars);
Index: /trunk/Ohana/src/addstar/src/load2mass_as_rawdata.c
===================================================================
--- /trunk/Ohana/src/addstar/src/load2mass_as_rawdata.c	(revision 7741)
+++ /trunk/Ohana/src/addstar/src/load2mass_as_rawdata.c	(revision 7742)
@@ -126,12 +126,12 @@
 
 	stars[Nstars+0].R = tstars[j].R;
-	stars[Nstars+0].D = tstars[j].R;
-	// stars[Nstars+1].R = tstars[j].R;
-	// stars[Nstars+1].D = tstars[j].R;
-	// stars[Nstars+2].R = tstars[j].R;
-	// stars[Nstars+2].D = tstars[j].R;
-	// get2mass_3star (&stars[Nstars], &buffer[offset], Nbyte - offset);
-	
-	get2mass_star (&stars[Nstars], &buffer[offset], Nbyte - offset);
+	stars[Nstars+0].D = tstars[j].D;
+	stars[Nstars+1].R = tstars[j].R;
+	stars[Nstars+1].D = tstars[j].D;
+	stars[Nstars+2].R = tstars[j].R;
+	stars[Nstars+2].D = tstars[j].D;
+	get2mass_3star (&stars[Nstars], &buffer[offset], Nbyte - offset);
+	// get2mass_star (&stars[Nstars], &buffer[offset], Nbyte - offset);
+
 	tstars[j].flag = TRUE;
 
@@ -153,10 +153,7 @@
 	load_pt_catalog (&catalog, skylist[0].regions[0]);
 
-	// create the subset pointers
-	ALLOCATE (subset, Stars *, Nstars);
-	for (j = 0; j < Nstars; j++) subset[j] = &stars[j];
-
-	find_matches_refstars (skylist[0].regions[0], subset, Nstars, &catalog, options);
-	free (subset);
+	// assume no input star matches an existing star 
+	// simply add to the existing table
+	load2mass_catalog (catalog, stars, Nstars);
 
 	wcatalog (&catalog);
Index: /trunk/Ohana/src/addstar/src/load2mass_catalog.c
===================================================================
--- /trunk/Ohana/src/addstar/src/load2mass_catalog.c	(revision 7742)
+++ /trunk/Ohana/src/addstar/src/load2mass_catalog.c	(revision 7742)
@@ -0,0 +1,84 @@
+# include "addstar.h"
+
+int load2mass_catalog (Catalog *catalog, Stars *stars, int Nstars) {
+
+  Nsec = GetPhotcodeNsecfilt ();
+  Nave = catalog[0].Naverage;
+  Nmeas = catalog[0].Nmeasure;
+   
+  NAVE = Nave + 100;
+  NMEAS = Nmeas + 100;
+  REALLOCATE (catalog[0].average, Average, NAVE);
+  REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*Nsec);
+  REALLOCATE (catalog[0].measure, Measure, NMEAS);
+
+  for (i = 0; i < Nstars; i+=3) {
+
+    // construct an average object for this object
+    // XXX for now, the output objects will have limited astrometric interpretation...
+    // XXX every 3 stars represents 3 measurements and 1 average
+    catalog[0].average[Nave].R     = stars[i].R;
+    catalog[0].average[Nave].D     = stars[i].D;
+    catalog[0].average[Nave].dR    = 0;
+    catalog[0].average[Nave].dD    = 0;
+    catalog[0].average[Nave].uR    = 0;
+    catalog[0].average[Nave].uD    = 0;
+    catalog[0].average[Nave].duR   = 0;
+    catalog[0].average[Nave].duD   = 0;
+    catalog[0].average[Nave].P     = 0;
+    catalog[0].average[Nave].dP    = 0;
+
+    // XXX for now, set the average mag data to NULL
+    catalog[0].average[Nave].M         = NO_MAG;
+    catalog[0].average[Nave].dM        = NO_MAG;
+    catalog[0].average[Nave].Nm        = 0;
+    catalog[0].average[Nave].Nn        = 0;
+    catalog[0].average[Nave].Xp        = NO_MAG;
+    catalog[0].average[Nave].Xm        = NO_MAG;
+    catalog[0].average[Nave].Xg        = NO_MAG;
+    catalog[0].average[Nave].offset    = Nmeas;
+    catalog[0].average[Nave].missing   = -1;
+    catalog[0].average[Nave].code      = 0;
+
+    for (j = 0; j < Nsec; j++) {
+      catalog[0].secfilt[Nave*Nsec+j].M_PS  = NO_MAG;
+      catalog[0].secfilt[Nave*Nsec+j].dM_PS = NO_MAG;
+      catalog[0].secfilt[Nave*Nsec+j].Xm    = NO_MAG;
+    }
+
+    // we now have the min chisq row. use this to supply the other filter values....
+    for (j = 0; j < 3; j++) {
+      catalog[0].measure[Nmeas].dR_PS       = 0.0;
+      catalog[0].measure[Nmeas].dD_PS       = 0.0;
+      catalog[0].measure[Nmeas].M_PS        = MIN (stars[i+j].M,  NO_MAG);
+      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[i+j].dM,  NO_ERR);
+      catalog[0].measure[Nmeas].Mcal_PS     = 0;
+      catalog[0].measure[Nmeas].t           = stars[i+j].t;
+      catalog[0].measure[Nmeas].averef      = Nave;
+      catalog[0].measure[Nmeas].source      = stars[i+j].code;
+      catalog[0].measure[Nmeas].dophot      = 0;
+      catalog[0].measure[Nmeas].flags       = 0;
+      catalog[0].measure[Nmeas].dt_PS       = 0xffff;
+
+      catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
+      catalog[0].measure[Nmeas].airmass_PS  = 0;
+      catalog[0].measure[Nmeas].FWx         = NO_MAG;
+      catalog[0].measure[Nmeas].FWy         = NO_ERR;
+      catalog[0].measure[Nmeas].theta       = NO_ERR;
+
+      catalog[0].average[Nave].Nm++;
+      Nmeas ++;
+      CHECK_REALLOCATE (catalog[0].measure, Measure, NMEAS, Nmeas, 100);
+    }
+
+    Nave ++;
+    if (Nave >= NAVE) {
+      NAVE += 100;
+      REALLOCATE (catalog[0].average, Average, NAVE);
+      REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*Nsec);
+    }
+  }
+  catalog[0].Naverage = Nave;
+  catalog[0].Nmeasure = Nmeas;
+  return (TRUE);
+}
