1 | offset |
---|
2 | #figuring out how much a positional offset matters to HPF centering |
---|
3 | # |
---|
4 | #assuming a moffat PSF of star |
---|
5 | #HPF science fiber is 1.7" diameter (octagonal, but treat as circle) |
---|
6 | |
---|
7 | precalc |
---|
8 | |
---|
9 | #calculate flux at a given offset (x,y in arcsec) |
---|
10 | echo (0.0,0.0) |
---|
11 | docalc 0.0 0.0 |
---|
12 | echo "" |
---|
13 | |
---|
14 | echo (0.1,0.1) |
---|
15 | docalc 0.1 0.1 |
---|
16 | echo "" |
---|
17 | |
---|
18 | echo (0.2,0.2) |
---|
19 | docalc 0.2 0.2 |
---|
20 | echo "" |
---|
21 | |
---|
22 | echo (0.3,0.3) |
---|
23 | docalc 0.3 0.3 |
---|
24 | echo "" |
---|
25 | |
---|
26 | echo (0.5,0.5) |
---|
27 | docalc 0.5 0.5 |
---|
28 | echo "" |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | precalc |
---|
33 | #make a grid? use "image" from SM?? |
---|
34 | # coordinate 50,50 is center 1,1 and 100,100 are min/max |
---|
35 | #treat this range as covering -5 to +5 arcsec, so index step is 0.1" |
---|
36 | IMAGE ( 100, 100 ) |
---|
37 | define step 0.1 |
---|
38 | define xcent 50 |
---|
39 | define ycent 50 |
---|
40 | |
---|
41 | define fwhm_arcsec 1.3 |
---|
42 | |
---|
43 | |
---|
44 | define fwhm $($fwhm_arcsec/$step) |
---|
45 | |
---|
46 | #populate 2-D array with PSF |
---|
47 | do x=0,99 { do y=0,99 { |
---|
48 | #calculate radius of this pixel |
---|
49 | define r $(sqrt( ($x-$xcent)**2 + ($y-$ycent)**2 )) |
---|
50 | #echo $x $y $r |
---|
51 | moffat $r |
---|
52 | set image[$x,$y]=$moffat |
---|
53 | }} |
---|
54 | |
---|
55 | verbose 0 |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | docalc 2 |
---|
65 | #calculate enclosed flux in a 1.7" diameter fiber |
---|
66 | define _xoff $1 #0.0 |
---|
67 | define _yoff $2 #0.0 |
---|
68 | #MAX is 2 arcsec, or else we lose too much |
---|
69 | if ($_xoff>2 || $_yoff>2){ |
---|
70 | echo OFFSET must be less than 2arcsec |
---|
71 | define $0 0 |
---|
72 | } ELSE { |
---|
73 | define fsum 0.0 |
---|
74 | define diameter_arcsec 1.7 |
---|
75 | define rmax $(0.5*$diameter_arcsec/$step) |
---|
76 | do _x=0,99 { do _y=0,99 { |
---|
77 | #calculate radius of this pixel |
---|
78 | define r $(sqrt( ($_x-$xcent+$_xoff/$step)**2 + ($_y-$ycent+$_yoff/$step)**2 )) |
---|
79 | if ($r <= $rmax) { |
---|
80 | define fsum $($fsum+$(image[$_x,$_y])) |
---|
81 | } |
---|
82 | }} |
---|
83 | define $0 $($fsum/161.38) |
---|
84 | echo $(sprintf('%3.3f',$$0)) of centered at $1 $2 |
---|
85 | } |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | func 1 |
---|
95 | define $0 $($1+2) |
---|
96 | moffat 1 |
---|
97 | define beta 4.765 |
---|
98 | define alpha $($fwhm * 0.5 / sqrt(2**(1/$beta) - 1)) |
---|
99 | define $0 $(1e0 * (1 + ($1/$alpha)**2 )**(-$beta)) |
---|
100 | |
---|
101 | |
---|
102 | a |
---|
103 | macro read offset.sm |
---|
104 | offset |
---|