Changeset 41720 for trunk/tools/eam/teleff/warpstats.sh
- Timestamp:
- Jul 14, 2021, 3:30:26 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/tools/eam/teleff/warpstats.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/teleff/warpstats.sh
r41712 r41720 1 1 2 macro warpstats.glob2 macro load.warpstats 3 3 if ($0 != 2) 4 echo "USAGE: warpstats (glob)"4 echo "USAGE: load.warpstats (glob)" 5 5 break 6 6 end 7 7 8 delete -q Rref Dref Xref Yref Q1ref 8 # accumulate these fields for comparison plots 9 $FIELDS = Rref Dref Mref 10 11 # delete accumulation vectors 12 delete -q $FIELDS 9 13 10 14 list name -glob $1 11 15 for i 0 $name:n 12 16 17 echo "reading from $name:$i" 13 18 data $name:$i 14 19 read -fits DATA -sizes … … 20 25 calc.warpstats 21 26 if ($i == 0) 22 set magFound_sum = magFound23 27 set numTotal_sum = numTotal 24 28 set numPoss_sum = numPoss 25 29 else 30 set numTotal_sum = numTotal + numTotal_sum 26 31 set numPoss_sum = numPoss + numPoss_sum 27 set numTotal_sum = numTotal + numTotal_sum28 32 end 29 concat RrefSS Rref 30 concat DrefSS Dref 31 concat XrefSS Xref 32 concat YrefSS Yref 33 concat Q1refSS Q1ref 33 foreach field $FIELDS 34 concat $field\_out $field 35 end 36 37 # cleanup by deleting the loaded vectors 38 delete -q $allfields 34 39 end 35 40 36 set magFound = magFound_sum37 41 set numTotal = numTotal_sum 38 set fracPoss = numPoss_sum / numTotal_sum 42 set numPoss = numPoss_sum 43 delete numTotal_sum numPoss_sum 39 44 40 plot.warpstats 41 42 # plot.warpsky 45 set fracPoss = (numTotal > 0) ? numPoss / numTotal : zero(numTotal) 43 46 end 44 47 45 macro warpstats.single 46 if ($0 != 2) 47 echo "USAGE: warpstats (file)" 48 break 49 end 50 51 data $1 52 read -fits DATA -list-fields -q 53 list tfields -join allfields 54 read -fits DATA $allfields 48 # assumes we have loaded values from the stf tables 49 # magBin, numTotal, numFound, numPoss, numGood 50 macro plot.warpstats.fracs 55 51 56 # assumes data has been loaded57 # results in magFound, fracFound, numFound58 calc.warpstats59 60 plot.warpstats61 end62 63 macro plot.warpstats64 52 clear -s 65 53 resize 1800 1200 66 54 label -fn helvetica 18 55 $BSTY = -tickpad 0.2 -xpad 3.5 -labelpadx 3.0 -ypad 4.5 -labelpady 4.0 +ypad 4.5 +labelpady 4.0 56 57 # plot the detection fractions, using left axis 67 58 section a 0 0 1 1 68 $BSTY = -tickpad 0.2 -xpad 3.5 -labelpadx 3.0 -ypad 4.5 -labelpady 4.0 +ypad 5.5 +labelpady 5.069 lim magFound -0.02 1.02; box $BSTY -ticks 1110; 70 plot -x hist mag FoundfracPoss -lw 3 -c blue7071 label -x mag -y "detectable fraction" 72 subset tmp = fracPoss where (magFound > 15) && (magFound < 20); vstat -q tmp; $FracBrightPoss= $MEDIAN59 lim magBin -0.02 1.02; box $BSTY -ticks 1110; 60 61 plot -x hist magBin fracPoss -lw 3 -c blue70 62 63 subset tmp = fracPoss where (magBin > 15) && (magBin < 20); vstat -q tmp; $FracBrightPoss = $MEDIAN 73 64 line -c blue -lt dot -lw 2 100 $FracBrightPoss to 0 $FracBrightPoss 74 fprintf "%.1f-pct of sources are unmasked" {100*$FracBrightPoss}75 65 66 fprintf "%.1f-pct of bright sources were detectable (unmasked)" {100*$FracBrightPoss} 67 68 label -x mag -y "detected fraction" 69 70 # plot the total number of detected sources, using the right axis 76 71 section b 0 0 1 1 77 lim magFound numTotal; box $BSTY -ticks 1011 -labels 0001; plot -x hist magFound numTotal -c grey70 -lw 2 78 label +y "reference catalog numbers" 72 lim magBin numTotal; box $BSTY -ticks 1011 -labels 0001 73 74 plot -x hist magBin numTotal -c grey80 -lw 2 75 label +y "detected number" 76 77 $Xlegend = 0.02; $dXlegend = 0.03 78 $Ylegend = 0.95; $dYlegend = 0.02 79 line -frac $Xlegend $Ylegend to {$Xlegend + $dXlegend} $Ylegend -c blue -lw 3; textline -frac -justify 5 {$Xlegend + $dXlegend + 0.01} $Ylegend "unmasked source positions (psfqf > 0.85)"; $Ylegend -= $dYlegend 79 80 end 80 81 81 macro plot.warpsky 82 83 dev -n sky 84 vstat -q Rref; $Ro = $MEDIAN 85 vstat -q Dref; $Do = $MEDIAN; $PlotRadius = 0.6*($MAX - $MIN) 86 region -n sky $Ro $Do $PlotRadius 87 cplot -pt box -sz 0.3 -op 0.1 -c black Rref Dref 88 89 # create t 0 360 0.01 90 # set dR = 3*dcos(t)/2.0 91 # set dD = 3*dsin(t)/2.0 92 # set Dc = $Do + dD 93 # set Rc = $Ro + dR/dcos(Dc) 94 # cplot -x line Rc Dc -c blue -lw 2 95 end 96 97 82 # relies on the following vectors: Mref_out, Q1ref_out, PSF_QF_out, X_PSF_out 98 83 macro calc.warpstats 99 84 $Mmin = 10 … … 101 86 $Mdel = 0.25 102 87 103 delete -q magFound numTotal numPoss fracPoss88 delete -q magBin numTotal numPoss 104 89 for mag $Mmin $Mmax $Mdel 105 concat $mag mag Found90 concat $mag magBin 106 91 107 # what fraction of the sources were actually detected?108 set keep mag = (MrefSS > $mag - 0.5*$Mdel) && (MrefSS<= $mag + 0.5*$Mdel)109 subset XinBin = XrefSS if keepmag110 concat XinBin[] numTotal92 # sources in mag bin 93 set keepSrc = (Mref_out > $mag - 0.5*$Mdel) && (Mref_out <= $mag + 0.5*$Mdel) 94 subset tmp = Mref_out if keepSrc 95 concat tmp[] numTotal 111 96 112 97 # what fraction of the sources could have been detected (mask fraction > 0.85 at position)? 113 set keepgood = keepmag && (Q1refSS > 0.85) 114 subset XinBinGood = XrefSS if keepgood 115 concat {XinBinGood[]/XinBin[]} fracPoss 116 concat XinBinGood[] numPoss 98 set keepMsk = keepSrc && (Q1ref_out > 0.85) 99 subset tmp = Mref_out if keepMsk 100 concat tmp[] numPoss 117 101 end 102 103 delete -q tmp keepSrc keepMsk keepDet 118 104 end 119
Note:
See TracChangeset
for help on using the changeset viewer.
