IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42120


Ignore:
Timestamp:
Mar 17, 2022, 7:09:13 AM (4 years ago)
Author:
eugene
Message:

fixes to handle inconsistent numbers of chip files and smf entries; handle cases where there are no matches with the reference catalog

Location:
tags/ipp-ops-20220303-rc/ippTests/ippCheck
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/eam_branches/ipp-20211108/ippTests/ippCheckmergedeligible
      /trunk/ippTests/ippCheckmergedeligible
      /branches/IPP-308_move_backups_folder/ippTests/ippCheck40969-40970
      /branches/czw_branch/20160809/ippTests/ippCheck39651-39924
      /branches/czw_branch/20170908/ippTests/ippCheck40128-40486
      /branches/eam_branches/ipp-20191011/ippTests/ippCheck40935-41170
      /branches/eam_branches/ipp-dev-20210817/ippTests/ippCheck41797-41890
      /branches/ipp-259_genericise_backups/ippTests/ippCheck40910-40966
      /tags/ipp-ps1-20210510/ippTests/ippCheck41576-41704
      /tags/ipp-ps1-20210708/ippTests/ippCheck41709-41749
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck/cammask.pro

    r42031 r42120  
    5252 $smfreal = `neb-locate -p $smffile`
    5353 
     54 # sets the list chipName:0 - chipName:n based on chipRun
    5455 get.chip.metadata $dbname $chipID
     56
     57 # set the list camMask:0 - camMask:n based on nebulous listing
     58 # some cam-stage masks may be missing, these are set to NONE
     59 # the number of entries in both lists is the same (chipName:n)
    5560 get.chip.mask.files $camPath
    5661 
     62 # read in the PHU header
     63 rd PHU $smfreal
     64
     65 # set the list chipNseq:0 - chipNseq:n based on smf entries.
     66 # Some chips may be missing from the smf, these are set to -1
     67 # $chipNseq:n = $chipName:n
     68 get.chip.smf.Nseq $smfreal
     69
    5770 for i 0 $camMask:n
    58    echo $chipName:$i $camMask:$i
     71   echo $chipName:$i $chipNseq:$i $camMask:$i
    5972 end
    6073
     
    6578 if ($table:Ny == 0)
    6679  echo "ERROR: no reference sources found in $refsrcs"
     80
     81  # generate an empty output file
     82  $OUT_FIELDS =
     83  foreach field $SMF_FIELDS_CAM $REF_FIELDS_CAM $XTR_FIELDS_CAM
     84    $OUT_FIELDS = $OUT_FIELDS $field\_out
     85    create -empty $field\_out
     86  end
     87 
     88  sprintf output "%s/%s.%s.cam.stf" $OUTDIR $expname $OUTVERSION
     89  write -fits DATA $output $OUT_FIELDS
     90 
     91  # save this name for warp and diff analysis, if desired
     92  $CAMSOURCE = $output
     93
    6794  break
    6895 end
     
    7198 set Nref = ramp(Rref)
    7299
    73  # read in the PHU header
    74  rd PHU $smfreal
    75 
    76  # create the chipName list from the smffile and calculate the index numbers.
    77  # NOTE: if a chip is missing from the smf, this may be inconsistent with chipMask:n
    78  # XXX for now, we fail is this happens
    79  list chipsRaw -x "ftable -list $smfreal | grep -n hdr | prcol 1 | sed s/.hdr//"
    80  for i 0 $chipsRaw:n
    81   list word -splitbychar : $chipsRaw:$i
    82   $chipNseq:$i = $word:0 - 3; # this number depends on the number of leading tables
    83   if ("$chipName:$i" != "$word:1")
    84     echo "ERROR: missing chip from smffile: " $chipName:$i
    85     break
    86   end
    87  end
    88 
    89   # delete any existing output vectors
    90   foreach field $SMF_FIELDS_CAM $REF_FIELDS_CAM $XTR_FIELDS_CAM
    91     delete -q $field\_out
    92   end
     100 # delete any existing output vectors
     101 foreach field $SMF_FIELDS_CAM $REF_FIELDS_CAM $XTR_FIELDS_CAM
     102   delete -q $field\_out
     103 end
    93104
    94105 # find matching entries in smf file
    95106 for i 0 $chipName:n
     107   ## echo $chipName:$i $chipNseq:$i $camMask:$i
     108
     109   if ($chipNseq:$i < 0) continue
     110
    96111   get.chip.detect.stats $chipName:$i $chipNseq:$i
    97    get.chip.mask.stats $camMask:$i
     112
     113   if ("$camMask:$i" == "NONE")
     114     # if the mask files are missing, all are masked or unmasked?
     115     set Q1ref_onchp = zero(Xref_onchp) + 1.0
     116   else
     117     get.chip.mask.stats $camMask:$i
     118   end
    98119
    99120   foreach field $SMF_FIELDS_CAM
     
    241262
    242263 # get the full list from nebulous (faster than getting each one at a time)
    243  list tmpName -x "neb-ls $pathbase.%.mk.fits"
     264 list tmpName -x "neb-ls -c $pathbase.%.mk.fits"
    244265
    245266 # the list of masks might not match the list of chips
     267 # mark missing cam-stage masks with NONE
    246268 $j = 0
     269 echo "chipName:n $chipName:n"
    247270 for i 0 $chipName:n
     271   # if we get to the end of the list, assign the missing entries to NONE
     272   if ($j >= $tmpName:n)
     273    $camMask:$i = NONE
     274    continue
     275   end
    248276   list word -splitbychar . $tmpName:$j
    249277   $Nch = $word:n - 3
     
    254282   end
    255283   $camMask:$i = $tmpName:$j
    256    if ($VERBOSE) echo "found chipMask $camMask:$i"
     284   if ($VERBOSE) echo "found chipMask $camMask:$i ($chipName:$i) : $i $j $chipName:n $tmpName:n"
    257285   if ($COPYMASKS) exec neb-copy $camMask:$i $OUTDIR
    258286   $j ++
    259  end
    260  $camMask:n = $chipName:n
     287   if ($j >= $tmpName:n) last
     288 end
     289 $camMask:n = $tmpName:n
     290end
     291
     292# get the file names of the chip mask files.
     293# these are actually the masks from the camera stage which
     294# has the dynamic masking applied
     295macro get.chip.smf.Nseq
     296 if ($0 != 2)
     297  echo "USAGE: get.camera.smf.Nseq (smffile)"
     298  echo " sets chipNseq:0 - chipNseq:n"
     299  break
     300 end
     301
     302 local i j smffile
     303 $smffile = $1
     304
     305 # identify the chips in the smffile and calculate the index numbers.
     306 # NOTE: if a chip is missing from the smf, set Nseq to -1
     307 list chipsRaw -x "ftable -list $smfreal | grep -n hdr | prcol 1 | sed s/.hdr//"
     308
     309 $j = 0
     310 for i 0 $chipName:n
     311   # if we get to the end of the list, assign the missing entries to NONE
     312   if ($j >= $chipsRaw:n)
     313    $chipNseq:$i = -1
     314    continue
     315   end
     316   list word -splitbychar : $chipsRaw:$j
     317   $myNseq = $word:0 - 3; # this number depends on the number of leading tables
     318   $mychip = $word:1
     319   if ($mychip != $chipName:$i)
     320    $chipNseq:$i = -1
     321    continue
     322   end
     323   $chipNseq:$i = $myNseq
     324   if ($VERBOSE) echo "found chip entry $chipNseq:$i ($chipName:$i) : $i $j $chipName:n $chipsRaw:n"
     325   $j ++
     326 end
     327 $chipNseq:n = $chipName:n
    261328end
    262329
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck/camstats.pro

    r41981 r42120  
    3838   # results in magFound, fracFound, numFound
    3939   calc.camstats
    40    if ($i == 0)
     40   if (numTotal_sum?[] == 0)
    4141     set numTotal_sum = numTotal
    4242     set numFound_sum = numFound
     
    5757 end
    5858   
    59  set numTotal = numTotal_sum
    60  set numFound = numFound_sum
    61  set numPoss  = numPoss_sum
    62  set numGood  = numGood_sum
    63  delete numTotal_sum numFound_sum numPoss_sum numGood_sum
     59 if (numTotal_sum?[] == 0)
     60   calc.camstats
     61 else
     62   set numTotal = numTotal_sum
     63   set numFound = numFound_sum
     64   set numPoss  = numPoss_sum
     65   set numGood  = numGood_sum
     66   delete numTotal_sum numFound_sum numPoss_sum numGood_sum
     67 end
    6468
    6569 set fracFound = (numTotal > 0) ? numFound / numTotal : zero(numTotal)
     
    7983  $BST2 = -tickpad 0.2 -xpad 3.5 -labelpadx 3.0 -ypad 0.5 -labelpady 0.0 +ypad 4.5 +labelpady 4.0 -labels 1001
    8084 
    81   section aM 0.00 0.66 0.65 0.33
    82   section aR 0.00 0.33 0.65 0.33
    83   section aD 0.00 0.00 0.65 0.33
    84 
    85   section bM 0.65 0.66 0.35 0.33
    86   section bR 0.65 0.33 0.35 0.33
    87   section bD 0.65 0.00 0.35 0.33
     85  section aM 0.00 0.66 0.65 0.33;  label -x mag -y "&sd&h mag"
     86  section aR 0.00 0.33 0.65 0.33;  label -x mag -y "&sd&h R.A."
     87  section aD 0.00 0.00 0.65 0.33;  label -x mag -y "&sd&h Dec"
     88
     89  section bM 0.65 0.66 0.35 0.33;  label -x mag -y "&sd&h mag"
     90  section bR 0.65 0.33 0.35 0.33;  label -x mag -y "&sd&h R.A."
     91  section bD 0.65 0.00 0.35 0.33;  label -x mag -y "&sd&h Dec"
     92
     93  if (RA_PSF?[] == 0)
     94    echo "no sources in datafile"
     95    return
     96  end
    8897
    8998  set dR = 3600*(RA_PSF - Rref)*dcos(Dref)
     
    256265 $Mdel = 0.25
    257266 
     267 if (Mref_out?[] == 0)
     268   create magBin $Mmin $Mmax $Mdel
     269   set numTotal = zero(magBin)
     270   set numFound = zero(magBin)
     271   set numPoss  = zero(magBin)
     272   set numGood  = zero(magBin)
     273   return
     274 end
     275
    258276 delete -q  magBin numTotal numPoss numFound numGood
    259277 for mag $Mmin $Mmax $Mdel
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck/diffmask.pro

    r41941 r42120  
    5151  # load the reference source table
    5252  # how to choose the name of the filter?
    53   data $refsrcs;
     53  data $refsrcs
     54
     55  # first check if the FITS table has any entries
     56  read -fits DATA -sizes
     57  if ($table:Ny == 0)
     58    echo "WARNING: empty reference table $refsrcs"
     59
     60    $OUT_FIELDS =
     61    foreach field $SMF_FIELDS_DIF $REF_FIELDS_DIF $XTR_FIELDS_DIF
     62      $OUT_FIELDS = $OUT_FIELDS $field\_out
     63      create -empty $field\_out
     64    end
     65   
     66    sprintf output "%s/%s.%s.dif.stf" $OUTDIR $expname $OUTVERSION
     67    write -fits DATA $output $OUT_FIELDS
     68    return
     69  end
     70
    5471  if ($USE_CAMSOURCE)
    5572   read -fits DATA Rref_out Dref_out Mref_out
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck/ippCheck

    r42058 r42120  
    5959  getargs -no-warp  BOOL  -var SKIP_WARP
    6060  getargs -no-diff  BOOL  -var SKIP_DIFF
    61   getargs -do-plots BOOL  -var DO_PLOTS;   
     61  getargs -no-plots BOOL  -var SKIP_PLOTS;   
    6262  getargs -use-refs BOOL  -var USE_REFSOURCE
    6363  getargs -camera   VALUE -var CAMERA;
     
    9797  end
    9898
    99   if ($DO_PLOTS) plot.exposure.real $expname
     99  if (not($SKIP_PLOTS)) plot.exposure.real $expname
    100100end
    101101
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck/warpmask.pro

    r41941 r42120  
    4444  # NOTE: Mref is chosen to match filter for this exposure
    4545  data $refsrcs                 ;
     46
     47  # first check if the FITS table has any entries
     48  read -fits DATA -sizes
     49  if ($table:Ny == 0)
     50    echo "WARNING: empty reference table $refsrcs"
     51
     52    # generate empty output vectors for output file
     53    $OUT_FIELDS =
     54    foreach field $REF_FIELDS_WRP $XTR_FIELDS_WRP
     55      $OUT_FIELDS = $OUT_FIELDS $field\_out
     56      create -empty $field\_out
     57    end
     58   
     59    sprintf output "%s/%s.%s.wrp.stf" $OUTDIR $expname $OUTVERSION
     60    write -fits DATA $output $OUT_FIELDS
     61
     62    return
     63  end
     64
    4665  if ($USE_CAMSOURCE)
    4766   read -fits DATA Rref_out Dref_out Mref_out
  • tags/ipp-ops-20220303-rc/ippTests/ippCheck/warpstats.pro

    r41941 r42120  
    2424   # results in magFound, fracFound, numFound
    2525   calc.warpstats
    26    if ($i == 0)
     26   if (numTotal_sum?[] == 0)
    2727     set numTotal_sum = numTotal
    2828     set numPoss_sum  = numPoss
     
    3939 end
    4040   
    41  set numTotal = numTotal_sum
    42  set numPoss  = numPoss_sum
    43  delete numTotal_sum numPoss_sum
     41 if (numTotal_sum?[] == 0)
     42    # generate vectors for empty inputs
     43   calc.warpstats
     44 else   
     45   set numTotal = numTotal_sum
     46   set numPoss  = numPoss_sum
     47   delete numTotal_sum numPoss_sum
     48 end
    4449
    4550 set fracPoss  = (numTotal > 0) ? numPoss  / numTotal : zero(numTotal)
     
    8994 $Mdel = 0.25
    9095 
     96 if (Mref_out?[] == 0)
     97   create magBin $Mmin $Mmax $Mdel
     98   set numTotal = zero(magBin)
     99   set numPoss  = zero(magBin)
     100   return
     101 end
     102
    91103 delete -q  magBin numTotal numPoss
    92104 for mag $Mmin $Mmax $Mdel
Note: See TracChangeset for help on using the changeset viewer.