Index: trunk/psastro/src/psastroConvert.c
===================================================================
--- trunk/psastro/src/psastroConvert.c	(revision 6958)
+++ trunk/psastro/src/psastroConvert.c	(revision 7014)
@@ -1,4 +1,21 @@
 # include "psastro.h"
+// XXX leak free 2006.04.27
 
+// XXX pass/apply the WCS information?
+bool psastroConvert (pmReadout *readout, psMetadata *recipe) {
+
+    psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES");
+    if (sources == NULL)
+        return false;
+
+    psArray *objects = pmSourceToAstromObj (sources);
+
+    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.OBJECTS", PS_DATA_ARRAY, "astrometry objects", objects);
+    psFree (objects);
+ 
+    return true;
+}
+
+// XXX select a magnitude range?
 psArray *pmSourceToAstromObj (psArray *sources) {
 
@@ -6,8 +23,8 @@
     
     for (int i = 0; i < sources->n; i++) {
-	psSource *source = sources->data[i];
+	pmSource *source = sources->data[i];
 	
 	// only accept the PSF sources?
-	if (source->type != PM_SOURCE_STAR) continue;
+	if (source->type != PM_SOURCE_TYPE_STAR) continue;
 
 	pmModel *model = source->modelPSF;
@@ -25,9 +42,10 @@
 	// XXX do we have the information giving the readout and cell offset?
 	// for the moment, assume chip == cell == readout
-	obj->cell = obj->pix;
-	obj->chip = obj->cell;
-	
-	// can we make an initial guess of the astrometry to set FP, TP, and sky coords?
-	
-	
+	*obj->cell = *obj->pix;
+	*obj->chip = *obj->cell;
+
+	psArrayAdd (objects, 100, obj);
+	psFree (obj);
+    }
+    return objects;
 }
