IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42056


Ignore:
Timestamp:
Feb 23, 2022, 3:57:05 PM (4 years ago)
Author:
eugene
Message:

a number of improvements to warp and diff

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

Legend:

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

    r42032 r42056  
    224224end
    225225
     226macro init.stage
     227  if ($0 < 2)
     228    echo "USAGE: init.stage (stage)"
     229    break
     230  end
     231
     232  if (("$1" == "cam") || ("$1" == "camera"))
     233    init.camera
     234    return
     235  end
     236  if (("$1" == "wrp") || ("$1" == "warp"))
     237    init.warp
     238    return
     239  end
     240  if (("$1" == "dif") || ("$1" == "diff"))
     241    init.diff
     242    return
     243  end
     244 
     245  echo "ERROR : invalid stage $1"
     246  break
     247end
     248
    226249macro show.usage
    227250  echo "USAGE: ippCheck (mode) ..."
    228251  echo "   EG: ippCheck mpc  (expname) (dgroup) [mpcfile]"
    229252  echo "   EG: ippCheck dvo  (expname) (dgroup)"
    230   echo "   EG: ippCheck smf  (outroot) (smf1) (smf2) [+plot]"
    231   echo "   EG: ippCheck smf.dgrp.exp (outroot) (expname) (dgroup1) (dgroup2) [+plot]"
    232   echo "   EG: ippCheck smf.dgrp.all (outroot) (dgroup1) (dgroup2) [+plot]"
     253  echo "   EG: ippCheck smf (stage) (outroot) (smf1) (smf2) [+plot]"
     254  echo "   EG: ippCheck cmf (stage) (outroot) (smf1) (smf2) [+plot]"
     255  echo "   EG: ippCheck smf.dgrp.exp (stage) (outroot) (expname) (dgroup1) (dgroup2) [+plot]"
     256  echo "   EG: ippCheck smf.dgrp.all (stage) (outroot) (dgroup1) (dgroup2) [+plot]"
    233257  echo "   EG: ippCheck plot (expname)"
    234258  echo "   EG: ippCheck plot.glob (expglob) (outroot)"
    235259  echo "   EG: ippCheck mpcrefs (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax)"
     260
     261  echo " also equivalent:"
     262  echo "   EG: ippCheck smf.compare.exp.by.datagroup (stage) (outroot) (expname) (dgroup1) (dgroup2) [+plot]"
     263  echo "   EG: ippCheck smf.compare.all.by.datagroup (stage) (outroot) (dgroup1) (dgroup2) [+plot]"
    236264end
    237265
     
    259287  end
    260288
    261   if ("$argv:0" == "smf")
     289  # compare output products for a single exposure
     290  if (("$argv:0" == "smf") || ("$argv:0" == "cmf"))
     291    if ($argv:n < 2)
     292      echo "USAGE: ippCheck smf (stage) (outroot) (smf1) (smf2) [+plot]"
     293      echo "USAGE: ippCheck cmf (stage) (outroot) (smf1) (smf2) [+plot]"
     294      echo "   EG: ippCheck smf camera  (cctest) neb:///gpc1/ipc/o6370g0351o.2133651.smf neb:///gpc1/ipc/o6370g0351o.2497362.smf [+plot]"
     295      echo "   EG: ippCheck cmf warp    (wwtest) neb:///gpc1/ipc/o6370g0351o.wrp.2109044.skycell.1278.000.cmf neb:///gpc1/ipc/o6370g0351o.wrp.2465875.skycell.1278.000.cmf [+plot]"
     296    end
     297
     298    init.stage $argv:1
     299    list argv -join arglist -start 2
     300
    262301    smf.compare.all.extensions $arglist
    263302    exit 0
    264303  end
    265304
    266   if ("$argv:0" == "smf.dgrp.exp")
    267     smf.compare.exp.by.datagroups $arglist
    268     exit 0
    269   end
    270 
    271   if ("$argv:0" == "smf.dgrp.all")
    272     smf.compare.allexp.by.datagroups $arglist
    273     exit 0
     305  # compare output products for a single exposure by data_groups
     306  if (("$argv:0" == "smf.compare.exp.by.datagroups") || ("$argv:0" == "smf.dgrp.exp"))
     307    if ($argv:n < 2)
     308      echo "USAGE: ippCheck smf.dgrp.exp (stage) (outroot) (expname) (dgroup1) (dgroup2) [+plot]"
     309      echo "   EG: ippCheck smf.dgrp.exp camera  (cctest) o6370g0351o MOPS.dailytestset.20190516ops40745  eamtest.20220208"
     310      echo "   EG: ippCheck smf.dgrp.exp warp    (wwtest) o6370g0351o MOPS.dailytestset.20190516ops40745  eamtest.20220208"
     311    end
     312
     313    init.stage $argv:1
     314    list argv -join arglist -start 2
     315
     316    if (("$argv:1" == "cam") || ("$argv:1" == "camera"))
     317      smf.compare.cam.exp.by.datagroups $arglist
     318      exit 0
     319    end
     320    if (("$argv:1" == "wrp") || ("$argv:1" == "warp"))
     321      smf.compare.wrp.exp.by.datagroups $arglist
     322      exit 0
     323    end
     324    if (("$argv:1" == "dif") || ("$argv:1" == "diff"))
     325      smf.compare.dif.exp.by.datagroups $arglist
     326      exit 0
     327    end
     328  end
     329
     330  # compare all exposures for a pair of data_groups
     331  if (("$argv:0" == "smf.compare.all.by.datagroups") || ("$argv:0" == "smf.dgrp.all"))
     332    if ($argv:n < 2)
     333      echo "USAGE: ippCheck smf.dgrp.all (stage) (outroot) (dgroup1) (dgroup2) [+plot]"
     334      echo "   EG: ippCheck smf.dgrp.all camera  (cctest) MOPS.dailytestset.20190516ops40745  eamtest.20220208"
     335      echo "   EG: ippCheck smf.dgrp.all warp    (wwtest) MOPS.dailytestset.20190516ops40745  eamtest.20220208"
     336    end
     337
     338    init.stage $argv:1
     339    list argv -join arglist -start 2
     340
     341    if (("$argv:1" == "cam") || ("$argv:1" == "camera"))
     342      smf.compare.cam.all.by.datagroups $arglist
     343      exit 0
     344    end
     345    if (("$argv:1" == "wrp") || ("$argv:1" == "warp"))
     346      smf.compare.wrp.all.by.datagroups $arglist
     347      exit 0
     348    end
     349    if (("$argv:1" == "dif") || ("$argv:1" == "diff"))
     350      smf.compare.dif.all.by.datagroups $arglist
     351      exit 0
     352    end
    274353  end
    275354
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/smfcheck.pro

    r42033 r42056  
    11#!/usr/bin/env dvo
    22# compare smf-to-smf
     3# opihi verbose on
    34
    45if (not($?SAVEPLOT)) set SAVEPLOT = 0
     6if (not($?SAVEDATA)) set SAVEDATA = 0
    57
    68module tap.pro
    79
    8 macro smf.compare.allexp.by.datagroups
     10###########
     11macro smf.compare.cam.all.by.datagroups
    912  $CAMERA = gpc1 
    1013
    1114  getargs +plot     BOOL  -var SAVEPLOT
     15  getargs +dump     BOOL  -var SAVEDATA
    1216  getargs -camera   VALUE -var CAMERA
    1317
    1418  if ($0 != 4)
    15     echo "USAGE: smf.compare.allexp.by.datagroups (outdir) (DG1) (DG2) [+plot] [-camera gpc2]"
     19    echo "USAGE: smf.compare.cam.all.by.datagroups (outdir) (DG1) (DG2) [+plot] [-camera gpc2]"
    1620    break
    1721  end
     
    2832  queue2book myqueue mybook
    2933 
    30   $camPath = NONE
    3134  book npages mybook -var npages
    3235 
     
    3740  end
    3841 
     42  $options =
     43  setargs +plot   BOOL  $SAVEPLOT
     44  setargs +dump   BOOL  $SAVEDATA
     45  setargs -camera VALUE $CAMERA
     46
     47  mkdir $outdir
     48
    3949  for i 0 $npages 
    4050    sprint pagename page.%03d $i
    4151    book getword mybook $pagename exp_name -var expname
    42     $expnames:$i = $expname
    43   end
    44   $expnames:n = $npages
    45 
     52
     53    echo ippCheck smf.dgrp.exp camera $outdir/$expname.cam/$expname $expname $dgrp1 $dgrp2 $options >& $outdir/$expname.cam.log
     54    exec ippCheck smf.dgrp.exp camera $outdir/$expname.cam/$expname $expname $dgrp1 $dgrp2 $options >& $outdir/$expname.cam.log
     55  end
    4656  book delete mybook
    47 
     57end
     58
     59###########
     60macro smf.compare.wrp.all.by.datagroups
     61  $CAMERA = gpc1 
     62
     63  getargs +plot     BOOL  -var SAVEPLOT
     64  getargs +dump     BOOL  -var SAVEDATA
     65  getargs -camera   VALUE -var CAMERA
     66
     67  if ($0 != 4)
     68    echo "USAGE: smf.compare.wrp.all.by.datagroups (outdir) (DG1) (DG2) [+plot] [-camera gpc2]"
     69    break
     70  end
     71
     72  local outdir dgrp1 dgrp2 command i npages expname
     73  $outdir = $1
     74  $dgrp1 = $2
     75  $dgrp2 = $3
     76
     77  # identify the list of exposures in the data groups
     78  $command = warptool -dbname $CAMERA -listrun -data_group $dgrp2
     79 
     80  queueload  myqueue -x "$command"
     81  queue2book myqueue mybook
     82 
     83  book npages mybook -var npages
     84 
     85  if ($npages < 1)
     86   echo "ERROR: missing exposures for $dgrp2 : $command"
     87   book delete mybook
     88   next
     89  end
     90 
    4891  $options =
    4992  setargs +plot   BOOL  $SAVEPLOT
     93  setargs +dump   BOOL  $SAVEDATA
    5094  setargs -camera VALUE $CAMERA
    5195
    5296  mkdir $outdir
    5397
    54   for i 0 $expnames:n
    55     echo smf.compare.exp.by.datagroups $outdir/$expnames:$i $expnames:$i $dgrp1 $dgrp2 $options
    56     exec ippCheck smf.dgrp.exp $outdir/$expnames:$i $expnames:$i $dgrp1 $dgrp2 $options >& $outdir/$expnames:$i.log
    57   end
    58 end
    59 
    60 macro smf.compare.exp.by.datagroups
     98  for i 0 $npages 
     99    sprint pagename page.%03d $i
     100    book getword mybook $pagename exp_name -var expname
     101
     102    echo ippCheck smf.dgrp.exp warp $outdir/$expname.wrp/$expname $expname $dgrp1 $dgrp2 $options >& $outdir/$expname.wrp.log
     103    exec ippCheck smf.dgrp.exp warp $outdir/$expname.wrp/$expname $expname $dgrp1 $dgrp2 $options >& $outdir/$expname.wrp.log
     104  end
     105  book delete mybook
     106end
     107
     108###########
     109macro smf.compare.dif.all.by.datagroups
    61110  $CAMERA = gpc1 
    62111
    63112  getargs +plot     BOOL  -var SAVEPLOT
     113  getargs +dump     BOOL  -var SAVEDATA
    64114  getargs -camera   VALUE -var CAMERA
    65115
     116  if ($0 != 4)
     117    echo "USAGE: smf.compare.dif.all.by.datagroups (outdir) (DG1) (DG2) [+plot] [-camera gpc2]"
     118    break
     119  end
     120
     121  local outdir dgrp1 dgrp2 command i npages expname
     122  $outdir = $1
     123  $dgrp1 = $2
     124  $dgrp2 = $3
     125
     126  # identify the list of exposures in the data groups
     127  $command = difftool -dbname $CAMERA -listrun -data_group $dgrp2
     128 
     129  queueload  myqueue -x "$command"
     130  queue2book myqueue mybook
     131 
     132  $camPath = NONE
     133  book npages mybook -var npages
     134 
     135  if ($npages < 1)
     136   echo "ERROR: missing exposures for $dgrp2 : $command"
     137   book delete mybook
     138   next
     139  end
     140 
     141  $options =
     142  setargs +plot   BOOL  $SAVEPLOT
     143  setargs +dump   BOOL  $SAVEDATA
     144  setargs -camera VALUE $CAMERA
     145
     146  mkdir $outdir
     147
     148  # we are selecting exp_name_1 so we know the exposure is the positive image (not template)
     149  for i 0 $npages 
     150    sprint pagename page.%03d $i
     151    book getword mybook $pagename exp_name_1 -var expname
     152
     153    echo ippCheck smf.dgrp.exp diff $outdir/$expname.dif/$expname $expname $dgrp1 $dgrp2 $options >& $outdir/$expname.dif.log
     154    exec ippCheck smf.dgrp.exp diff $outdir/$expname.dif/$expname $expname $dgrp1 $dgrp2 $options >& $outdir/$expname.dif.log
     155  end
     156  book delete mybook
     157end
     158
     159###########
     160macro smf.compare.cam.exp.by.datagroups
     161  $CAMERA = gpc1 
     162
     163  getargs +plot     BOOL  -var SAVEPLOT
     164  getargs +dump     BOOL  -var SAVEDATA
     165  getargs -camera   VALUE -var CAMERA
     166
    66167  if ($0 != 5)
    67     echo "USAGE: smf.compare.by.datagroups (output) (expname) (DG1) (DG2) [+plot] [-camera gpc2]"
     168    echo "USAGE: smf.compare.cam.exp.by.datagroups (output) (expname) (DG1) (DG2) [+plot] [-camera gpc2]"
    68169    break
    69170  end
     
    75176  $dgrp2   = $4
    76177
    77   get.camera.metadata.by.datagroup $CAMERA $expname $dgrp1
    78   $smffile = $camPath.smf     
    79   $smf1    = `neb-locate -p $smffile`
    80 
    81   get.camera.metadata.by.datagroup $CAMERA $expname $dgrp2
    82   $smffile = $camPath.smf     
    83   $smf2    = `neb-locate -p $smffile`
     178  # output goes to $camPath
     179  get.camera.metadata.by.datagroup $CAMERA $expname $dgrp1; $smfBase1 = $camPath
     180  get.camera.metadata.by.datagroup $CAMERA $expname $dgrp2; $smfBase2 = $camPath
    84181
    85182  $options =
    86183  setargs +plot   BOOL  $SAVEPLOT
    87   smf.compare.all.extensions $output $smf1 $smf2 $options
    88 end
    89 
     184  setargs +dump   BOOL  $SAVEDATA
     185  echo smf.compare.all.extensions $output $smfBase1.smf $smfBase2.smf $options
     186       smf.compare.all.extensions $output $smfBase1.smf $smfBase2.smf $options
     187end
     188
     189# XXX needs some error handling
     190macro smf.compare.wrp.exp.by.datagroups
     191  $CAMERA = gpc1 
     192
     193  getargs +plot     BOOL  -var SAVEPLOT
     194  getargs +dump     BOOL  -var SAVEDATA
     195  getargs -camera   VALUE -var CAMERA
     196
     197  if ($0 != 5)
     198    echo "USAGE: smf.compare.wrp.exp.by.datagroups (output) (expname) (DG1) (DG2) [+plot] [-camera gpc2]"
     199    break
     200  end
     201
     202  local output expname dgrp1 dgrp2 saveplot npages1 npages2 cmfBase1 cmfBase2 i
     203  $output  = $1
     204  $expname = $2
     205  $dgrp1   = $3
     206  $dgrp2   = $4
     207
     208  # XXX ensure warpBook1 & warpBook2 are deleted / empty first
     209  get.warp.metadata.by.datagroup warpBook1 $CAMERA $expname $dgrp1
     210  get.warp.metadata.by.datagroup warpBook2 $CAMERA $expname $dgrp2
     211
     212  book npages warpBook1 -var npages1
     213  if ($npages1 < 1)
     214    echo "ERROR: missing warps for exposure : $expname ($dgrp1)"
     215    book delete warpBook1
     216    book delete warpBook2
     217    next
     218  end
     219 
     220  book npages warpBook2 -var npages2
     221  if ($npages1 != $npages2)
     222    echo "WARNING: inconsistent number of warps for exposure : $expname ($npages1 vs $npages2)"
     223  end
     224 
     225  for i 0 $npages1
     226    book getpage warpBook1 $i -var mypage1
     227    book getword warpBook1 $mypage1 skycell_id -var skycellID
     228    book getword warpBook1 $mypage1 path_base  -var cmfBase1
     229
     230    # select the page with the same skycell_id as cmfFile1
     231    # XXX if this page is not found, raise an error / warning and skip the rest
     232    book getpage warpBook2 0  -key skycell_id $skycellID -var mypage2
     233    book getword warpBook2 $mypage2 path_base  -var cmfBase2
     234
     235    $options =
     236    setargs +plot   BOOL  $SAVEPLOT
     237    setargs +dump   BOOL  $SAVEDATA
     238    echo smf.compare.all.extensions $output.$skycellID $cmfBase1.cmf $cmfBase2.cmf $options
     239         smf.compare.all.extensions $output.$skycellID $cmfBase1.cmf $cmfBase2.cmf $options
     240 end
     241
     242 book delete warpBook1
     243 book delete warpBook2
     244end
     245
     246# XXX needs some error handling
     247macro smf.compare.dif.exp.by.datagroups
     248  $CAMERA = gpc1 
     249
     250  getargs +plot     BOOL  -var SAVEPLOT
     251  getargs +dump     BOOL  -var SAVEDATA
     252  getargs -camera   VALUE -var CAMERA
     253
     254  if ($0 != 5)
     255    echo "USAGE: smf.compare.dif.exp.by.datagroups (output) (expname) (DG1) (DG2) [+plot] [-camera gpc2]"
     256    break
     257  end
     258
     259  local i output expname dgrp1 dgrp2 saveplot npages1 npages2 cmfBase1 cmfBase2 bothways
     260  $output  = $1
     261  $expname = $2
     262  $dgrp1   = $3
     263  $dgrp2   = $4
     264
     265  get.diff.metadata.by.datagroup diffBook1 $CAMERA $expname $dgrp1
     266  get.diff.metadata.by.datagroup diffBook2 $CAMERA $expname $dgrp2
     267
     268  book npages diffBook1 -var npages1
     269  if ($npages1 < 1)
     270    echo "ERROR: missing diffs for exposure : $expname ($dgrp1)"
     271    book delete diffBook1
     272    book delete diffBook2
     273    next
     274  end
     275 
     276  book npages diffBook2 -var npages2
     277  if ($npages1 != $npages2)
     278    echo "WARNING: inconsistent number of diffs for exposure : $expname ($npages1 vs $npages2)"
     279  end
     280 
     281  for i 0 $npages1
     282    book getpage diffBook1 $i -var mypage1
     283    book getword diffBook1 $mypage1 skycell_id -var skycellID
     284    book getword diffBook1 $mypage1 path_base  -var cmfBase1
     285
     286    # select the page with the same skycell_id as cmfFile1
     287    # XXX if this page is not found, raise an error / warning and skip the rest
     288    book getpage diffBook2 0  -key skycell_id $skycellID -var mypage2
     289    book getword diffBook2 $mypage2 path_base  -var cmfBase2
     290    book getword diffBook2 $mypage2 bothways   -var bothways
     291
     292    $options =
     293    setargs +plot   BOOL  $SAVEPLOT
     294    setargs +dump   BOOL  $SAVEDATA
     295    echo smf.compare.all.extensions $output.$skycellID $cmfBase1.cmf $cmfBase2.cmf $options
     296         smf.compare.all.extensions $output.$skycellID $cmfBase1.cmf $cmfBase2.cmf $options
     297
     298    if ("$bothways" == "T")
     299      echo smf.compare.all.extensions $output.$skycellID.inv $cmfBase1.inv.cmf $cmfBase2.inv.cmf $options
     300           smf.compare.all.extensions $output.$skycellID.inv $cmfBase1.inv.cmf $cmfBase2.inv.cmf $options
     301    end
     302 end
     303
     304 book delete diffBook1
     305 book delete diffBook2
     306end
     307
     308## this function can be used for camera smf or warp & diff cmf files
    90309macro smf.compare.all.extensions
    91310  # defaults to 'false' if +plot is not provided
    92311  getargs +plot     BOOL  -var SAVEPLOT
     312  getargs +dump     BOOL  -var SAVEDATA
    93313
    94314  if ($0 != 4)
    95315    echo "USAGE: smf.compare.all.extensions (output) (smf1) (smf2)"
    96     break
    97   end
    98 
    99   local outroot smf1 smf2 extname mydir
     316    echo " NOTE: smf files may be nebulous keys"
     317    break
     318  end
     319
     320  local outroot smfFile1 smfFile2 extname mydir
    100321  $outroot = $1
    101   $smf1 = $2
    102   $smf2 = $3
     322  $smfFile1 = $2
     323  $smfFile2 = $3
     324
     325  # NOTE: smf1 and smf2 cannot be local variables (names are used in convert.neb.name)
     326  convert.neb.name $smfFile1 smf1
     327  convert.neb.name $smfFile2 smf2
     328
     329  if ("$smf1" == "")
     330    echo "ERROR: missing smf/cmf file : $smfFile1"
     331    next
     332  end
     333  if ("$smf2" == "")
     334    echo "ERROR: missing smf/cmf file : $smfFile2"
     335    next
     336  end
    103337
    104338  dirname $outroot -var mydir
     
    108342  # XXX can we calculate the number of tests based on the number of smf extensions?
    109343  # plan 3125
    110   plan 3065
    111 
    112   # load psfField definitions
    113   # XXX these should depend on which file is being compared (camera, warp, diff)
     344  ## XXX if smf.compare.all.extensions is called by an external function, we probably need a different plan,
     345  ## or we need to call 'plan' at the outer level?
     346  plan $NTESTS_CMF
     347
     348  # Load psfField definitions.  These variables are set by the
     349  # (init.camera, init.warp, init.diff) macros defined in .ippcheckrc.
     350  # These are called by init.stage
    114351  smf.compare.parse.book $PSF_FIELDS  psfFields
    115352  smf.compare.parse.book $PSF_KEYS    psfKeys
     
    119356  # generate a list of just the extension names:
    120357  list tablelines -x "ftable -list $smf1"
     358  if ($tablelines:n == 0)
     359    echo "ERROR failed to read FITS extensions in file $smf1"
     360    next
     361  end
    121362  smf.compare.extract.extnames ext0 tablelines
    122363
    123364  list tablelines -x "ftable -list $smf2"
     365  if ($tablelines:n == 0)
     366    echo "ERROR failed to read FITS extensions in file $smf1"
     367    next
     368  end
    124369  smf.compare.extract.extnames ext1 tablelines
    125370
     371  # generate matched lists of extensions $match1:N == $match2:N
    126372  smf.compare.match.extlists ext0 ext1
    127373
     
    130376  $NfailPsf = 0
    131377
    132   # XXX how to do the next steps if the numbers do not match?
     378  # compare the matched extensions $ext1:N == $ext2:($match2:N)
    133379  for Next1 0 $ext0:n
    134380    $Next2 = $match1:$Next1
     
    223469  # NOTE : t0 and t1 are used to label the sets of vectors
    224470  smf.load.fields $smf1 $ext1 t1
     471  $smf1_has_data = ($tfields:n > 0) && ($table:Ny > 0)
     472
    225473  smf.load.fields $smf2 $ext2 t2
     474  $smf2_has_data = ($tfields:n > 0) && ($table:Ny > 0)
     475
     476  ok ($smf1_has_data == $smf2_has_data) "tables both have (or both lack) data"
     477  if (not($smf1_has_data) || not($smf2_has_data))
     478    echo "no data in tables $smf1 $ext1 or $smf2 $ext2, skipping"
     479    # I should account for the number of skipped tests
     480    return
     481  end
    226482
    227483  # generate the matched lists (index1, index2)
     
    246502
    247503  data $filename
    248   read -fits $extnum -extnum -list-fields -q; list tfields -join allfields
     504  read -fits $extnum -extnum -list-fields -q
     505  if ($tfields:n == 0)
     506    echo "FITS table in $filename is empty"
     507    return
     508  end
     509  if ($table:Ny == 0)
     510    echo "FITS table in $filename is empty"
     511    return
     512  end
     513  list tfields -join allfields
    249514  read -fits $extnum -extnum $allfields
    250515 
     
    297562
    298563  # add a test here?
    299   vstat -q dX
    300   ok ($SIGMA < 0.1) "X position stdev $SIGMA < 0.1"
    301   vstat -q dY
    302   ok ($SIGMA < 0.1) "Y position stdev $SIGMA < 0.1"
     564  # XXX this test is equivalent to tests of the fields below
     565  # but cannot be as finely controlled
     566  # vstat -q dX
     567  # ok ($SIGMA < 0.1) "X position stdev $SIGMA < 0.1"
     568  # vstat -q dY
     569  # ok ($SIGMA < 0.1) "Y position stdev $SIGMA < 0.1"
    303570end
    304571
     
    323590  list fields -split $allfields
    324591  for i 0 $fields:n
    325     smf.compare.onefield   $output $fields:$i $v1 $v2
     592    smf.compare.onefield    $output $fields:$i $v1 $v2
    326593    if (not($PASS)) set $NfailFieldsPSF = $NfailFieldsPSF + 1
    327594    smf.fields.magplot.show $output $fields:$i $v1 $v2
     595    smf.fields.match.dump   $output $fields:$i $v1 $v2
    328596  end 
    329597
     
    344612end
    345613
     614macro smf.fields.match.dump
     615  if ($0 != 5)
     616    echo "USAGE: smf.fields.match.dump (output) (field) (v1) (v2)"
     617    echo " NOTE: run smf.pos.compare (or equiv) first to generate index1, index2"
     618    break
     619  end
     620 
     621  local output field v1 v2
     622  $output = $1
     623  $field  = $2
     624  $v1     = $3
     625  $v2     = $4
     626
     627  if (not($SAVEDATA)) return
     628  write $output.$field.dat PSF_INST_MAG_$v1 PSF_INST_MAG_SIG_$v1 $field\_$v1 tmp_$v2
     629end
     630
    346631macro smf.fields.magplot.show
    347632  if ($0 != 5)
    348     echo "USAGE: smf.fields.magplot.show (output) {field) (v1) (v2)"
     633    echo "USAGE: smf.fields.magplot.show (output) (field) (v1) (v2)"
    349634    echo " NOTE: run smf.pos.compare (or equiv) first to generate index1, index2"
    350635    break
     
    404689  # echo $field $useStat
    405690
     691  # this variable tells the name of the vector which
     692  # should be used to select the values to test
     693  # the choice of minMag / maxMag depends on this value
     694  $keepFieldName = PSF_INST_MAG_SIG
     695
    406696  delete -q dtmp
    407697  if ("$useStat" == "VALUE")
    408698    set dtmp = $statScale*(tmp_$v2 - $field\_$v1)
    409     subset dtmpS = dtmp where ((PSF_INST_MAG_$v1 > $minMag) && (PSF_INST_MAG_$v1 < $maxMag))
     699    subset dtmpS = dtmp where (($keepFieldName\_$v1 > $minMag) && ($keepFieldName\_$v1 < $maxMag))
    410700  end
    411701  if ("$useStat" == "IVALUE")
    412702    set dtmp = tmp_$v2 - $field\_$v1
    413     subset dtmpS = dtmp where ((PSF_INST_MAG_$v1 > $minMag) && (PSF_INST_MAG_$v1 < $maxMag) && (tmp_$v2 != -4096) && ($field\_$v1 != -4096))
     703    subset dtmpS = dtmp where (($keepFieldName\_$v1 > $minMag) && ($keepFieldName\_$v1 < $maxMag) && (tmp_$v2 != -4096) && ($field\_$v1 != -4096))
    414704  end
    415705  if ("$useStat" == "RATIO")
    416706    set dtmp = $statScale(tmp_$v2 / $field\_$v1)
    417     subset dtmpS = dtmp where ((PSF_INST_MAG_$v1 > $minMag) && (PSF_INST_MAG_$v1 < $maxMag))
     707    subset dtmpS = dtmp where (($keepFieldName\_$v1 > $minMag) && ($keepFieldName\_$v1 < $maxMag))
    418708  end
    419709  if ("$useStat" == "RVALUE")
    420710    set dtmp = $statScale*(tmp_$v2 - $field\_$v1) / $field\_$v1
    421     subset dtmpS = dtmp where ((PSF_INST_MAG_$v1 > $minMag) && (PSF_INST_MAG_$v1 < $maxMag))
     711    subset dtmpS = dtmp where (($keepFieldName\_$v1 > $minMag) && ($keepFieldName\_$v1 < $maxMag))
    422712  end
    423713  if (("$useStat" == "NONE") || ("$useStat" == "NULL"))
     
    522812  # LAYOUT   KEY   KEY   KEY
    523813  # PAGENAME VALUE VALUE VALUE
     814
     815  file $filename isFound
     816  if (not($isFound))
     817    echo "missing ippCheck config file $filename"
     818    exit 2
     819  end
    524820
    525821  # NOTE: this list parsing strips out extra spaces and empty lines
     
    633929  if ($range == 0.0)
    634930    # if all values are the same, generate a vector with a single value of all points
    635     create $3 $hist:median {$hist:median + 1.5}
    636     set $2 = zero($3) + 0.0
    637     $2[0] = _tmp_sort[]
     931    delete -q $3
     932    concat $hist:median $3
     933    set $2 = zero($3) + _tmp_sort[]
    638934    return   
    639935  end
     
    642938    # if all values are the same, generate a vector with a single value of all points
    643939    create $3 0 1
    644     set $2 = zero($3) + 0.0
    645     $2[0] = _tmp_sort[]
     940    set $2 = zero($3) + _tmp_sort[]
    646941    return   
    647942  end
     
    660955 end
    661956
    662  local dbname expname camlabel
     957 local dbname expname camdgrp
    663958 $dbname   = $1
    664959 $expname  = $2
    665960 $camdgrp  = $3
    666961
    667 # need to generically handle the question of which version / label
    668 # this will be a problem for old exposures without a useful label (cleanup)
    669 # instead of label, we could specify the cam_id (which we might know)
    670 
     962 book init mybook
     963
     964 # the camera data_group should select a unique exposure
    671965 $command = camtool -dbname $dbname -processedexp -exp_name $expname -data_group $camdgrp
    672966 
     
    694988 book getword mybook $pagename cam_id    -var camID
    695989 book delete mybook
     990end
     991
     992################
     993macro get.warp.metadata.by.datagroup
     994 if ($0 != 5)
     995  echo "USAGE: get.warp.metadata.by.datagroup (bookname) (camera) (expname) (data_group)"
     996  echo "EX:    get.warp.metadata.by.datagroup warpBook gpc1 o9322g0253o MOPS.dailytestset.20190516ops40745"
     997  echo "  sets warp book"
     998  break
     999 end
     1000
     1001 local warpbook dbname expname warpdgrp
     1002 $warpbook = $1
     1003 $dbname   = $2
     1004 $expname  = $3
     1005 $warpdgrp = $4
     1006
     1007 book init $warpbook
     1008
     1009 # the warp data_group should select a unique exposure
     1010 $command = warptool -dbname $dbname -warped -exp_name $expname -data_group $warpdgrp
     1011 
     1012 queueload  myqueue -x "$command"
     1013 queue2book myqueue $warpbook -key skycell_id
     1014end
     1015
     1016################
     1017macro get.diff.metadata.by.datagroup
     1018 if ($0 != 5)
     1019  echo "USAGE: get.diff.metadata.by.datagroup (bookname) (camera) (expname) (data_group)"
     1020  echo "EX:    get.diff.metadata.by.datagroup diffBook gpc1 o9322g0253o MOPS.dailytestset.20190516ops40745"
     1021  echo "  sets diff book"
     1022  break
     1023 end
     1024
     1025 local diffbook dbname expname diffdgrp length
     1026 $diffbook = $1
     1027 $dbname   = $2
     1028 $expname  = $3
     1029 $diffdgrp = $4
     1030
     1031 book init $diffbook
     1032
     1033 # get the complete list of skyfiles for this exposure
     1034 # the diff data_group should select a unique exposure
     1035 # however, we do not know if the exposure was used as the positive or negative image:
     1036 $command = difftool -dbname $dbname -diffskyfile -exp_name $expname -data_group $diffdgrp
     1037 queueload myqueue -x "$command"
     1038
     1039 queuesize myqueue -var length
     1040 if ($length == 0)
     1041   $command = difftool -dbname $dbname -diffskyfile -exp_name $expname -data_group $diffdgrp -template
     1042   queueload myqueue -x "$command"
     1043 end
     1044
     1045 queue2book myqueue $diffbook -key skycell_id
    6961046end
    6971047
     
    7781128end
    7791129
     1130macro convert.neb.name
     1131  if ($0 != 3)
     1132    echo "USAGE: convert.neb.name (inname) (outname)"
     1133    echo " replaces outname with either real filename for inname (from nebulous if appropriate)"
     1134    break
     1135  end
     1136
     1137  local inname outname prefix
     1138  $inname = $1
     1139  $outname = $2
     1140
     1141  # is this a nebulous key?
     1142  substr $inname 0 5 prefix
     1143  if ("$prefix" == "neb:/")
     1144    $$outname = `neb-locate -p $inname`
     1145    if ("$$outname" == "")
     1146      echo "ERROR: no nebulous entry for file : $inname"
     1147      next
     1148    end
     1149  else
     1150    $$outname = $inname
     1151  end
     1152end
     1153
    7801154########## EXAMPLES:
    7811155
Note: See TracChangeset for help on using the changeset viewer.