Index: trunk/psphot/src/psphotVisual.c
===================================================================
--- trunk/psphot/src/psphotVisual.c	(revision 19888)
+++ trunk/psphot/src/psphotVisual.c	(revision 19916)
@@ -1,4 +1,3 @@
 # include "psphotInternal.h"
-bool psphotVisualPlotMoments (pmConfig *config, const pmFPAview *view, psArray *sources);
 
 // this function displays representative images as the psphot analysis progresses:
@@ -88,5 +87,5 @@
 }
 
-bool psphotVisualShowImage (pmConfig *config, pmReadout *readout) {
+bool psphotVisualShowImage (pmReadout *readout) {
 
     if (!isVisual) return true;
@@ -178,5 +177,5 @@
 }
 
-bool psphotVisualShowPeaks (pmConfig *config, const pmFPAview *view, pmDetections *detections) {
+bool psphotVisualShowPeaks (pmDetections *detections) {
 
     int Noverlay;
@@ -256,6 +255,5 @@
 }
 
-// XXX this is just wrong: outlines entire image
-bool psphotVisualShowFootprints (pmConfig *config, const pmFPAview *view, pmDetections *detections) {
+bool psphotVisualShowFootprints (pmDetections *detections) {
 
     int Noverlay;
@@ -371,5 +369,5 @@
 }
 
-bool psphotVisualShowMoments (pmConfig *config, const pmFPAview *view, psArray *sources) {
+bool psphotVisualShowMoments (psArray *sources) {
 
     int Noverlay;
@@ -429,5 +427,5 @@
 }
 
-bool psphotVisualPlotMoments (pmConfig *config, const pmFPAview *view, psArray *sources) {
+bool psphotVisualPlotMoments (psMetadata *recipe, psArray *sources) {
 
     bool status;
@@ -445,21 +443,12 @@
     }  
 
-    // select the current recipe
-    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
-    if (!recipe) {
-	fprintf (stderr, "missing recipe, skipping moments plot\n");
-        return false;
-    }
-
     KapaClearPlots (kapa3);
     KapaInitGraph (&graphdata);
 
-    float psfX  = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.X");
-    float psfY  = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.Y");
-    float psfdX = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.DX");
-    float psfdY = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.DY");
-    float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA");
-    float Rx = psfdX * PSF_CLUMP_NSIGMA;
-    float Ry = psfdY * PSF_CLUMP_NSIGMA;
+    // there are N regions: use the first (guaranteed to exist) to get the overall limits
+    psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, "PSF.CLUMP.REGION.000");
+    
+    float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
+    float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
 
     // examine sources to set data range
@@ -522,18 +511,40 @@
     KapaPlotVector (kapa3, nB, yBright->data.F32, "y");
 
-    // draw a circle centered on psfX,Y with size of the psf limit
-    psVector *xLimit  = psVectorAlloc (120, PS_TYPE_F32);
-    psVector *yLimit  = psVectorAlloc (120, PS_TYPE_F32);
-    for (int i = 0; i < xLimit->n; i++) {
-	xLimit->data.F32[i] = Rx*cos(i*2.0*M_PI/120.0) + psfX;
-	yLimit->data.F32[i] = Ry*sin(i*2.0*M_PI/120.0) + psfY;
-    }
-    graphdata.color = KapaColorByName ("blue");
-    graphdata.style = 0;
-    KapaPrepPlot (kapa3, xLimit->n, &graphdata);
-    KapaPlotVector (kapa3, xLimit->n, xLimit->data.F32, "x");
-    KapaPlotVector (kapa3, yLimit->n, yLimit->data.F32, "y");
-    psFree (xLimit);
-    psFree (yLimit);
+    // XXX draw N circles to outline the clumps
+    { 
+	// draw a circle centered on psfX,Y with size of the psf limit
+	psVector *xLimit  = psVectorAlloc (120, PS_TYPE_F32);
+	psVector *yLimit  = psVectorAlloc (120, PS_TYPE_F32);
+
+	int nRegions = psMetadataLookupS32 (&status, recipe, "PSF.CLUMP.NREGIONS");
+	float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA");
+
+	graphdata.color = KapaColorByName ("blue");
+	graphdata.style = 0;
+
+	for (int n = 0; n < nRegions; n++) {
+
+	    char regionName[64];
+	    snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", n);
+	    psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, regionName);
+    
+	    float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
+	    float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
+	    float psfdX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DX");
+	    float psfdY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DY");
+	    float Rx = psfdX * PSF_CLUMP_NSIGMA;
+	    float Ry = psfdY * PSF_CLUMP_NSIGMA;
+
+	    for (int i = 0; i < xLimit->n; i++) {
+		xLimit->data.F32[i] = Rx*cos(i*2.0*M_PI/120.0) + psfX;
+		yLimit->data.F32[i] = Ry*sin(i*2.0*M_PI/120.0) + psfY;
+	    }
+	    KapaPrepPlot (kapa3, xLimit->n, &graphdata);
+	    KapaPlotVector (kapa3, xLimit->n, xLimit->data.F32, "x");
+	    KapaPlotVector (kapa3, yLimit->n, yLimit->data.F32, "y");
+	}
+	psFree (xLimit);
+	psFree (yLimit);
+    }
 
 # if (0)
@@ -589,5 +600,5 @@
 
 // assumes 'kapa' value is checked and set
-bool psphotVisualShowRoughClass_Single (pmConfig *config, const pmFPAview *view, psArray *sources, pmSourceType type, pmSourceMode mode, char *color) {
+bool psphotVisualShowRoughClass_Single (psArray *sources, pmSourceType type, pmSourceMode mode, char *color) {
 
     int Noverlay;
@@ -635,7 +646,5 @@
 }
 
-bool psphotVisualShowRoughClass (pmConfig *config, const pmFPAview *view, psArray *sources) {
-
-    psphotVisualPlotMoments (config, view, sources);
+bool psphotVisualShowRoughClass (psArray *sources) {
 
     if (!isVisual) return true;
@@ -648,10 +657,10 @@
     KiiEraseOverlay (kapa, "yellow"); // moments
 
-    psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_STAR, 0, "red");
-    psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_EXTENDED, 0, "blue");
-    psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_DEFECT, 0, "blue");
-    psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_SATURATED, 0, "red");
-    psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_PSFSTAR, "yellow");
-    psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_SATSTAR, "green");
+    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_STAR, 0, "red");
+    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_EXTENDED, 0, "blue");
+    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_DEFECT, 0, "blue");
+    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_SATURATED, 0, "red");
+    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_PSFSTAR, "yellow");
+    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_SATSTAR, "green");
 
     // pause and wait for user input:
