Index: trunk/psastro/src/psastroMaskUpdates.c
===================================================================
--- trunk/psastro/src/psastroMaskUpdates.c	(revision 24701)
+++ trunk/psastro/src/psastroMaskUpdates.c	(revision 26173)
@@ -34,5 +34,6 @@
     psImageMaskType spikeMaskValue = pmConfigMaskGet("SPIKE", config); // Mask value for ghost pixels
     psImageMaskType starMaskValue  = pmConfigMaskGet("STARCORE", config); // Mask value for ghost pixels
-
+    psImageMaskType crosstalkMaskValue = pmConfigMaskGet("GHOST", config); // Mask value for crosstalk ghosts
+    
     // psImageMaskType maskBlank  = pmConfigMaskGet("BLANK", config); // Mask value for blank pixels
 
@@ -48,4 +49,11 @@
     if (!REFSTAR_MASK) return true;
 
+    // convert star positions to crosstalk artifact positions and add to the readout->analysis data
+    bool CROSSTALK_MASK                    = psMetadataLookupBool (&status, recipe, "CROSSTALK_MASK");
+    if (CROSSTALK_MASK && !psastroLoadCrosstalk (config)) {
+      psError(PSASTRO_ERR_CONFIG, false, "Error loading crosstalk data");
+      return(false);
+    }
+    
     // convert star positions to ghost positions and add to the readout->analysis data
     if (!psastroLoadGhosts (config)) {
@@ -76,4 +84,7 @@
     double REFSTAR_MASK_BLEED_MAG_SLOPE    = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE");
 
+    double REFSTAR_MASK_CROSSTALK_MAG_MAX  = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_MAX");
+    double REFSTAR_MASK_CROSSTALK_MAG_SLOPE= psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_SLOPE");
+    
     // select the input data sources
     pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
@@ -201,4 +212,5 @@
 
                     if (ref->Mag > REFSTAR_MASK_MAX_MAG) continue;
+
 
 		    // the reference magnitudes have been converted from the instrumental
@@ -282,4 +294,20 @@
 		}
 
+		// Select the crosstalk artifact regions for this readout, and mask a circular region
+		// corresponding to the source star
+
+		psArray *crosstalks = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.CROSSTALKS");
+		if (crosstalks) {
+		  for (int i = 0; i < crosstalks->n; i++) {
+		    pmAstromObj *ref = crosstalks->data[i];
+		    float radius = REFSTAR_MASK_CROSSTALK_MAG_SLOPE * (REFSTAR_MASK_CROSSTALK_MAG_MAX - ref->Mag);
+		    psTrace("psastro.crosstalk",2,"Masking star on Chip %s @ (%f,%f) Magnitude: %f Radius %f\n",
+			    psMetadataLookupStr(&status,readout->parent->parent->concepts,"CHIP.NAME"),
+			    ref->chip->x,ref->chip->y,ref->Mag,radius);
+		    // XXX for now, assume cell binning is 1x1 relative to chip
+		    psastroMaskCircle (readoutMask->mask, crosstalkMaskValue, ref->chip->x, ref->chip->y, radius, radius);
+		  }
+		}
+		
 		// this probably should move into a function of its own:
 		{
