IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42031


Ignore:
Timestamp:
Feb 9, 2022, 12:36:31 PM (4 years ago)
Author:
eugene
Message:

switch from label to data_group based queries; handle smf files with inconsistent extensions

Location:
branches/eam_branches/ipp-20211108/ippTests/ippCheck
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/cammask.pro

    r41975 r42031  
    66
    77# this module provides the following functions
    8 # get.camera.eff (camera) (expname) (camLabel) (refsrcs.fits) :
     8# get.camera.eff (camera) (expname) (camDgroup) (refsrcs.fits) :
    99# get.chip.detect.stats (chipname) (chipnseq)
    1010# get.chip.mask.stats (cammask)
    1111# get.chip.mask.files (camPath)
    1212# get.chip.metadata (camera) (chipID)
    13 # get.camera.metadata (camera) (expname) (camLabel)
     13# get.camera.metadata (camera) (expname) (camDgroup)
    1414
    1515# init.radec.range
     
    2929macro get.camera.eff
    3030 if ($0 != 5)
    31   echo "USAGE: get.camera.eff (camera) (expname) (camLabel) (refsrcs.fits)"
     31  echo "USAGE: get.camera.eff (camera) (expname) (camDgroup) (refsrcs.fits)"
    3232  echo "EX:    get.camera.eff gpc1 o9322g0253o EU.nightlyscience filename.fits"
    3333  break
    3434 end
    3535
    36  local i dbname expname camlabel output
     36 local i dbname expname camdgrp output
    3737 $dbname   = $1
    3838 $expname  = $2
    39  $camlabel = $3
     39 $camdgrp = $3
    4040 $refsrcs  = $4
    4141
     
    4848
    4949 # get the name of the smf file:
    50  get.camera.metadata $dbname $expname $camlabel
     50 get.camera.metadata $dbname $expname $camdgrp
    5151 $smffile = $camPath.smf     
    5252 $smfreal = `neb-locate -p $smffile`
     
    298298macro get.camera.metadata
    299299 if ($0 != 4)
    300   echo "USAGE: get.camera.metadata (camera) (expname) (camLabel)"
     300  echo "USAGE: get.camera.metadata (camera) (expname) (camDgroup)"
    301301  echo "EX:    get.camera.metadata gpc1 o9322g0253o EU.nightlyscience"
    302302  echo "  sets camPath, chipID"
     
    304304 end
    305305
    306  local dbname expname camlabel
    307  $dbname   = $1
    308  $expname  = $2
    309  $camlabel = $3
     306 local dbname expname camdgrp
     307 $dbname  = $1
     308 $expname = $2
     309 $camdgrp = $3
    310310
    311311# need to generically handle the question of which version / label
     
    313313# instead of label, we could specify the cam_id (which we might know)
    314314
    315  $command = camtool -dbname $dbname -processedexp -exp_name $expname -label $camlabel
     315 $command = camtool -dbname $dbname -processedexp -exp_name $expname -data_group $camdgrp
    316316#$command = camtool -dbname $dbname -processedexp -exp_name $expname
    317317 
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/ippCheck

    r42030 r42031  
    2828
    2929  if ($0 != 3)
    30     echo "USAGE: check.exposure.dvo (expname) (label)"
     30    echo "USAGE: check.exposure.dvo (expname) (dgroup)"
    3131    echo " -no-cam, -no-warp, -no-diff, -no-plots"
    3232    echo " [-camera gpc2]"
     
    3434  end
    3535
    36   local expname camlabel
     36  local expname camdgrp
    3737  $expname = $1
    38   $camlabel = $2
     38  $camdgrp = $2
    3939 
    4040  $OUTVERSION = DVO; # used to define output names
     
    4242
    4343  make.truth.sources $CAMERA $expname $PV3_CATDIR DVO
    44   if (not($SKIP_CAM))  get.camera.eff $CAMERA $expname $camlabel      $REFSOURCE
    45   if (not($SKIP_WARP)) get.warp.eff   $CAMERA $expname $camID          $REFSOURCE
    46   if (not($SKIP_DIFF)) get.diff.eff   $CAMERA $expname $warpID         $REFSOURCE
     44  if (not($SKIP_CAM))  get.camera.eff $CAMERA $expname $camdgrp $REFSOURCE
     45  if (not($SKIP_WARP)) get.warp.eff   $CAMERA $expname $camID   $REFSOURCE
     46  if (not($SKIP_DIFF)) get.diff.eff   $CAMERA $expname $warpID  $REFSOURCE
    4747
    4848  if (not($SKIP_PLOTS)) plot.exposure.real $expname
     
    6464
    6565  if ($0 != 4)
    66     echo "USAGE: check.exposure.mpc (expname) (label) (mpcfile)"
    67     break
    68   end
    69 
    70   local expname camlabel mpcfile
     66    echo "USAGE: check.exposure.mpc (expname) (dgroup) (mpcfile)"
     67    break
     68  end
     69
     70  local expname camdgrp mpcfile
    7171  $expname = $1
    72   $camlabel = $2
     72  $camdgrp = $2
    7373  $mpcfile = $3
    7474 
     
    8181  make.truth.sources $CAMERA $expname $mpcfile MPC; # sets the value of REFSOURCE
    8282
    83   if (not($SKIP_CAM)) get.camera.eff     $CAMERA $expname $camlabel $REFSOURCE
     83  if (not($SKIP_CAM)) get.camera.eff     $CAMERA $expname $camdgrp $REFSOURCE
    8484
    8585  # CAMSOURCE lists all REFSOURCE entries which actually fall on a chip, while REFSOURCE includes
     
    226226macro show.usage
    227227  echo "USAGE: ippCheck (mode) ..."
    228   echo "   EG: ippCheck mpc  (expname) (label) [mpcfile]"
    229   echo "   EG: ippCheck dvo  (expname) (label)"
     228  echo "   EG: ippCheck mpc  (expname) (dgroup) [mpcfile]"
     229  echo "   EG: ippCheck dvo  (expname) (dgroup)"
    230230  echo "   EG: ippCheck smf  (outroot) (smf1) (smf2) [+plot]"
    231231  echo "   EG: ippCheck smf.dgrp (outroot) (smf1) (smf2) [+plot]"
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/smfcheck.pro

    r42030 r42031  
    1717  end
    1818
    19   local output expname dgrp1 dgrp2
     19  local output expname dgrp1 dgrp2 saveplot
    2020  $output  = $1
    2121  $expname = $2
     
    3131  $smf2    = `neb-locate -p $smffile`
    3232
     33  $saveplot =
     34  if ($SAVEPLOT)
     35    $saveplot = +plot
     36  end
    3337  smf.compare.all.extensions $output $smf1 $smf2
    3438end
    3539
    3640macro smf.compare.all.extensions
    37   getargs +plot   BOOL  -var SAVEPLOT
     41  # defaults to 'false' if +plot is not provided
     42  getargs +plot     BOOL  -var SAVEPLOT
    3843
    3944  if ($0 != 4)
    40     echo "USAGE: smf.compare.all.extensions (output) (smf1) (smf2) [-plot]"
     45    echo "USAGE: smf.compare.all.extensions (output) (smf1) (smf2)"
    4146    break
    4247  end
     
    6166
    6267  # does the smf have the right number of extensions?
    63   list ext0 -x "ftable -list $smf1"
    64   list ext1 -x "ftable -list $smf2"
    65 
    66   ok ($ext0:n == $ext1:n) "same number of extensions"
    67   if ($ext0:n != $ext1:n)
    68     echo "impossible to continue with mismatched extensions"
    69     echo "smf1 : $smf1"
    70     echo "smf2 : $smf2"
    71     exit 3
    72   end
     68  # generate a list of just the extension names:
     69  list tablelines -x "ftable -list $smf1"
     70  smf.compare.extract.extnames ext0 tablelines
     71
     72  list tablelines -x "ftable -list $smf2"
     73  smf.compare.extract.extnames ext1 tablelines
     74
     75  smf.compare.match.extlists ext0 ext1
     76
     77  ## ok ($ext0:n == $ext1:n) "same number of extensions"
     78  ## if ($ext0:n != $ext1:n)
     79  ##   echo "impossible to continue with mismatched extensions"
     80  ##   echo "smf1 : $smf1"
     81  ##   echo "smf2 : $smf2"
     82  ##   exit 3
     83  ## end
    7384
    7485  # track the number of chips for which the XYnn.hdr keys failed
     
    7788
    7889  # XXX how to do the next steps if the numbers do not match?
    79   # NOTE: ext0:0 is the title line
    80   for i 1 $ext0:n
    81     list w0 -split $ext0:$i
    82     list w1 -split $ext1:$i
    83     ok ($w0:0 == $w1:0) "matching ext names"
    84 
    85     $extname = $w0:0
     90  for Next1 0 $ext0:n
     91    $Next2 = $match1:$Next1
     92    if ($Next2 == -1)
     93      echo "not ok : missing extenion $ext0:$Next1"
     94      next
     95    end
     96
     97    ok ($ext0:$Next1 == $ext1:$Next2) "matching ext names"
     98    $extname = $ext0:$Next1
     99    # NOTE: analysis below uses ext sequence number (i,j)
     100    # extname is only used to name output products
     101
     102    # ippCheckKeys uses 0 == PHU, 1 = 1st extension
     103    # smf.compare.onechip uses 0 = 1st extension
    86104
    87105    # if extname is XYnn.hdr, compare the headers
    88106    strstr -q $extname .hdr -start s1
    89107    if ($s1 == 4)
    90       $Next = $i - 1
    91       echo "# check keys for $extname == FITS entry number $Next"
    92       exec ippCheckKeys $smf1 $Next $smf2 $Next >& $outroot.$extname.keys
     108      echo "##### check keys for $extname == FITS entry number $Next1,$Next2 #####"
     109      echo "##### comparison results in $outroot.$extname.keys               #####"
     110      exec ippCheckKeys $smf1 $Next1 $smf2 $Next2 >& $outroot.$extname.keys
    93111      smf.compare.keys $outroot.$extname.keys hdrKeys
    94112      if ($NfailKeys) set NfailHdr = $NfailHdr + 1
     
    98116    strstr -q $extname .psf -start s1
    99117    if ($s1 == 4)
    100       $Next = $i - 1
    101       echo "# check keys for $extname == FITS entry number $Next"
    102       exec ippCheckKeys $smf1 $Next $smf2 $Next >& $outroot.$extname.keys
     118      echo "##### check keys for $extname == FITS entry number $Next1,$Next2 #####"
     119      echo "##### comparison results in $outroot.$extname.keys               #####"
     120      exec ippCheckKeys $smf1 $Next1 $smf2 $Next2 >& $outroot.$extname.keys
    103121      smf.compare.keys $outroot.$extname.keys psfKeys
    104122      if ($NfailKeys) set NfailPsf = $NfailPsf + 1
    105123
    106       echo "# check fields for $extname == FITS entry number $Next"
    107       smf.compare.onechip $outroot.$extname $smf1 $smf2 {$Next - 1}; # Note smf.compare.onechip counts from 0 = first extension
     124      echo "##### check fields for $extname == FITS entry number $Next1,$Next2 #####"
     125      echo "##### comparison results in $outroot.$extname.txt                  #####"
     126      smf.compare.onechip $outroot.$extname $smf1 {$Next1-1} $smf2 {$Next2-1}; # Note smf.compare.onechip counts from 0 = first extension
    108127    end
    109128  end
     
    116135# generate plot and comparison txt file for one chip (extension)
    117136macro smf.compare.onechip
    118   if ($0 != 5)
    119     echo "USAGE: smf.compare.onechip (output) (smf1) (smf2) (extension)"
    120     break
    121   end
    122 
    123   local output smf1 smf2 extnum
     137  if ($0 != 6)
     138    echo "USAGE: smf.compare.onechip (output) (smf1) (ext1) (smf2) (ext2)"
     139    break
     140  end
     141
     142  local output smf1 smf2 ext1 ext2
    124143  $output = $1
    125144  $smf1 = $2
    126   $smf2 = $3
    127   $extnum = $4
     145  $ext1 = $3
     146  $smf2 = $4
     147  $ext2 = $5
    128148
    129149  dirname $output -var mydir
     
    135155  # load in the full set of data for this extension
    136156  # NOTE : t0 and t1 are used to label the sets of vectors
    137   smf.load.fields $smf1 $extnum t1
    138   smf.load.fields $smf2 $extnum t2
     157  smf.load.fields $smf1 $ext1 t1
     158  smf.load.fields $smf2 $ext2 t2
    139159
    140160  # generate the matched lists (index1, index2)
     
    211231  # add a test here?
    212232  vstat -q dX
    213   ok ($SIGMA < 0.1) "X position stdev < 0.1"
     233  ok ($SIGMA < 0.1) "X position stdev $SIGMA < 0.1"
    214234  vstat -q dY
    215   ok ($SIGMA < 0.1) "Y position stdev < 0.1"
     235  ok ($SIGMA < 0.1) "Y position stdev $SIGMA < 0.1"
    216236end
    217237
     
    607627 book getword mybook $pagename cam_id    -var camID
    608628 book delete mybook
     629end
     630
     631######## generate a list of the entries in list2 which correspond to the entries in list 1
     632macro smf.compare.match.extlists
     633 if ($0 != 3)
     634  echo "USAGE: smf.compare.match.extlists (list1) (list2)"
     635  break
     636 end
     637
     638 # if I can assume the two lists have the same order (with just inserts or deletions in one or the other)
     639 # then I can step through the list only once
     640 # otherwise, I need to do N^2 comparisons?
     641
     642 $list1 = $1
     643 $list2 = $2
     644
     645 $N1 = $$list1:n 
     646 $N2 = $$list2:n 
     647 
     648 for i 0 $N1
     649   $match1:$i = -1
     650 end
     651 $match1:n = $N1
     652
     653 for i 0 $N2
     654   $match2:$i = -1
     655 end
     656 $match2:n = $N2
     657
     658 for i 0 $N1
     659   for j 0 $N2
     660     if ($match2:$j != -1) continue
     661     if ($$list1:$i == $$list2:$j)
     662       $match1:$i = $j
     663       $match2:$j = $i
     664       last
     665     end
     666   end
     667   if ($match1:$i == -1)
     668     echo "ERROR: missing extension $$list1:$i in file 2"
     669   end
     670 end
     671
     672 for j 0 $N2
     673   if ($match2:$j == -1)
     674     echo "WARNING: unexpected extension $$list2:$j in file 2"
     675   end
     676 end
     677end
     678
     679#######
     680macro smf.compare.extract.extnames
     681  if ($0 != 3)
     682    echo "USAGE: smf.compare.extract.extnames (outlist) (inlist)"
     683    break
     684  end
     685
     686  local i j inlist outlist
     687  $outlist = $1
     688  $inlist = $2
     689
     690  # NOTE: inlist:0 is the title line
     691  for i 1 $$inlist:n
     692    $j = $i - 1
     693    list words -split $$inlist:$i
     694    $$outlist:$j = $words:0
     695  end
     696  $$outlist:n = $tablelines:n - 1
    609697end
    610698
Note: See TracChangeset for help on using the changeset viewer.