Index: /branches/eam_branches/ipp-20130509/psphot/test/tap_psphot_galaxies.pro
===================================================================
--- /branches/eam_branches/ipp-20130509/psphot/test/tap_psphot_galaxies.pro	(revision 35649)
+++ /branches/eam_branches/ipp-20130509/psphot/test/tap_psphot_galaxies.pro	(revision 35650)
@@ -13,31 +13,58 @@
 
 # basic options for the these images (filter, location, obstype)
-$BaseOptions = -type OBJECT -filter r -skymags 20.86 -ra 270.70 -dec -23.70 -pa 0.0
-$BaseOptions = $BaseOptions -Df PSASTRO:DVO.GETSTAR.MAX.RHO 50000.0
+$BaseOptions = -type OBJECT 
+$BaseOptions = $BaseOptions -filter r 
+$BaseOptions = $BaseOptions -skymags 20.86 
+$BaseOptions = $BaseOptions -ra 270.70 
+$BaseOptions = $BaseOptions -dec -23.70 
+$BaseOptions = $BaseOptions -pa 0.0
+# $BaseOptions = $BaseOptions -Df PSASTRO:DVO.GETSTAR.MAX.RHO 50000.0
 
 # options for the reference image
-$RefOptions = $BaseOptions -exptime 100.0 -seeing 1.0 -D PSF.MODEL PS_MODEL_GAUSS -Df STARS.DENSITY 10.0 -Df STARS.SIGMA.LIM 0.5
-
-# options for the repeated images
-$FakeOptions = $BaseOptions -exptime 30.0
+$RefOptions = $BaseOptions 
+$RefOptions = $RefOptions -exptime 100.0
+$RefOptions = $RefOptions -seeing 1.0
+$RefOptions = $RefOptions -D PSF.MODEL PS_MODEL_GAUSS
+$RefOptions = $RefOptions -Df STARS.DENSITY 10.0
+$RefOptions = $RefOptions -Df STARS.SIGMA.LIM 0.5
+
+# options for the simulated images (using the refimage for the stars)
+$FakeOptions = $BaseOptions
+$FakeOptions = $FakeOptions -exptime 30.0
+$FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS
   
+# sample alternate options:
+# $FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_PS1_V1
+# $FakeOptions = $FakeOptions -Df PSF.ARATIO 1.2
+# $FakeOptions = $FakeOptions -Df PSF.THETA +30.0
+
+# create an image with fake sources (these are then inserted into the catdir)
+$RefConfig = -camera SIMTEST
+$RefConfig = $RefConfig -recipe PPSIM STACKTEST.MAKE
+
 # basic config for ppSim with randomly distributed stars and gridded galaxies
