IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33143


Ignore:
Timestamp:
Jan 24, 2012, 5:32:15 PM (14 years ago)
Author:
eugene
Message:

updates to test suite

File:
1 edited

Legend:

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

    r33139 r33143  
    2929  $CHIP_DX = 1000
    3030  $CHIP_DY = 1000
    31 end
    32 
    33 # create a populated catdir with a couple of cmf files
    34 macro test.relphot
    35   if ($0 != 3)
    36     echo "test.relphot (cmftype) (dvotype)"
    37     break
    38   end
    39 
    40   tapPLAN 4
    41 
    42   exec rm -rf catdir.test
    43 
    44   $RA = 10.0
    45   $DEC = 20.0
    46 
    47   for i 0 $offset:n
    48     mkinput test.in.txt $offset:$i
    49     exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1
    50     exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2
    51   end
    52 
    53   exec relphot -D CATDIR catdir.test r -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0 >& /dev/null
    54 
    55   catdir catdir.test
    56   skyregion {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0}
    57 
    58   imextract time Mcal
    59 
    60   for i 0 $offset:n
    61     tapOK {abs(Mcal[$i] - Mcal[0] - $offset:$i) < 0.001} "Mcal $i"
    62   end
    63 
    64   exec rm test.cmf test.in.txt
    65   exec rm -r catdir.test
    66 
    67   tapDONE
     31
     32  # we have two sets of images: ubercaled and not-ubercaled
     33
     34  # mjd and zpt values for ubercal'ed imaged
     35  create tmpseq 0 9
     36
     37  set zpt_uc = 25.0 + tmpseq*0.0050 - 0.0025
     38  set mjd_uc = zero(zpt_uc)
     39  mjd_uc[0] = 55000.01
     40  mjd_uc[1] = 55000.02
     41  mjd_uc[2] = 55000.03
     42
     43  mjd_uc[3] = 55015.01
     44  mjd_uc[4] = 55015.02
     45  mjd_uc[5] = 55015.03
     46
     47  mjd_uc[6] = 55025.01
     48  mjd_uc[7] = 55025.02
     49  mjd_uc[8] = 55025.03
     50
     51  # mjd and zpt values for not-ubercal'ed images
     52  set zpt_nc = 25.0 - tmpseq*0.0050 + 0.0025
     53  set mjd_nc = zero(zpt_nc)
     54  mjd_nc[0] = 55100.01
     55  mjd_nc[1] = 55100.02
     56  mjd_nc[2] = 55100.03
     57
     58  mjd_nc[3] = 55115.01
     59  mjd_nc[4] = 55115.02
     60  mjd_nc[5] = 55115.03
     61
     62  mjd_nc[6] = 55125.01
     63  mjd_nc[7] = 55125.02
     64  mjd_nc[8] = 55125.03
    6865end
    6966
     
    7471  end
    7572
    76   exec rm -rf $2
     73  local fileroot rootdir catdir
     74
     75  $fileroot = $1
     76  $catdir = $2
     77
     78  dirname $1 -var rootdir
     79  mkdir $rootdir
     80
     81  exec rm -rf $catdir
    7782
    7883  init
     
    8085  mkstars 500
    8186
    82   mkdir testdata
    83   mksequence $1 $2
     87  mksequence $fileroot $catdir
    8488end
    8589
    8690macro ckexposure
    87   if ($0 != 3)
    88     echo "ckexposure (catdir) (zpt)"
     91  if ($0 != 4)
     92    echo "ckexposure (catdir) (zpt) (mode)"
     93    echo "  mode == raw or corr"
    8994    break
    9095  end
     
    120125  subset dm11 = dm if (cell_xbin == 1) && (cell_ybin == 1)
    121126
    122   # mag_DVO  = m_inst + zpt_nominal
    123   # mag_real = m_inst + zpt_real + cell_offset
    124   # dm = mag_DVO - mag_real = zpt_nominal - zpt_real - cell_offset
    125   # <dm> - zpt_nominal + zpt_real + cell_offset ~ 0.0
    126   # zpt_real (in this case) = 25.0 (actually, it is the value in the vector 'zpt' for this entry
    127   # zpt_nominal = 24.58
    128   for ix 0 $NCELL_X
    129     for iy 0 $NCELL_Y
    130       # vstat -q dm$ix\$iy
    131       # echo cell_off[$ix][$iy] {$MEDIAN - $ZPT_NOMINAL + $ZPT_REAL + cell_off[$ix][$iy]} $MEDIAN $MEAN $SIGMA
    132 
    133       set dm_adjust = dm$ix\$iy - $ZPT_NOMINAL + $ZPT_REAL + cell_off[$ix][$iy]
    134       vstat dm_adjust
     127  # uncorrected values behave like this:
     128  #   mag_DVO  = m_inst + zpt_nominal
     129  #   mag_real = m_inst + zpt_real + cell_offset
     130  #   dm = mag_DVO - mag_real = zpt_nominal - zpt_real - cell_offset
     131  #   <dm> - zpt_nominal + zpt_real + cell_offset ~ 0.0
     132  #   zpt_real (in this case) = 25.0 (actually, it is the value in the vector 'zpt' for this entry
     133  #   zpt_nominal = 24.58
     134
     135  # setphot-corrected values behave like this:
     136  #   mag_DVO  = mag_real (because m_inst has cell_offset applied)
     137  #   dm = mag_DVO - mag_real ~ 0.0
     138
     139  if ("$3" == "raw")
     140    for ix 0 $NCELL_X
     141      for iy 0 $NCELL_Y
     142        # vstat -q dm$ix\$iy
     143        # echo cell_off[$ix][$iy] {$MEDIAN - $ZPT_NOMINAL + $ZPT_REAL + cell_off[$ix][$iy]} $MEDIAN $MEAN $SIGMA
     144 
     145        set dm_adjust = dm$ix\$iy - $ZPT_NOMINAL + $ZPT_REAL + cell_off[$ix][$iy]
     146        vstat dm_adjust
     147      end
    135148    end
     149  else
     150    vstat dm
    136151  end
    137152end
     
    145160  local i
    146161
    147   # we have defined a set of images by mjd and zero point
    148   # for i 0 mjd[]
     162  # we have defined a set of mjd and zero point values for ubercal'ed images
     163  # for i 0 mjd_uc[]
    149164  for i 0 1
    150     mkexposure $1.$i $RA_CENTER $DEC_CENTER zpt[$i] mjd[$i] g $2
     165    mkexposure $1.$i $RA_CENTER $DEC_CENTER zpt_uc[$i] mjd_uc[$i] g $2
     166  end
     167
     168  # we have a second set of mjd and zero point values for non-ubercal'ed images
     169  # for i 0 mjd_nc[]
     170  for i 0 1
     171    mkexposure $1.$i $RA_CENTER $DEC_CENTER zpt_nc[$i] mjd_nc[$i] g $2
    151172  end
    152173end
     
    180201    $ra  = $RAo  - $dx / 3600.0 / dcos($DECo)
    181202    $dec = $DECo - $dy / 3600.0
    182     echo $ra $dec $dx $dy
     203    # echo $ra $dec $dx $dy
    183204    mkinput test.in.txt $ra $dec $ZPT
    184205   
    185206    # ra,dec is the center of this chip
    186207    exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise -size $CHIP_DX $CHIP_DY -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY}
    187     echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise -size $CHIP_DX $CHIP_DY -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY}
     208    # echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy -no-noise -size $CHIP_DX $CHIP_DY -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY}
    188209   
    189210    # the fake images have inconsistent ra,dec and airmass,sidtime values
     
    271292  keyword phu TS0_0002 -wf 55020.0
    272293  keyword phu TS1_0002 -wf 55030.0
    273 
    274   # create 9 exposures, 3 per season
    275   create imageID 0 9
    276   set zpt = 25.0 + imageID*0.0050 - 0.0025
    277   set mjd = zero(zpt)
    278   mjd[0] = 55000.01
    279   mjd[1] = 55000.02
    280   mjd[2] = 55000.03
    281 
    282   mjd[3] = 55015.01
    283   mjd[4] = 55015.02
    284   mjd[5] = 55015.03
    285 
    286   mjd[6] = 55025.01
    287   mjd[7] = 55025.02
    288   mjd[8] = 55025.03
    289294
    290295  # create a single flat-field correction map for a single chip
     
    319324  end
    320325
    321   set mjd_obs = mjd
    322   set zp = zpt
    323   set resid = 0.02*rnd(zpt) - 0.01
     326  # the output fits table uses the vector names for the field names,
     327  # so set them here to the desired names
     328  set mjd_obs = mjd_uc
     329  set zp = zpt_uc
     330  set resid = 0.02*rnd(zpt_uc) - 0.01
    324331
    325332  delete -q flatcorr
     
    330337  # filter 1
    331338  write testzpt.fits -fits ZPTS_1 -f DDE -append mjd_obs zp resid
    332   keyword flatcorr FILTER -ws g
     339  keyword flatcorr FILTER -w g
    333340  keyword flatcorr EXTNAME -w FLATCORR
    334341  wd -extend flatcorr testzpt.fits
     
    336343  # filter 2 (?)
    337344  write testzpt.fits -fits ZPTS_2 -f DDE -append mjd_obs zp resid
    338   keyword flatcorr FILTER -ws r
     345  keyword flatcorr FILTER -w r
    339346  keyword flatcorr EXTNAME -w FLATCORR
    340347  wd -extend flatcorr testzpt.fits
     
    342349  # filter 3
    343350  write testzpt.fits -fits ZPTS_3 -f DDE -append mjd_obs zp resid
    344   keyword flatcorr FILTER -ws i
     351  keyword flatcorr FILTER -w i
    345352  keyword flatcorr EXTNAME -w FLATCORR
    346353  wd -extend flatcorr testzpt.fits
    347354end
     355
     356# create a populated catdir with a couple of cmf files
     357macro test.relphot
     358  if ($0 != 3)
     359    echo "test.relphot (cmftype) (dvotype)"
     360    break
     361  end
     362
     363  tapPLAN 4
     364
     365  exec rm -rf catdir.test
     366
     367  $RA = 10.0
     368  $DEC = 20.0
     369
     370  for i 0 $offset:n
     371    mkinput test.in.txt $offset:$i
     372    exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1
     373    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2
     374  end
     375
     376  exec relphot -D CATDIR catdir.test r -region {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0} -update -nloop 10.0 >& /dev/null
     377
     378  catdir catdir.test
     379  skyregion {$RA-1.0} {$RA+1.0} {$DEC-1.0} {$DEC+1.0}
     380
     381  imextract time Mcal
     382
     383  for i 0 $offset:n
     384    tapOK {abs(Mcal[$i] - Mcal[0] - $offset:$i) < 0.001} "Mcal $i"
     385  end
     386
     387  exec rm test.cmf test.in.txt
     388  exec rm -r catdir.test
     389
     390  tapDONE
     391end
     392
Note: See TracChangeset for help on using the changeset viewer.