@@ -666,7 +675,5 @@
 }
 
-bool psphotVisualShowPSFStars (pmConfig *config, const pmFPAview *view, pmPSF *psf, psArray *sources) {
-
-    bool status;
+bool psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf) {
 
     if (!isVisual) return true;
@@ -681,10 +688,67 @@
     }  
 
-    // select the current recipe
-    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
-    if (!recipe) {
-        psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
-        return false;
-    }
+    int DX = 64;
+    int DY = 64;
+
+    psImage *psfMosaic = psImageAlloc (3*DX, 3*DY, PS_TYPE_F32);
+    psImageInit (psfMosaic, 0.0);
+    
+    pmModel *modelRef = pmModelAlloc(psf->type);
+
+    // generate a fake model at each of the 3x3 image grid positions
+    for (int x = -1; x <= +1; x ++) {
+	for (int y = -1; y <= +1; y ++) {
+	    // use the center of the center pixel of the image
+	    float xc = (0.5 + 0.45*x)*readout->image->numCols + readout->image->col0;
+	    float yc = (0.5 + 0.45*y)*readout->image->numRows + readout->image->row0;
+
+	    // assign the x and y coords to the image center
+	    // create an object with center intensity of 1000
+	    modelRef->params->data.F32[PM_PAR_SKY] = 0;
+	    modelRef->params->data.F32[PM_PAR_I0] = 1000;
+	    modelRef->params->data.F32[PM_PAR_XPOS] = xc;
+	    modelRef->params->data.F32[PM_PAR_YPOS] = yc;
+    
+	    // create modelPSF from this model
+	    pmModel *model = pmModelFromPSF (modelRef, psf);
+
+	    // place the reference object in the image center
+	    // no need to mask the source here
+	    // XXX should we measure this for the analytical model only or the full model?
+	    pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, -x*DX, -y*DY);
+	    psFree (model);
+	}
+    }
+
+    psImage *psfLogFlux = (psImage *) psUnaryOp (NULL, psfMosaic, "log");
+    psphotVisualRangeImage (kapa2, psfLogFlux, "psf_mosaic", 1, -2.0, 3.0);
+
+    psFree (psfMosaic);
+    psFree (psfLogFlux);
+
+    // pause and wait for user input:
+    // continue, save (provide name), ??
+    char key[10];
+    fprintf (stdout, "[c]ontinue? ");
+    if (!fgets(key, 8, stdin)) {
+	psWarning("Unable to read option");
+    }
+    return true;
+}
+
+bool psphotVisualShowPSFStars (psMetadata *recipe, pmPSF *psf, psArray *sources) {
+
+    bool status;
+
+    if (!isVisual) return true;
+
+    if (kapa2 == -1) {
+        kapa2 = KapaOpenNamedSocket ("kapa", "psphot:psfstars");
+	if (kapa2 == -1) {
+	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
+	    isVisual = false;
+	    return false;
+	}
+    }  
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
@@ -822,8 +886,14 @@
     psFree (outpos);
     psFree (outsub);
-    return true;
-}
-
-bool psphotVisualShowSatStars (pmConfig *config, const pmFPAview *view, pmPSF *psf, psArray *sources) {
+
+
+    // after displaying (as an image) the psf stars, we cycle throught them and display their
+    // radial profiles:
+    psphotVisualPlotRadialProfiles (recipe, sources);
+
+    return true;
+}
+
+bool psphotVisualShowSatStars (psMetadata *recipe, pmPSF *psf, psArray *sources) {
 
     bool status;
@@ -839,11 +909,4 @@
 	}
     }  
