IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33281


Ignore:
Timestamp:
Feb 16, 2012, 6:27:18 AM (14 years ago)
Author:
eugene
Message:

working on relphot.parallel test set (need to have solid relphot tests first)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.parallel.dvo

    r33276 r33281  
    9898  mkstars 500
    9999
    100   tapPLAN {((mjd_nc[]*4 + mjd_nc[]) + mjd_nc[]) / 3}
     100  tapPLAN {((mjd_nc[]*4 + mjd_nc[]) + mjd_nc[])}
    101101
    102102  # generate the basic images and check they were correctly ingested by dvo
    103103  mksequence $fileroot $catdir
    104   for i 0 mjd_nc[] 3
    105     ckexposure catdir.test mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
     104  for i 0 mjd_nc[]
     105    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
    106106  end
    107107
    108108  # run relphot on the db and check that the images now match the expected values
    109   exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR catdir.test -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& tmp.log
    110   for i 0 mjd_nc[] 3
    111     ckexposure catdir.test mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot
     109  exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& tmp.log
     110
     111  for i 0 mjd_nc[]
     112    # XXX this is a little ill-defined : if we run relphot with no tied down data, we should convert
     113    # on a solution with zero points matching the mean zp of photometric data (hence the choice of element
     114    # 1 in the zpt_nc[] array below.
     115    ckexposure $catdir mjd_nc[$i] zpt_nc[1] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
     116    # ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw
    112117  end
    113118
    114119  tapDONE
    115120end
    116 
    117 # go testdata/t1 catdir.test
    118 # ckexposure catdir.test mjd_uc[0] zpt_uc[0] raw : result is mean of 0.0 (since test corrects for ZPT_NOMINAL vs REAL)
    119 # ckexposure catdir.test mjd_nc[0] zpt_nc[0] raw : result is mean of 0.0
    120 # setphot -update -ubercal testzpt.fits -D CATDIR catdir.test
    121 # ckexposure catdir.test mjd_uc[0] zpt_uc[0] corr : result is mean of 0.0 (since image is corrected to ZPT_REAL)
    122 # ckexposure catdir.test mjd_nc[0] zpt_nc[0] corr : result is mean of -0.42 (since image is NOT corrected to ZPT_REAL)
    123 # relphot g -region 9.5 10.5 19.5 20.5 -update -D CATDIR catdir.test -D STAR_TOOFEW 1 -D SIGMA_LIM 0.075 -statmode MEAN
    124 # dvo: ckexposure catdir.test mjd_uc[0] zpt_uc[0] corr
    125 #  mean is now -0.42
    126 # dvo: ckexposure catdir.test mjd_nc[0] zpt_nc[0] corr
    127 #  mean is now -0.42
    128 #  ** setphot assigned the zero point of the uc exposure to an effective -0.4 (ie, negative clouds), relphot was not told to keep this so it dragged the negative clouds to 0.0 -- this seems to be the right thing to do
    129 
    130 # re-run setphot, then relphot with -keep-ubercal
    131 
    132 # the test case has only 2 exposures, so the STAR_TOOFEW of 1 is necessary.  Also, the mag and sigma distributions are somewhat artificial
    133 # relphot g -v -region 9.5 10.5 19.5 20.5 -D CATDIR catdir.test -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update
    134 # dvo: ckexposure catdir.test mjd_uc[0] zpt_uc[0] corr
    135 #  mean is now 0.0
    136 # dvo: ckexposure catdir.test mjd_nc[0] zpt_nc[0] corr
    137 #  mean is now 0.0
    138 #  ** setphot correctly assigned the zero point of UC & relphot adjusted NC to match
    139121
    140122macro ckexposure
     
    174156  skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2}
    175157  mextract ra dec mag xccd yccd where (abs(time - $MJD_IMAGE) < 0.0001)
    176  
     158  if (not(ra[]))
     159    echo "no matching data for MJD = $MJD_IMAGE"
     160    if ("$MODE" == "raw")
     161      tapSKIP 4
     162    else
     163      tapSKIP 1
     164    end
     165    return
     166  end
    177167  match2d -closest ra dec stars_ra stars_dec 0.001 -index1 index1 -index2 index2
    178168
     
    180170  reindex stars_dec_m = stars_dec using index1
    181171  reindex stars_mag_m = stars_mag using index1
     172  if (ra[]  != stars_ra_m[])
     173    echo "failed to match stars in catdir to stars in memory"
     174    break
     175  end
    182176  set dr = 3600*(ra - stars_ra_m)
    183177  set dd = 3600*(dec - stars_dec_m)
     
    185179
    186180  if ($PLOT)
     181    dev -n 0
     182    cplot -pt 7 -c red ra dec
    187183    dev -n 1
    188184    lim mag dm; clear; box; plot mag dm
     
    210206
    211207  $ZPT_REAL_NORM = $ZPT_REAL - 2.5*log($EXPTIME) - $KLAM_NOMINAL*($AIRMASS - 1.0)
     208  echo "$ZPT_REAL_NORM = $ZPT_REAL - 2.5*log($EXPTIME) - $KLAM_NOMINAL*($AIRMASS - 1.0)"
    212209
    213210  if ("$MODE" == "raw")
     
    219216        set dm_adjust = dm$ix\$iy - $ZPT_NOMINAL + $ZPT_REAL_NORM
    220217        vstat -q dm_adjust
    221         tapOK {abs($MEAN) < 0.005} "addstar raw ZP $MJD_IMAGE $FILTER"
     218        tapOK {abs($MEAN) < 0.005} "addstar raw ZP $MJD_IMAGE $FILTER : $MEAN $ZPT_NOMINAL $ZPT_REAL_NORM {($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM)}"
    222219      end
    223220    end
     
    227224  if ("$MODE" == "setphot_uc")
    228225    vstat -q dm
    229     tapOK {abs($MEAN) < 0.005} "setphot_uc  ZP $MJD_IMAGE $FILTER"
     226    tapOK {abs($MEAN) < 0.005} "setphot_uc  ZP $MJD_IMAGE $FILTER : $MEAN $ZPT_NOMINAL $ZPT_REAL_NORM {($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM)}"
    230227    return
    231228  end
     
    233230  if ("$MODE" == "setphot_nc")
    234231    vstat -q dm
    235     tapOK {abs($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM) < 0.005} "setphot_nc  ZP $MJD_IMAGE $FILTER"
     232    tapOK {abs($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM) < 0.005} "setphot_nc  ZP $MJD_IMAGE $FILTER : $MEAN $ZPT_NOMINAL $ZPT_REAL_NORM {($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM)}"
    236233    return
    237234  end
     
    239236  if ("$MODE" == "relphot_nc")
    240237    vstat -q dm
    241     tapOK {abs($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM) < 0.005} "setphot_nc  ZP $MJD_IMAGE $FILTER"
     238    tapOK {abs($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM) < 0.005} "setphot_nc  ZP $MJD_IMAGE $FILTER : $MEAN $ZPT_NOMINAL $ZPT_REAL_NORM {($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM)}"
    242239    return
    243240  end
     
    245242  if ("$MODE" == "relphot")
    246243    vstat -q dm
    247     tapOK {abs($MEAN) < 0.005} "relphot    ZP $MJD_IMAGE $FILTER"
     244    tapOK {abs($MEAN) < 0.005} "relphot    ZP $MJD_IMAGE $FILTER : $MEAN $ZPT_NOMINAL $ZPT_REAL_NORM {($MEAN - $ZPT_NOMINAL + $ZPT_REAL_NORM)}"
    248245    return
    249246  end
     
    257254  end
    258255
    259   local i
    260 
     256  local i T1 T2
     257
     258  ctimes -abs now -var T1
    261259  # we have a second set of mjd and zero point values for non-ubercal'ed images
    262   # for i 0 mjd_nc[]
    263   for i 0 mjd_nc[] 3
     260  for i 0 mjd_nc[]
    264261    mkexposure $1.nc.$i $RA_CENTER $DEC_CENTER zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] mjd_nc[$i] $filt_nc:$i $2
    265262  end
     263  ctimes -abs now -var T2
     264  echo "elapsed: {86400*($T2 - $T1)}"
    266265end
    267266
     
    294293    $dec = $DECo - $dy / 3600.0
    295294    # echo $ra $dec $dx $dy
     295    echo mkinput test.in.txt $ra $dec $ZPT
    296296    mkinput test.in.txt $ra $dec $ZPT
     297    # costs 7/36 sec / chip
    297298   
    298299    # ra,dec is the center of this chip
     
    310311    exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf $options
    311312    echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf $options
    312    
     313    # costs 8/36 sec / chip
     314
    313315    # the fake images have inconsistent ra,dec and airmass,sidtime values
    314316    echo addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass
    315     exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& tmp.log
     317    exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& /dev/null
     318    # costs 10/36 sec / chip
    316319  end
    317320 end
     
    342345  set cell_y = int(stars_y / ($CHIP_DX / $NCELL_X))
    343346
    344   # eddie says: M_real = M_inst + zpt + ff_offset
    345   # thus, stars_mi = stars_mag - zpt - ff_offset = stars_m - offset
    346   set stars_mi = zero(stars_m)
    347   for i 0 stars_mi[]
    348     $nx = cell_x[$i]
    349     $ny = cell_y[$i]
    350     $offset = 0.0
    351     stars_mi[$i] = stars_m[$i] - $offset
    352   end
    353 
     347  if (1)
     348    # FLAT-FIELD CORRECTION
     349    # eddie says: M_real = M_inst + zpt + ff_offset
     350    # thus, stars_mi = stars_mag - zpt - ff_offset = stars_m - offset
     351    set stars_mi = zero(stars_m)
     352    for i 0 stars_mi[]
     353      $nx = cell_x[$i]
     354      $ny = cell_y[$i]
     355      # $offset = cell_off[$nx][$ny]
     356      $offset = 0.0
     357      stars_mi[$i] = stars_m[$i] - $offset
     358    end
     359  else
     360    set stars_mi = stars_m
     361  end
     362 
     363  # delete the output file before writing
     364  exec rm -f $1
    354365  write -f "%10.6f %10.6f %7.3f  %6.1f %6.1f %7.3f" $1 stars_r stars_d stars_mr stars_x stars_y stars_mi
    355366end
Note: See TracChangeset for help on using the changeset viewer.