Index: trunk/psModules/src/objects/pmSourceIO_Ghosts.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO_Ghosts.c	(revision 41367)
+++ trunk/psModules/src/objects/pmSourceIO_Ghosts.c	(revision 41382)
@@ -55,5 +55,5 @@
 #include "pmAstrometryWCS.h"
 
-# include "psastroInternal.h"
+# include "pmSourceInternal.h"
 static psVector *chipXmin = NULL;
 static psVector *chipXmax = NULL;
@@ -68,10 +68,10 @@
     md = psMetadataLookupMetadata (&status, ghostModel, NAME); \
     if (!md) { \
-	psError(PSASTRO_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
+	psError(PM_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
 	goto escape; \
     } \
     OUT = psPolynomial2DfromMetadata(md); \
     if (!OUT) { \
-	psError(PSASTRO_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
+	psError(PM_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
 	goto escape; \
     }
@@ -80,10 +80,10 @@
     md = psMetadataLookupMetadata (&status, ghostModel, NAME); \
     if (!md) { \
-	psError(PSASTRO_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
+	psError(PM_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
 	goto escape; \
     } \
     OUT = psPolynomial1DfromMetadata(md);	\
     if (!OUT) { \
-	psError(PSASTRO_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
+	psError(PM_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
 	goto escape; \
     }
@@ -116,5 +116,5 @@
     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
     if (!recipe) {
-        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe");
+        psError(PM_ERR_CONFIG, true, "Can't find PSASTRO recipe");
         return false;
     }
@@ -129,5 +129,5 @@
 
     if (!pmConfigFileRead (&ghostModel, ghostFile, "GHOST MODEL")) {
-	psError(PSASTRO_ERR_CONFIG, true, "Trouble loading ghost model");
+	psError(PM_ERR_CONFIG, true, "Trouble loading ghost model");
         return false;
     }
@@ -156,5 +156,5 @@
     pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     if (!astrom) {
-        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
+        psError(PM_ERR_CONFIG, true, "Can't find input data");
 	goto escape;
     }
@@ -162,5 +162,5 @@
 
     // really error-out here?  or just skip?
-    if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, &MAX_MAG,NULL, fpa_ast, recipe)) {
+    if (!pmSourceZeroPointFromRecipeGlint (&zeropt, &exptime, &MAX_MAG,NULL, fpa_ast, recipe)) {
         psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
 	goto escape;
@@ -202,5 +202,5 @@
  			if (ref->Mag > MAX_MAG) continue;
 
- 			psastroGhost *ghost = psastroGhostAlloc ();
+ 			pmSourceGhost *ghost = pmSourceGhostAlloc ();
  			ghost->srcFP->x = ref->FP->x; 
  			ghost->srcFP->y = ref->FP->y;
@@ -239,6 +239,6 @@
  			// XXX this code yields a single chip: we need to provide results for any chips
  			// which encompass the full size of the ghost
- 			pmChip *ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y);
- 			ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
+ 			pmChip *ghostChip = pmSourceFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y);
+ 			ghostChip = pmSourceFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
 
                         //do a rudimentary check of whether the ghost is on the pixel FPA
@@ -331,5 +331,5 @@
 }
 
-static void psastroGhostFree (psastroGhost *ghost) {
+static void pmSourceGhostFree (pmSourceGhost *ghost) {
 
     if (ghost == NULL) return;
@@ -342,8 +342,8 @@
 }
 
-psastroGhost *psastroGhostAlloc (void) {
-
-    psastroGhost *ghost = (psastroGhost *) psAlloc(sizeof(psastroGhost));
-    psMemSetDeallocator(ghost, (psFreeFunc) psastroGhostFree);
+pmSourceGhost *pmSourceGhostAlloc (void) {
+
+    pmSourceGhost *ghost = (pmSourceGhost *) psAlloc(sizeof(pmSourceGhost));
+    psMemSetDeallocator(ghost, (psFreeFunc) pmSourceGhostFree);
 
     ghost->srcFP = psPlaneAlloc();
@@ -365,5 +365,5 @@
 
 
-bool psastroChipBounds (pmFPA *fpa) {
+bool pmSourceChipBounds (pmFPA *fpa) {
 
     chipXmin = psVectorAlloc (fpa->chips->n, PS_TYPE_F32);
@@ -416,5 +416,5 @@
 }
 
-pmChip *psastroFindChip (double *xChip, double *yChip, pmFPA *fpa, double xFPA, double yFPA) {
+pmChip *pmSourceFindChip (double *xChip, double *yChip, pmFPA *fpa, double xFPA, double yFPA) {
 
     *xChip = NAN;
@@ -422,5 +422,5 @@
 
     if (!chipXmin) {
-	psastroChipBounds (fpa);
+	pmSourceChipBounds (fpa);
     }
 
@@ -458,5 +458,5 @@
 
 // identify chips which land on this column (FP coords)
-bool psastroFindChipInXrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
+bool pmSourceFindChipInXrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
 
     if (!chipXmin || !chipXmax) {
@@ -470,5 +470,5 @@
 
 // identify chips which land on this row (FP coords)
-bool psastroFindChipInYrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
+bool pmSourceFindChipInYrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
 
     if (!chipYmin || !chipYmax) {
@@ -482,5 +482,5 @@
 
 // return the FPA coordinates of the Y edges of the chip
-bool psastroFindChipYedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
+bool pmSourceFindChipYedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
 
     *yFPAs = chipYmin->data.F32[nChip];
@@ -490,5 +490,5 @@
 
 // return the FPA coordinates of the X edges of the chip
-bool psastroFindChipXedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
+bool pmSourceFindChipXedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
 
     *yFPAs = chipXmin->data.F32[nChip];
@@ -498,5 +498,5 @@
 
 // convert FPA to Chip coordinates
-bool psastroFPAtoChip (double *xChip, double *yChip, pmFPA *fpa, int nChip, double xFPA, double yFPA) {
+bool pmSourceFPAtoChip (double *xChip, double *yChip, pmFPA *fpa, int nChip, double xFPA, double yFPA) {
 
     pmChip *chip = fpa->chips->data[nChip];
@@ -512,5 +512,5 @@
 }
 
-bool psastroExtractFreeChipBounds () {
+bool pmSourceExtractFreeChipBounds () {
   
   psFree (chipXmin);
