IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30210


Ignore:
Timestamp:
Jan 7, 2011, 9:57:48 AM (15 years ago)
Author:
eugene
Message:

add/update test suites

Location:
branches/eam_branches/ipp-20101205/psphot/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psphot/test/tap_psphot_stack.pro

    r30202 r30210  
    11#!/usr/bin/env mana
     2# -*-sh-*-
    23
    34# config for ppImage to generate chip, mask, weight
     
    3435$RealConfig = $RealConfig -Di GALAXY.GRID.DY 120
    3536
     37# sample alternate options:
     38# $ppSimOptions = $FakeOptions -D PSF.MODEL PS_MODEL_PS1_V1
     39# $ppSimOptions = $FakeOptions -Df PSF.ARATIO 1.2
     40# $ppSimOptions = $FakeOptions -Df PSF.THETA +30.0
     41$ppSimOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS
     42
    3643list fwhm
    3744 1.0
     
    3946 1.2
    4047 1.5
     48end
     49
     50macro fulltest
     51  if ($0 != 2)
     52    echo "USAGE: fulltest (Npass)"
     53    break
     54  end
     55
     56  mkref
     57
     58  local i Npass imname stname
     59
     60  $Npass = $1
     61
     62  $imname = image.fg
     63  $stname = stack.fg
     64
     65  for i 0 $Npass
     66    sprintf N "%02d" $i
     67    onestack $N
     68  end
     69end
     70
     71macro summary.stats
     72  if ($0 != 2)
     73    echo "USAGE: summary.stats (Npass)"
     74    break
     75  end
     76
     77  local i Npass base stack imname stname
     78
     79  $Npass = $1
     80
     81  exec /bin/rm -f psf.image.summary.stats
     82  exec /bin/rm -f psf.stack.inputs.summary.stats
     83  exec /bin/rm -f psf.stack.conv.summary.stats
     84  exec /bin/rm -f psf.stack.unconv.summary.stats
     85
     86  $imname = image.fg
     87  $stname = stack.fg
     88
     89  for i 0 $Npass
     90    sprintf base  "$imname.%02d/$imname.stats" $i
     91    sprintf stack "$stname.%02d/$stname" $i
     92    echo $i $base $stack
     93    exec grep PSF_INST_MAG $base                   >> psf.image.summary.stats
     94    exec grep PSF_INST_MAG $stack.conv.stats       >> psf.stack.inputs.summary.stats
     95    exec grep PSF_INST_MAG $stack.pht.stats        >> psf.stack.conv.summary.stats
     96    exec grep PSF_INST_MAG $stack.unconv.pht.stats >> psf.stack.unconv.summary.stats
     97  end
    4198end
    4299
     
    51108  exec ppSim $RefOptions $RefConfig refimage
    52109 
     110  file synth.photcodes found
     111  if (not($found))
     112    echo "making photcodes file"
     113    mkphotcodes synth.photcodes
     114  end
     115
    53116  exec addstar -D CAMERA simtest -D CATDIR catdir.ref -accept-astrom -photcode SYNTH.r -D PHOTCODE_FILE synth.photcodes refimage.cmf
    54117  exec relphot -averages -D CATDIR catdir.ref -update -region 260 280 -33 -13
    55118end
    56119
    57 macro go
    58   mkstack image.00 stack.fg/stack.00
    59   mkstack image.01 stack.fg/stack.01
    60   mkstack image.02 stack.fg/stack.02
    61   mkstack image.03 stack.fg/stack.03
    62 end
    63 
    64 macro onepass
     120macro onestack
    65121  if ($0 != 2)
    66     echo "USAGE: onepass (N)"
    67     break
    68   end
    69 
    70   mkstack image.fg.$1/image.fg stack.fg.$1/stack.fg
    71   ckstack image.fg.$1/image.fg stack.fg.$1/stack.fg
    72   rmstack image.fg.$1/image.fg stack.fg.$1/stack.fg
    73 end
    74 
    75 # create a realistic distribution of fake stars, GAUSS PSF
    76 macro mkexp
    77   if ($0 != 3)
    78     echo "USAGE: mkexp basename fwhm"
    79     break
    80   end
    81 
    82   local fwhm basename
    83   $basename = $1
    84   $fwhm = $2
    85 
    86   # create the raw image
    87   echo ppSim $ppSimOptions $RealConfig $basename -seeing $fwhm
    88   exec ppSim $ppSimOptions $RealConfig $basename -seeing $fwhm
    89   exec /bin/mv -f $basename.cmf $basename.in.cmf
    90 
    91   # create the chip output
    92   echo ppImage $ppImageConfig -file $basename.fits $basename
    93   exec ppImage $ppImageConfig -file $basename.fits $basename
    94 
    95   # XXX pswarp is using all 7k+ sources to measure the PSF : can we reduce this?
    96   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
    97   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
    98 
    99   echo psphot -file $basename.wrp.fits -mask $basename.wrp.mask.fits -variance $basename.wrp.wt.fits  $basename.wrp.pht
    100   exec psphot -file $basename.wrp.fits -mask $basename.wrp.mask.fits -variance $basename.wrp.wt.fits  $basename.wrp.pht
    101 end
    102 
    103 # run this on the files created with mkstack
    104 macro ckstack
    105   if ($0 != 3)
    106     echo "USAGE: mkstack (rawbase) (stackbase)"
    107     break
    108   end
    109 
    110   local i ZPT base stack
    111 
    112   $base = $1
    113   $stack = $2
    114 
    115   # generate plots and stats for the per-image chip analysis
    116   # and the psf-matched convolved images
    117   $ZPT = -2.5*log($fwhm:n)
    118   for i 0 $fwhm:n
    119     ckchip $base.$i.in.cmf $base.$i.cmf       $base.$i       0.0
    120     ckwarp $base.$i.in.cmf $stack.$i.conv.cmf $stack.$i.conv $ZPT
    121 
    122     stchip $base.$i.in.cmf $base.$i.cmf       $base.stats       0.0
    123     stwarp $base.$i.in.cmf $stack.$i.conv.cmf $stack.conv.stats $ZPT
    124 
    125     completeness $base.$i.in.cmf $base.$i.cmf $base.$i.complete.png
    126   end
    127 
    128   ckwarp $base.$i.in.cmf $stack.pht.cmf        $stack.pht        $ZPT
    129   ckwarp $base.$i.in.cmf $stack.unconv.pht.cmf $stack.unconv.pht $ZPT
    130 
    131   stwarp $base.$i.in.cmf $stack.pht.cmf        $stack.pht.stats  $ZPT
    132   stwarp $base.$i.in.cmf $stack.unconv.pht.cmf $stack.unconv.pht.stats $ZPT
     122    echo "USAGE: onestack (N)"
     123    break
     124  end
     125
     126  mkstack image.$1/image stack.$1/stack
     127  ckstack image.$1/image stack.$1/stack
     128  rmstack image.$1/image stack.$1/stack
    133129end
    134130
     
    150146  dirname $stack -var dir 
    151147  mkdir $dir
    152 
    153   # alternate options:
    154   # ppSim $ppSimOptions $RealConfig image.fg/image.fg.$i -seeing 1.000 -Df PSF.ARATIO 1.2 -Df PSF.THETA +30.0
    155   # $ppSimOptions = $FakeOptions -D PSF.MODEL PS_MODEL_PS1_V1 -- alternate PSF
    156   $ppSimOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS
    157148
    158149  exec echo "INPUT MULTI" > $stack.mdc
     
    191182end
    192183
     184# run this on the files created with mkstack
     185macro ckstack
     186  if ($0 != 3)
     187    echo "USAGE: mkstack (rawbase) (stackbase)"
     188    break
     189  end
     190
     191  local i ZPT base stack
     192
     193  $base = $1
     194  $stack = $2
     195
     196  # generate plots and stats for the per-image chip analysis
     197  # and the psf-matched convolved images
     198  $ZPT = -2.5*log($fwhm:n)
     199  for i 0 $fwhm:n
     200    ckchip $base.$i.in.cmf $base.$i.cmf       $base.$i       0.0
     201    ckwarp $base.$i.in.cmf $stack.$i.conv.cmf $stack.$i.conv $ZPT
     202
     203    stchip $base.$i.in.cmf $base.$i.cmf       $base.stats       0.0
     204    stwarp $base.$i.in.cmf $stack.$i.conv.cmf $stack.conv.stats $ZPT
     205
     206    completeness $base.$i.in.cmf $base.$i.cmf $base.$i.complete.png
     207  end
     208
     209  ckwarp $base.$i.in.cmf $stack.pht.cmf        $stack.pht        $ZPT
     210  ckwarp $base.$i.in.cmf $stack.unconv.pht.cmf $stack.unconv.pht $ZPT
     211
     212  stwarp $base.$i.in.cmf $stack.pht.cmf        $stack.pht.stats  $ZPT
     213  stwarp $base.$i.in.cmf $stack.unconv.pht.cmf $stack.unconv.pht.stats $ZPT
     214end
     215
    193216macro rmstack
    194217  if ($0 != 3)
     
    231254  exec rm -f $stack.unconv.num.fits
    232255  exec rm -f $stack.unconv.expwt.fits
     256end
     257
     258# create a realistic distribution of fake stars, GAUSS PSF
     259macro mkexp
     260  if ($0 != 3)
     261    echo "USAGE: mkexp basename fwhm"
     262    break
     263  end
     264
     265  local fwhm basename
     266  $basename = $1
     267  $fwhm = $2
     268
     269  # create the raw image
     270  echo ppSim $ppSimOptions $RealConfig $basename -seeing $fwhm
     271  exec ppSim $ppSimOptions $RealConfig $basename -seeing $fwhm
     272  exec /bin/mv -f $basename.cmf $basename.in.cmf
     273
     274  # create the chip output
     275  echo ppImage $ppImageConfig -file $basename.fits $basename
     276  exec ppImage $ppImageConfig -file $basename.fits $basename
     277
     278  # XXX pswarp is using all 7k+ sources to measure the PSF : can we reduce this?
     279  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
     280  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
     281
     282  echo psphot -file $basename.wrp.fits -mask $basename.wrp.mask.fits -variance $basename.wrp.wt.fits  $basename.wrp.pht
     283  exec psphot -file $basename.wrp.fits -mask $basename.wrp.mask.fits -variance $basename.wrp.wt.fits  $basename.wrp.pht
    233284end
    234285
     
    446497  end
    447498  label -y '$word:0' -x '$word:2'
    448 end
    449 
    450 macro show.dpair
    451   if ($0 != 2)
    452     echo "USAGE: show.dpair (N)"
    453     break
    454   end
    455 
    456   list word -split $dpairs:$1
    457   if ($word:n != 7)
    458     echo "invalid dpair $1"
    459     break
    460   end
    461 
    462   $Nr = $word:4
    463 
    464   reindex v1 = $word:0 using index1
    465   reindex dv = $word:1 using index1
    466   reindex v2 = $word:2 using index2
    467   reindex rv = $word:3 using index$Nr
    468 
    469   set delta = (v1 - v2) / dv
    470   if (("$word:5" == "def") || ("$word:6" == "def"))
    471     lim rv delta; box; plot rv delta
    472   else
    473     lim rv $word:5 $word:6; box; plot rv delta
    474   end
    475   label -y '$word:0' -x '$word:3'
    476 end
    477 
    478 # this list is used to compare a pair of vectors with an error it is
    479 # assumed that the vector sets have been loaded and matched with
    480 # match2d to generate index vectors 'index1' and index2'.  the macro
    481 # show.dpair generates a plot of the range vector vs (v1 - v2) / dv1.
    482 # The indices for v1, dv1, and v2 are index1,1, and 2 respectively.  The
    483 # index for the range vector is defined by the integer following that
    484 # vector.  The y-limits of the plot are given by the last two numbers
    485 # (use 'def') for the full default range of the delta vector
    486 list dpairs
    487   # v1              dv                v2   range
    488   X_PSF             X_PSF_SIG         Xraw Mraw  2 -10.0 10.0
    489   Y_PSF             Y_PSF_SIG         Yraw Mraw  2 -10.0 10.0
    490   PSF_INST_MAG      PSF_INST_MAG_SIG  Mraw Mraw  2 -10.0 10.0
    491   PSF_INST_FLUX     PSF_INST_FLUX_SIG Fraw Mraw  2 -10.0 10.0
    492   AP_MAG            PSF_INST_MAG_SIG  Mraw Mraw  2 -10.0 10.0
    493   AP_MAG_RAW        PSF_INST_MAG_SIG  Mraw Mraw  2 -10.0 10.0
    494499end
    495500
     
    687692 png -name $3
    688693end
     694
     695macro show.dpair
     696  if ($0 != 2)
     697    echo "USAGE: show.dpair (N)"
     698    break
     699  end
     700
     701  list word -split $dpairs:$1
     702  if ($word:n != 7)
     703    echo "invalid dpair $1"
     704    break
     705  end
     706
     707  $Nr = $word:4
     708
     709  reindex v1 = $word:0 using index1
     710  reindex dv = $word:1 using index1
     711  reindex v2 = $word:2 using index2
     712  reindex rv = $word:3 using index$Nr
     713
     714  set delta = (v1 - v2) / dv
     715  if (("$word:5" == "def") || ("$word:6" == "def"))
     716    lim rv delta; box; plot rv delta
     717  else
     718    lim rv $word:5 $word:6; box; plot rv delta
     719  end
     720  label -y '$word:0' -x '$word:3'
     721end
     722
     723# this list is used to compare a pair of vectors with an error it is
     724# assumed that the vector sets have been loaded and matched with
     725# match2d to generate index vectors 'index1' and index2'.  the macro
     726# show.dpair generates a plot of the range vector vs (v1 - v2) / dv1.
     727# The indices for v1, dv1, and v2 are index1,1, and 2 respectively.  The
     728# index for the range vector is defined by the integer following that
     729# vector.  The y-limits of the plot are given by the last two numbers
     730# (use 'def') for the full default range of the delta vector
     731list dpairs
     732  # v1              dv                v2   range
     733  X_PSF             X_PSF_SIG         Xraw Mraw  2 -10.0 10.0
     734  Y_PSF             Y_PSF_SIG         Yraw Mraw  2 -10.0 10.0
     735  PSF_INST_MAG      PSF_INST_MAG_SIG  Mraw Mraw  2 -10.0 10.0
     736  PSF_INST_FLUX     PSF_INST_FLUX_SIG Fraw Mraw  2 -10.0 10.0
     737  AP_MAG            PSF_INST_MAG_SIG  Mraw Mraw  2 -10.0 10.0
     738  AP_MAG_RAW        PSF_INST_MAG_SIG  Mraw Mraw  2 -10.0 10.0
     739end
     740
     741# if we run this test as a stand-alone program somewhere, we may need to create a local copy of the photcode file:
     742macro mkphotcodes
     743  if ($0 != 2)
     744    echo "USAGE: mkphotcodes (filename)"
     745    break
     746  end
     747
     748  exec /bin/rm -f $1
     749  output $1
     750  echo "#                                           airmass      color                         astrometry  mag    photom  astrom mask    photom mask"
     751  echo "# code  name                type    zero  slope offset c1    c2   slope   zero  equiv  sys scale   scale  sys     poor   bad     poor   bad"
     752  echo "  1     g_SYNTH              sec   0.000  0.000 0.000     1     3 0.0000     0    21   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     753  echo "  2     r_SYNTH              sec   0.000  0.000 0.000     2     3 0.0000     0    22   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     754  echo "  3     i_SYNTH              sec   0.000  0.000 0.000     2     3 0.0000     0    23   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     755  echo "  4     z_SYNTH              sec   0.000  0.000 0.000     3     4 0.0000     0    24   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     756  echo "  5     y_SYNTH              sec   0.000  0.000 0.000     4     5 0.0000     0    25   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     757  echo "  3001  SYNTH.g              ref   0.000  0.000 0.000     -     - 0.0000     0     1   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     758  echo "  3002  SYNTH.r              ref   0.000  0.000 0.000     -     - 0.0000     0     2   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     759  echo "  3003  SYNTH.i              ref   0.000  0.000 0.000     -     - 0.0000     0     3   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     760  echo "  3004  SYNTH.z              ref   0.000  0.000 0.000     -     - 0.0000     0     4   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     761  echo "  3005  SYNTH.y              ref   0.000  0.000 0.000     -     - 0.0000     0     5   0.000 0.000 0.000  0.000   0x0000 0x0000  0x0000 0x0000"
     762  output stdout
     763end
     764
     765if ($SCRIPT)
     766  fulltest 4
     767  exit 0
     768end
Note: See TracChangeset for help on using the changeset viewer.