IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42628


Ignore:
Timestamp:
Feb 16, 2024, 11:05:38 AM (2 years ago)
Author:
tdeboer
Message:

updating ippCheck to also do check and plots for warps

Location:
trunk/ippTests/ippCheck
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTests/ippCheck/camstats.pro

    r42125 r42628  
    216216 vstat -q numFound; $Nfound = $TOTAL
    217217 vstat -q numGood;  $Ngood  = $TOTAL
    218  
    219  fprintf "%d of %d total sources detected, %d unmasked" $Nfound $Ntotal $Ngood
     218 vstat -q numPoss;  $Nposs  = $TOTAL
     219 
     220 fprintf "%d of %d total sources detected, %d unmasked and %d possible" $Nfound $Ntotal $Ngood $Nposs
     221
     222 subset tmp = numTotal  where (magBin > 15) && (magBin < 20); vstat -q tmp; $numBrightTotal  = $TOTAL
     223 subset tmp = numPoss  where (magBin > 15) && (magBin < 20); vstat -q tmp; $numBrightPoss  = $TOTAL
     224 subset tmp = numFound where (magBin > 15) && (magBin < 20); vstat -q tmp; $numBrightFound = $TOTAL
     225 subset tmp = numGood  where (magBin > 15) && (magBin < 20); vstat -q tmp; $numBrightGood  = $TOTAL
     226
     227 fprintf "%d of %d total bright sources detected, %d unmasked and %d possible" $numBrightFound $numBrightTotal $numBrightGood $numBrightPoss
     228
    220229
    221230 legend.init 0.02 0.95 0.03 0.02
  • trunk/ippTests/ippCheck/ippCheck

    r42125 r42628  
    7777  $MATCH_RADIUS = 8.0; # XXX add option to set the radius?
    7878  $OUTVERSION = MPC
     79  $REFMODE = MPC;    # used by plot.exposure.user for input
    7980  $COPYMASKS = 0
    8081
     
    169170 
    170171  if (not($SKIP_WARP))
    171     load.warpstats $expname.stats/$expname.$REFMODE.wrp.stf
    172     plot.warpstats.fracs; png -name  $expname.stats/$expname.$REFMODE.wrpfracs.png
     172    load.camstats $expname.stats/$expname.$REFMODE.wrp.stf
     173    plot.camstats.fracs; png -name  $expname.stats/$expname.$REFMODE.wrpfracs.png
     174    plot.camstats.resid; png -name  $expname.stats/$expname.$REFMODE.wrpresid.png
    173175  end
    174176
     
    213215 
    214216  if (not($SKIP_WARP))
    215     load.warpstats $expglob.$REFMODE.wrp.stf
    216     plot.warpstats.fracs; png -name  $outroot.$REFMODE.wrpfracs.png
     217    load.camstats $expglob.$REFMODE.wrp.stf
     218    plot.camstats.fracs; png -name  $outroot.$REFMODE.wrpfracs.png
     219    plot.camstats.resid; png -name  $outroot.$REFMODE.wrpresid.png
    217220  end
    218221
  • trunk/ippTests/ippCheck/warpmask.pro

    r42125 r42628  
    88if (not($?USE_CAMSOURCE)) set USE_CAMSOURCE = 0
    99
     10$SMF_FIELDS_WRP = X_PSF Y_PSF RA_PSF DEC_PSF CAL_PSF_MAG PSF_QF PSF_QF_PERFECT
    1011$REF_FIELDS_WRP = Rref Dref Mref
    1112$XTR_FIELDS_WRP = Xref Yref Nref Q1ref
     
    7677
    7778  # delete any existing output vectors
    78   foreach field $REF_FIELDS_WRP $XTR_FIELDS_WRP
     79  foreach field $SMF_FIELDS_WRP $REF_FIELDS_WRP $XTR_FIELDS_WRP
    7980    delete -q $field\_out
    8081  end
     
    8283  # find matching entries in smf file
    8384  for i 0 $warpMask:n
    84     get.warp.mask.stats $warpMask:$i
    85 
     85    if ("$warpCMF:$i" == "")
     86      echo "no CMF file found for $i, skipping"
     87      continue
     88    end
     89    get.warp.detect.stats $warpCMF:$i
     90 
     91    if ("c" == "")
     92      echo "no mask file found for $i, skipping maskstats"
     93      set Q1ref_onchp = zero(Xref_onchp) + NAN
     94    else
     95      get.warp.mask.stats $warpMask:$i
     96    end
     97
     98    # only append if the FITS table has any entries
     99    data $warpCMF:$i
     100    read -fits SkyChip.psf -sizes
     101    if ($table:Ny >= 1)
     102      foreach field $SMF_FIELDS_WRP
     103        concat $field\_found $field\_out
     104        delete $field\_found
     105      end
     106    end
     107   
    86108    foreach field $REF_FIELDS_WRP $XTR_FIELDS_WRP
    87109      concat $field\_onchp $field\_out
     
    91113
    92114  $OUT_FIELDS =
    93   foreach field $REF_FIELDS_WRP $XTR_FIELDS_WRP
     115  foreach field $SMF_FIELDS_WRP $REF_FIELDS_WRP $XTR_FIELDS_WRP
    94116    $OUT_FIELDS = $OUT_FIELDS $field\_out
    95117  end
     
    97119  sprintf output "%s/%s.%s.wrp.stf" $OUTDIR $expname $OUTVERSION
    98120  write -fits DATA $output $OUT_FIELDS
     121end
     122
     123macro get.warp.detect.stats
     124  if ($0 != 2)
     125   echo "USAGE: get.warp.detect.stats (cmffile)"
     126   echo "  assumes existence of vectors (Rref, Dref, Mref)"
     127   echo "  matches known sources to detections in the cmf file"
     128   echo "  calculates detection fraction as a function of magnitude"
     129   echo "  also astrometric and photometric scatter vs magnitude for good detections"
     130   break
     131  end
     132
     133  local filename NAXIS1 NAXIS2
     134  $filename = $1
     135  if ("$filename" == "")
     136    echo "missing CMF file $filename, skipping"
     137    return
     138  end
     139
     140  # read in the image header portion
     141  # rd -n SkyChip.hdr hdr $filename
     142  # XXX apparently the warp cmf files have the hdr as the PHU?
     143  rd hdr $filename
     144  keyword hdr IMNAXIS1 NAXIS1
     145  keyword hdr IMNAXIS2 NAXIS2
     146
     147  coords -q hdr -p       0       0; init.radec.range
     148  coords -q hdr -p $NAXIS1       0; set.radec.range
     149  coords -q hdr -p $NAXIS1 $NAXIS2; set.radec.range
     150  coords -q hdr -p       0 $NAXIS2; set.radec.range
     151
     152  # generate a subset which could be on this skycell
     153  # do we need to grow the range at all?
     154  set keep = (Rref >= $minR) && (Rref <= $maxR) && (Dref >= $minD) && (Dref <= $maxD)
     155  foreach field $REF_FIELDS_WRP Nref
     156    subset $field\_tmp = $field if keep
     157  end
     158
     159  # convert the subset coordinates to pixels
     160  set Xref_tmp = Rref_tmp
     161  set Yref_tmp = Dref_tmp
     162  coords -q hdr -c Xref_tmp Yref_tmp
     163
     164  # generate a subset of sources which are within the boundaries of the skycell
     165  set keep = (Xref_tmp >= 0) && (Xref_tmp <= $NAXIS1) && (Yref_tmp >= 0) && (Yref_tmp <= $NAXIS2)
     166  foreach field $REF_FIELDS_WRP Nref Xref Yref
     167    subset $field\_onchp = $field\_tmp if keep
     168    delete $field\_tmp
     169  end
     170
     171  # now read the smf detections
     172  data $filename
     173  # first check if the FITS table has any entries
     174  read -fits SkyChip.psf -sizes
     175  if ($table:Ny >= 1)
     176    read -fits SkyChip.psf $SMF_FIELDS_WRP
     177
     178    match2d Xref_onchp Yref_onchp X_PSF Y_PSF $MATCH_RADIUS -closest
     179    foreach field $SMF_FIELDS_WRP
     180      reindex $field\_found = $field using index1 -keep-unmatched
     181    end
     182  end
     183
    99184end
    100185
     
    187272  echo "USAGE: get.warp.mask.files"
    188273  echo " uses warpPath:0 - warpPath:n"
     274  echo " sets warpCMF:0  - warpCMF:n"
    189275  break
    190276 end
     
    194280   sprintf filename "%s.mask.fits" $warpPath:$i
    195281   $warpMask:$i = `neb-locate -p $filename`
    196    if ($VERBOSE) echo "found warpPath $warpMask:$i"
    197    if ($COPYMASKS) exec neb-copy $filename $OUTDIR
     282   break -auto on
     283   if ("$warpMask:$i" == "")
     284     echo "skipping $filename"
     285   else
     286     if ($COPYMASKS) exec neb-copy $filename $OUTDIR
     287   end
     288
     289   sprintf filename "%s.cmf" $warpPath:$i
     290   $warpCMF:$i  = `neb-locate -p $filename`
     291   
     292   if ($VERBOSE) echo "found mask: $warpMask:$i CMF: $warpCMF:$i"
    198293 end
    199294 $warpMask:n = $warpPath:n
Note: See TracChangeset for help on using the changeset viewer.