Index: /branches/eam_branches/ipp-20130904/psphot/test/tap_psphot_galaxygrid.pro
===================================================================
--- /branches/eam_branches/ipp-20130904/psphot/test/tap_psphot_galaxygrid.pro	(revision 36315)
+++ /branches/eam_branches/ipp-20130904/psphot/test/tap_psphot_galaxygrid.pro	(revision 36316)
@@ -86,4 +86,5 @@
 end
 
+if (not($?CONVOLVE_NSIGMA)) set CONVOLVE_NSIGMA = 5.0
 
 # generate fake images and run psphot on them
@@ -117,4 +118,5 @@
   $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MIN 1.0
   $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MAX 1.0
+  $FakeConfig = $FakeConfig -Df CONVOLVE.NSIGMA $CONVOLVE_NSIGMA 
   $BaseConfig = $FakeConfig
 
@@ -582,4 +584,6 @@
 end
 
+if (not($?NSIGMA_CONV)) set NSIGMA_CONV = 5.0
+
 # create a realistic distribution of fake stars, GAUSS PSF
 macro fitexp
@@ -607,5 +611,7 @@
   $psphotConfig = $psphotConfig -Db PSPHOT:POISSON.ERRORS.PHOT.LMM F
   $psphotConfig = $psphotConfig -Db PSPHOT:EXTENDED_SOURCE_FITS_POISSON F
-   $psphotConfig = $psphotConfig -Di PSPHOT:EXT_FIT_ITER 40
+  $psphotConfig = $psphotConfig -Di PSPHOT:EXT_FIT_ITER 20
+  $psphotConfig = $psphotConfig -Df PSPHOT:PSF_FIT_RADIUS_SCALE 3.75
+  $psphotConfig = $psphotConfig -Df PSPHOT:EXT_FIT_NSIGMA_CONV $NSIGMA_CONV
 
   # ppImage / psphot on the output
@@ -1340,2 +1346,68 @@
   echo $mag_off $rad_off
 end
+
+macro make.circles
+
+  delete Xo Yo Ro
+
+  for ix 0 16
+    for iy $ix 16
+      $r2 = $ix^2 + $iy^2
+      if ($r2 > 15^2) continue
+      concat $ix Xo
+      concat $iy Yo
+      concat $r2 Ro
+    end
+  end
+
+  sort Ro Xo Yo
+  $Rold = -1
+  $N = -1
+  for i 0 Ro[]
+    if (Ro[$i] != $Rold)
+      $N ++
+      $Rold = Ro[$i]
+    end
+    if ((Xo[$i] == 0) && (Yo[$i] == 0))
+      fprintf "// center is 0,0"
+      continue
+    end
+    if (Xo[$i] == 0)
+      fprintf "ADD_AXIS (%3d, %2d)     // r^2 = %3d" $N Yo[$i] Ro[$i]
+      continue
+    end
+    if (Xo[$i] == Yo[$i])
+      fprintf "ADD_DIAG (%3d, %2d)     // r^2 = %3d" $N Xo[$i] Ro[$i]
+      continue
+    end
+
+    fprintf "ADD_RAND (%3d, %2d, %2d) // r^2 = %3d" $N Xo[$i] Yo[$i] Ro[$i]
+ end
+end
+
+macro run.convolve.loop
+  local radius
+
+  $radius = 3.0
+
+  foreach Cin 3 5 7 9 11
+    $CONVOLVE_NSIGMA = $Cin
+    sprintf nameIn tests.20131120/test.nsig.%02d $Cin
+    mkexp.devexp.single $nameIn EXP $radius 1.0
+    foreach Cot 3 5 7 9 11
+      $NSIGMA_CONV = $Cot
+      sprintf nameOt tests.20131120/test.nsig.%02d.%02d $Cin $Cot
+      fitexp $nameIn $nameOt EXP_CONV
+    end
+  end
+
+  foreach Cin 3 5 7 9 11
+    sprintf nameIn tests.20131120/test.nsig.%02d $Cin
+    foreach Cot 3 5 7 9 11
+      sprintf nameOt tests.20131120/test.nsig.%02d.%02d $Cin $Cot
+      check.fit $nameIn.dat $nameOt.cmf 
+    end
+  end
+  grid.plots.devexp a
+end
+
