NightOperations/Commissioning/pFPA: hpfsn.sm

File hpfsn.sm, 2.9 KB (added by stevenj, 7 months ago)
Line 
1hpfsn
2        #Plot sn results for HPF 14-point pointing test
3       
4        data sn.txt
5        read {sn_ 1 mn_ 2 pup 3 gciq 4 gctr 5}
6        #correct using inverse of pupil
7        #set sn = mn_ / pup / gctr #correct for transparency variations?
8        #   sometimes do this ^^ but make sure it doesn't change the result!
9        set sn = mn_ / pup #nothing but pupil
10        set i=1,$(dimen(sn_))
11       
12        macro read offset.sm
13        precalc
14        macro read hpfsn.sm
15        #this gets things ready for use....
16
17        dev postencap hpfcentering.ps
18        ctype black
19        era
20        define TeX_strings 1
21        expand 1.4
22       
23        lim -1.4 1.4 -1.4 1.4
24        lweight 1
25        box
26        xlabel X [arcsec]
27        ylabel Y [arcsec]
28        toplabel HPF centering analysis #at $date UT
29        ltype 1 relocate -5 0 draw 5 0 relocate 0 -5 draw 0 5 ltype 0
30       
31        #automatic, this is the pattern:
32        set x = {0 -0.5 -1 -0.5 0 0 0.5 0.5 1 0.5 0 0 -0.5 0}
33        set y = {0 0 0 0.5 0.5 1.0 0.5 0 0 -0.5 -0.5 -1 -0.5 0}
34       
35        #guess at offset, generate comparison
36        define xoff 0.00
37        define yoff -0.15
38        set dimen(pred) = $(dimen(x))
39        do i = 0,$(dimen(pred)-1) {
40            define tx $($(x[$i]) + $xoff)
41            define ty $($(y[$i]) + $yoff)
42            echo $tx,$ty
43            docalc $tx $ty
44            set pred[$i] = $docalc
45        }
46       
47        #normalize sn/flux
48        vecminmax sn mi ma
49        set snn = sn/$ma
50        print {i snn pred}
51        echo diff $(sum(abs(snn-pred)))
52       
53        #testing diffs  march 2020
54        #  0.0, 0.0 1.593
55        #  0.0,-0.4 0.747
56        # +0.1,-0.4 0.901
57        # -0.1,-0.4 0.953
58        #  0.0,-0.5 1.204
59        #  0.0,-0.3 0.491   #BEST fit
60        #  0.0,-0.2 0.710
61        # -0.1,-0.3 0.697
62        # +0.1,-0.3 0.660
63
64        # testing diffs  Nov 2020, post FPA takedown
65        #   0.0,  0.0  0.768  #BEST! whoa.
66        #  -0.1, -0.1  1.102
67        #  +0.1, +0.1  0.976
68        #  -0.1, +0.1  1.174
69        #  +0.1, -0.1  0.993
70        #   0.0, +0.01 0.762
71        #   0.0, +0.02 0.674 ok slightly better
72        #   0.0, +0.03 0.714
73        #  +0.01,+0.02 0.700
74        #  -0.01,+0.02 0.700
75
76         
77        #plot points
78        lweight 2
79        #scale AREA based on sn?
80        vecminmax sn mi ma
81        #echo SN min,max = $mi, $ma
82        #set efact = 3.0 + 10.5 * (sn-$mi)/$($ma-$mi)
83        #scaling now with normalize S/N
84        set efact  = 1 +  snn*10.0
85        set e2fact = 1 + pred*10.0
86        do i = 0,$(dimen(x)-1) {
87           ctype black ptype 50 3
88           expand $((efact[$i])**1)
89           relocate $(x[$i]) $(y[$i])
90           if ($i==13) {
91             ctype green ptype 50 0
92             dot
93             expand 0.7 relocate $(x[$i]) $(y[$i]-0.2)
94             putlabel 8 $($i+1)
95           } ELSE {
96             ctype black
97             dot
98             ctype white expand 0.7 putlabel 5 $($i+1)
99           }
100           #label predictions, too
101           relocate $(x[$i]) $(y[$i])
102           ctype red ptype 50 0 expand $((e2fact[$i]))
103           dot
104        }
105
106        #legend labels
107        expand 1.3
108
109        ctype black
110        relocate -1.3 1.2
111        label circles show flux at
112        relocate -1.3 1.1
113        label   each position
114       
115        relocate 0.2 1.2
116        label 2022 09 05 UT data
117        relocate 0.2 1.1
118        label   clear sky, $fwhm_arcsec\" seeing
119
120
121        ctype red
122        relocate 0.2 0.9
123        label predicted fluxes w/
124        relocate 0.2 0.8
125        label   x_{off},y_{off} = $xoff\",$yoff\"
126       
127        dev nodevice
128        !ps2pdf hpfcentering.ps
129        !pdfcrop hpfcentering.pdf
130        !xdg-open hpfcentering-crop.pdf
131
132
133a
134        macro read hpfsn.sm
135        hpfsn