-
-    // select the current recipe
-    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
-    if (!recipe) {
-        psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
-        return false;
-    }
 
     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
@@ -971,11 +1034,126 @@
 }
 
-bool psphotVisualShowPSFModel (pmConfig *config, pmReadout *readout, pmPSF *psf) {
+bool psphotVisualPlotRadialProfile (int myKapa, pmSource *source, psMaskType maskVal) {
+
+    Graphdata graphdata;
+
+    bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
+    psphotAddWithTest (source, true, maskVal); // replace source if subtracted
+
+    int nPts = source->pixels->numRows * source->pixels->numCols;
+    psVector *rg = psVectorAllocEmpty (nPts, PS_TYPE_F32);
+    psVector *Rg = psVectorAllocEmpty (nPts, PS_TYPE_F32);
+    psVector *fg = psVectorAllocEmpty (nPts, PS_TYPE_F32);
+    psVector *rb = psVectorAllocEmpty (nPts, PS_TYPE_F32);
+    psVector *Rb = psVectorAllocEmpty (nPts, PS_TYPE_F32);
+    psVector *fb = psVectorAllocEmpty (nPts, PS_TYPE_F32);
+
+    int ng = 0;
+    int nb = 0;
+    float Xo = source->modelPSF->params->data.F32[PM_PAR_XPOS] - source->pixels->col0;
+    float Yo = source->modelPSF->params->data.F32[PM_PAR_YPOS] - source->pixels->row0;
+    for (int iy = 0; iy < source->pixels->numRows; iy++) {
+	for (int ix = 0; ix < source->pixels->numCols; ix++) {
+	    if (source->maskObj->data.U8[iy][ix]) {
+		// rb->data.F32[nb] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
+		rb->data.F32[nb] = hypot (ix - Xo, iy - Yo) ;
+		Rb->data.F32[ng] = log10(rb->data.F32[nb]);
+		fb->data.F32[nb] = log10(source->pixels->data.F32[iy][ix]);
+		nb++;
+	    } else {
+		// rg->data.F32[ng] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
+		rg->data.F32[ng] = hypot (ix - Xo, iy - Yo) ;
+		Rg->data.F32[ng] = log10(rg->data.F32[ng]);
+		fg->data.F32[ng] = log10(source->pixels->data.F32[iy][ix]);
+		ng++;
+	    }
+	}
+    }
+  
+    // reset source Add/Sub state to recorded
+    psphotSetState (source, state, maskVal); 
+
+    KapaInitGraph (&graphdata);
+
+    // ** linlog **
+    KapaSelectSection (myKapa, "linlog");
+
+    // examine sources to set data range
+    graphdata.xmin =  -0.05;
+    graphdata.xmax = +30.05;
+    graphdata.ymin = -0.05;
+    graphdata.ymax = +5.05;
+    KapaSetLimits (myKapa, &graphdata);
+  
+    KapaSetFont (myKapa, "helvetica", 14);
+    KapaBox (myKapa, &graphdata);
+    KapaSendLabel (myKapa, "radius (pixels)", KAPA_LABEL_XM);
+    KapaSendLabel (myKapa, "log flux (counts)", KAPA_LABEL_YM);
+	       
+    graphdata.color = KapaColorByName ("black");
+    graphdata.ptype = 2;
+    graphdata.size = 0.5;
+    graphdata.style = 2;
+    KapaPrepPlot (myKapa, ng, &graphdata);
+    KapaPlotVector (myKapa, ng, rg->data.F32, "x");
+    KapaPlotVector (myKapa, ng, fg->data.F32, "y");
+
+    graphdata.color = KapaColorByName ("red");
+    graphdata.ptype = 0;
+    graphdata.size = 0.3;
+    graphdata.style = 2;
+    KapaPrepPlot (myKapa, nb, &graphdata);
+    KapaPlotVector (myKapa, nb, rb->data.F32, "x");
+    KapaPlotVector (myKapa, nb, fb->data.F32, "y");
+  
+    // ** loglog **
+    KapaSelectSection (myKapa, "loglog");
+
+    // examine sources to set data range
+    graphdata.xmin = -1.51;
+    graphdata.xmax = +1.51;
+    graphdata.ymin = -0.05;
+    graphdata.ymax = +5.05;
+    KapaSetLimits (myKapa, &graphdata);
+  
+    KapaSetFont (myKapa, "helvetica", 14);
+    KapaBox (myKapa, &graphdata);
+    KapaSendLabel (myKapa, "log radius (pixels)", KAPA_LABEL_XM);
+    KapaSendLabel (myKapa, "log flux (counts)", KAPA_LABEL_YM);
+	       
+    graphdata.color = KapaColorByName ("black");
+    graphdata.ptype = 2;
+    graphdata.size = 0.5;
+    graphdata.style = 2;
+    KapaPrepPlot (myKapa, ng, &graphdata);
+    KapaPlotVector (myKapa, ng, Rg->data.F32, "x");
+    KapaPlotVector (myKapa, ng, fg->data.F32, "y");
+
+    graphdata.color = KapaColorByName ("red");
+    graphdata.ptype = 0;
+    graphdata.size = 0.3;
+    graphdata.style = 2;
+    KapaPrepPlot (myKapa, nb, &graphdata);
+    KapaPlotVector (myKapa, nb, Rb->data.F32, "x");
+    KapaPlotVector (myKapa, nb, fb->data.F32, "y");
+
+    psFree (rg);
+    psFree (Rg);
+    psFree (fg);
+    psFree (rb);
+    psFree (Rb);
+    psFree (fb);
+    return true;
+}
+
+bool psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources) {
+
+    KapaSection section;  // put the positive profile in one and the residuals in another? 
 
     if (!isVisual) return true;
 
-    if (kapa2 == -1) {
-        kapa2 = KapaOpenNamedSocket ("kapa", "psphot:psfstars");
-	if (kapa2 == -1) {
+    if (kapa3 == -1) {
+        kapa3 = KapaOpenNamedSocket ("kapa", "psphot:plots");
+	if (kapa3 == -1) {
 	    fprintf (stderr, "failure to open kapa; visual mode disabled\n");
 	    isVisual = false;
@@ -984,77 +1162,57 @@
     }  
 
-    int DX = 64;
-    int DY = 64;
-
-    psImage *psfMosaic = psImageAlloc (3*DX, 3*DY, PS_TYPE_F32);
-    psImageInit (psfMosaic, 0.0);
-    
-    pmModel *modelRef = pmModelAlloc(psf->type);
-
-# if (1)
-    // generate a fake model at each of the 3x3 image grid positions
-    for (int x = -1; x <= +1; x ++) {
-	for (int y = -1; y <= +1; y ++) {
-	    // use the center of the center pixel of the image
-	    float xc = (0.5 + 0.45*x)*readout->image->numCols + readout->image->col0;
-	    float yc = (0.5 + 0.45*y)*readout->image->numRows + readout->image->row0;
-
-	    // assign the x and y coords to the image center
-	    // create an object with center intensity of 1000
-	    modelRef->params->data.F32[PM_PAR_SKY] = 0;
-	    modelRef->params->data.F32[PM_PAR_I0] = 1000;
-	    modelRef->params->data.F32[PM_PAR_XPOS] = xc;
-	    modelRef->params->data.F32[PM_PAR_YPOS] = yc;
-    
-	    // create modelPSF from this model
-	    pmModel *model = pmModelFromPSF (modelRef, psf);
-
-	    // place the reference object in the image center
-	    // no need to mask the source here
-	    // XXX should we measure this for the analytical model only or the full model?
-	    pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, -x*DX, -y*DY);
-	    psFree (model);
-	}
-    }
-# else
-    { 
-	// use the center of the center pixel of the image
-	float xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5;
-	float yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5;
-
-	// assign the x and y coords to the image center
-	// create an object with center intensity of 1000
-	modelRef->params->data.F32[PM_PAR_SKY] = 0;
-	modelRef->params->data.F32[PM_PAR_I0] = 1000;
-	modelRef->params->data.F32[PM_PAR_XPOS] = xc;
-	modelRef->params->data.F32[PM_PAR_YPOS] = yc;
-    
-	// create modelPSF from this model
-	pmModel *model = pmModelFromPSF (modelRef, psf);
-
-	// place the reference object in the image center
-	// no need to mask the source here
-	// XXX should we measure this for the analytical model only or the full model?
-	pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, 32.0, 16.0);
-    }
-# endif
-
-    psImage *psfLogFlux = (psImage *) psUnaryOp (NULL, psfMosaic, "log");
-    psphotVisualRangeImage (kapa2, psfLogFlux, "psf_mosaic", 1, -2.0, 3.0);
-
-    psFree (psfMosaic);
-    psFree (psfLogFlux);
-
-    // pause and wait for user input:
-    // continue, save (provide name), ??
-    char key[10];
-    fprintf (stdout, "[c]ontinue? ");
-    if (!fgets(key, 8, stdin)) {
-	psWarning("Unable to read option");
-    }
-    return true;
-}
-
-bool psphotVisualShowFlags (pmConfig *config, const pmFPAview *view, psArray *sources) {
+    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
+    bool status;
+    psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
+    assert (maskVal);
+
+    KapaClearPlots (kapa3);
+    // first section : mag vs CR nSigma
+    section.dx = 1.0;
+    section.dy = 0.5;
+    section.x = 0.0;
+    section.y = 0.0;
+    section.name = NULL;
+    psStringAppend (&section.name, "linlog");
+    KapaSetSection (kapa3, &section);
+    psFree (section.name);
+
+    // first section : mag vs CR nSigma
+    section.dx = 1.0;
+    section.dy = 0.5;
+    section.x = 0.0;
+    section.y = 0.5;
+    section.name = NULL;
+    psStringAppend (&section.name, "loglog");
+    KapaSetSection (kapa3, &section);
+    psFree (section.name);
+
+    // loop over the PSF stars
+    for (int i = 0; i < sources->n; i++) {
+
+        pmSource *source = sources->data[i];
+        if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
+
+	psphotVisualPlotRadialProfile (kapa3, source, maskVal);
+
+	// pause and wait for user input:
+	// continue, save (provide name), ??
+	char key[10];
+	fprintf (stdout, "[e]rase and continue? [o]verplot and continue? [s]kip rest of stars? : ");
+	if (!fgets(key, 8, stdin)) {
+	    psWarning("Unable to read option");
+	}
+	if (key[0] == 'e') {
+	    KapaClearPlots (kapa3);
+	}
+	if (key[0] == 's') {
+	    break;
+	}
+    }	    
+
+    return true;
+}
+
+bool psphotVisualShowFlags (psArray *sources) {
 
     int NoverlayE, NOVERLAYE;
@@ -1161,5 +1319,5 @@
 }
 
-bool psphotVisualShowSourceSize (pmConfig *config, const pmFPAview *view, psArray *sources) {
+bool psphotVisualShowSourceSize (psArray *sources) {
 
     int Noverlay, NOVERLAY;
@@ -1236,7 +1394,6 @@
 }
 
-bool psphotVisualPlotSourceSize (pmConfig *config, psArray *sources) {
-
-    bool status;
+bool psphotVisualPlotSourceSize (psArray *sources) {
+
     Graphdata graphdata;
     KapaSection section;
@@ -1252,11 +1409,4 @@
 	}
     }  
-
-    // select the current recipe
-    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
-    if (!recipe) {
-	fprintf (stderr, "missing recipe, skipping moments plot\n");
-        return false;
-    }
 
     KapaClearPlots (kapa3);
@@ -1387,5 +1537,5 @@
 }
 
-bool psphotVisualShowResidualImage (pmConfig *config, pmReadout *readout) {
+bool psphotVisualShowResidualImage (pmReadout *readout) {
 
     if (!isVisual) return true;
@@ -1412,7 +1562,6 @@
 }
 
-bool psphotVisualPlotApResid (pmConfig *config, psArray *sources) {
-
-    bool status;
+bool psphotVisualPlotApResid (psArray *sources) {
+
     Graphdata graphdata;
 
@@ -1427,11 +1576,4 @@
 	}
     }  
-
-    // select the current recipe
-    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
-    if (!recipe) {
-	fprintf (stderr, "missing recipe, skipping moments plot\n");
-        return false;
-    }
 
     KapaClearPlots (kapa3);