-$RealConfig = -camera SIMTEST -recipe PPSIM STACKTEST.RUN -D PSASTRO:PSASTRO.CATDIR catdir.ref
-$RealConfig = $RealConfig -Db STARS.FAKE F -Db MATCH.DENSITY F -Db PSF.CONVOLVE T
-$RealConfig = $RealConfig -Db GALAXY.FAKE T -Df GALAXY.MAG 17.0
-$RealConfig = $RealConfig -Db GALAXY.GRID T -D GALAXY.MODEL PS_MODEL_SERSIC
-$RealConfig = $RealConfig -Df GALAXY.ARATIO.MIN 0.5
-$RealConfig = $RealConfig -Df GALAXY.ARATIO.MAX 0.5
-$RealConfig = $RealConfig -Df GALAXY.THETA.MAX 180
-$RealConfig = $RealConfig -Df GALAXY.INDEX.MIN 1
-$RealConfig = $RealConfig -Df GALAXY.INDEX.MAX 1
-$RealConfig = $RealConfig -Di GALAXY.GRID.DX 120
-$RealConfig = $RealConfig -Di GALAXY.GRID.DY 120
-
-# sample alternate options:
-# $ppSimOptions = $FakeOptions -D PSF.MODEL PS_MODEL_PS1_V1
-# $ppSimOptions = $FakeOptions -Df PSF.ARATIO 1.2
-# $ppSimOptions = $FakeOptions -Df PSF.THETA +30.0
-$ppSimOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS
+$FakeConfig = -camera SIMTEST
+$FakeConfig = $FakeConfig -recipe PPSIM STACKTEST.RUN
+$FakeConfig = $FakeConfig -D PSASTRO:PSASTRO.CATDIR catdir.ref
+$FakeConfig = $FakeConfig -Db STARS.FAKE F                         ; # only use stars from catdir.ref
+$FakeConfig = $FakeConfig -Db MATCH.DENSITY F
+$FakeConfig = $FakeConfig -Db PSF.CONVOLVE T
+$FakeConfig = $FakeConfig -Db GALAXY.FAKE T                        ; # generate a "realistic" distribution of galaxies
+$FakeConfig = $FakeConfig -Df GALAXY.MAG 17.0
+$FakeConfig = $FakeConfig -Db GALAXY.GRID T                        ; # generate a grid of galaxies (constant mag)
+#$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_GAUSS
+$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_EXP
+#$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_SERSIC
+#$FakeConfig = $FakeConfig -D GALAXY.MODEL PS_MODEL_DEV
+$FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MIN 10.0
+$FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MAX 10.0
+$FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MIN 0.5
+$FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MAX 0.5
+$FakeConfig = $FakeConfig -Df GALAXY.THETA.MIN 0 
+$FakeConfig = $FakeConfig -Df GALAXY.THETA.MAX 180
+$FakeConfig = $FakeConfig -Df GALAXY.INDEX.MIN 1
+$FakeConfig = $FakeConfig -Df GALAXY.INDEX.MAX 1
+$FakeConfig = $FakeConfig -Di GALAXY.GRID.DX 120
+$FakeConfig = $FakeConfig -Di GALAXY.GRID.DY 120
 
 list fwhm 
@@ -53,7 +80,5 @@
   exec rm -f refimage.fits
   
-  # create an image with fake sources and insert the resulting cmf file into a dvodb
-  $RefConfig = -camera SIMTEST -recipe PPSIM STACKTEST.MAKE -D PSASTRO:PSASTRO.CATDIR catdir.ref
-
+  echo ppSim $RefOptions $RefConfig refimage
   exec ppSim $RefOptions $RefConfig refimage
   
@@ -64,5 +89,5 @@
   end
 
-  exec addstar -D CAMERA simtest -D CATDIR catdir.ref -accept-astrom -photcode SYNTH.r -D PHOTCODE_FILE synth.photcodes refimage.cmf
+  exec addstar -D CAMERA simtest -D CATDIR catdir.ref -accept-astrom -photcode SYNTH.r -D PHOTCODE_FILE synth.photcodes refimage.cmf -quick-airmass
   exec relphot -averages -D CATDIR catdir.ref -update -region 260 280 -33 -13
 end
@@ -80,18 +105,11 @@
 
   # create the raw image
-  echo ppSim $ppSimOptions $RealConfig $basename -seeing $fwhm
-  exec ppSim $ppSimOptions $RealConfig $basename -seeing $fwhm
+  echo ppSim $FakeOptions $FakeConfig $basename -seeing $fwhm
+  exec ppSim $FakeOptions $FakeConfig $basename -seeing $fwhm
   exec /bin/mv -f $basename.cmf $basename.in.cmf
 
   # create the chip output
-  echo ppImage $ppImageConfig -file $basename.fits $basename
-  exec ppImage $ppImageConfig -file $basename.fits $basename
-
-  # XXX pswarp is using all 7k+ sources to measure the PSF : can we reduce this?
-  ## echo pswarp -threads 4 -astrom $basename.cmf -file $basename.ch.fits -mask $basename.ch.mk.fits -variance $basename.ch.wt.fits $basename.wrp refimage.fits
-  ## exec pswarp -threads 4 -astrom $basename.cmf -file $basename.ch.fits -mask $basename.ch.mk.fits -variance $basename.ch.wt.fits $basename.wrp refimage.fits
-  ## 
-  ## echo psphot -file $basename.wrp.fits -mask $basename.wrp.mask.fits -variance $basename.wrp.wt.fits  $basename.wrp.pht
-  ## exec psphot -file $basename.wrp.fits -mask $basename.wrp.mask.fits -variance $basename.wrp.wt.fits  $basename.wrp.pht
+  #echo ppImage $ppImageConfig -file $basename.fits $basename
+  #exec ppImage $ppImageConfig -file $basename.fits $basename
 end
 
