- Timestamp:
- Apr 13, 2019, 12:48:05 PM (7 years ago)
- Location:
- trunk/doc/release.2015/ps1.analysis/examples
- Files:
-
- 2 edited
-
.mana (modified) (1 diff)
-
moments.sh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/release.2015/ps1.analysis/examples/.mana
r40690 r40693 84 84 vstat e1 85 85 vstat e2 86 imsmooth.2d 87 imsmooth.generic 88 imsmooth 89 fft2d 90 input moments.sh 91 input moments.sh 92 opihi verbose on 93 input moments.sh 94 pwd 95 !cat moments.sh 96 input moments.sh 97 opihi verbose off 98 show.smear 99 show.smear 1.0 100 buffers 101 input moments.sh 102 show.smear 1.0 103 input moments.sh 104 show.smear 1.0 105 buffers 106 tv -n 0 -ch 1 f0 -0.01 0.5 107 tv -n 0 -ch 1 f0 -0.01 1.0 108 tv -n 0 -ch 2 psf -0.01 1.0 109 tv -n 0 -ch 2 psf -0.01 0.5 110 tv -n 0 -ch 2 fs -0.01 1.0 111 stat fs 112 tv -n 0 -ch 2 fs 0 2e-9 113 tv im_R -0.01 0.1 114 stat im_R 115 tv im_R -0.0005 0.001 116 tv im_I 117 stat im_I 118 tv kr_R -0.0005 0.001 119 tv ff_R 120 stat ff_R 121 stat kr_R 122 set ff_R = ff_R * 512^2 123 set ff_I = ff_I * 512^2 124 stat ff_R 125 tv ff_R 0 0.05 126 tv ff_I 0 0.05 127 stat ff_I 128 fft2d -inverse ff_R ff_I to ot_R ot_I 129 stat ot_R 130 set out_R = out_R * 512^2 131 set out_R = ot_R * 512^2 132 set out_I = ot_I * 512^2 133 stat out_R 134 stat out_I 135 tv out_R 136 set fs = fs * 512^4 137 tv fs 138 tv fs 0 152 139 tv fs 0 512 140 input moments.sh 141 show.smear 1.0 142 tv -n 0 -ch 2 fs 0 1 143 tv -n 0 -ch 2 psf 0 1 144 tv -n 0 -ch 2 psf 0 0.5 145 tv -n 0 -ch 1 f0 0 0.5 146 tv -n 0 -ch 3 fs 0 0.5 147 star 148 star f0 256 256 128 149 star -q f0 256 256 128; $Mxx = ($SXg/2.355)^2; $Myy = ($SYg/2.355)^2; 150 ?? 151 star -q f0 256 256 128; $Mxx = ($SXg/2.355)^2; $Myy = ($SYg/2.355)^2; echo $Zcg $Mxx $SXYg $Myy 152 star -q psf 256 256 128; $Mxx = ($SXg/2.355)^2; $Myy = ($SYg/2.355)^2; echo $Zcg $Mxx $SXYg $Myy 153 star -q fs 256 256 128; $Mxx = ($SXg/2.355)^2; $Myy = ($SYg/2.355)^2; echo $Zcg $Mxx $SXYg $Myy 154 echo {1256.63706807*25.1327415272} 155 input moments.sh 156 show.smear 157 show.smear 1 158 input moments.sh 159 show.smear 160 show.smear 1 161 input moments.sh 162 show.smear 1 163 lim -n 2 theta e1_o; clear; box; plot theta e1_o -c blue; plot theta e1_s -c red 164 vectors 165 create t 0 720 5 166 vectors 167 create t 0 360 5 168 vectors 169 lim -n 2 t e1_o; clear; box; plot t e1_o -c blue; plot t e1_s -c red 170 lim -n 2 t e1_o; clear; box; plot t e1_o -c blue; plot t e1_s -c red; plot t e2_o -c blue -pt box; plot t e2_s -c red -pt box 171 lim -n 2 t e1_o; clear; box; plot t e1_o -c blue; plot t e1_s -c red; plot t e2_o -c blue -pt obox; plot t e2_s -c red -pt obox 172 input moments.sh 173 show.smear 1 174 star psf {psf[][0]/2} {psf[0][]/2} 128 175 $Mxx_p = ($SXg/2.355)^2; $Myy_p = ($SYg/2.355)^2; $Mxy_p = $SXYg 176 lim -n 2 theta Mxx_s; clear; box; plot t Mxx_o -c blue; plot t Mxx_s -c red 177 set Mxx_S = Mxx_o + $Mxx_p 178 lim -n 2 theta Myy_s; clear; box; plot theta Myy_o -c blue; plot theta Myy_s -c red 179 lim -n 2 theta 0 200; clear; box; plot theta Myy_o -c blue; plot theta Myy_s -c red 180 lim -n 2 theta 0 150; clear; box; plot theta Myy_o -c blue; plot theta Myy_s -c red 181 set dMxx = Mxx_s - Mxx_o 182 set dMxy = Mxy_s - Mxy_o 183 set dMyy = Myy_s - Myy_o 184 lim -n 2 theta dMxx; clear; box; plot theta dMxx 185 line -c red $Mxx_p 0 to $Mxx_p 360 186 line -c red 0 $Mxx_p to 360 $Mxx_p 187 lim -n 2 theta dMxx; clear; box; plot theta dMxx; line -c red 0 $Mxx_p to 360 $Mxx_p 188 lim -n 2 theta dMyy; clear; box; plot theta dMyy; line -c red 0 $Myy_p to 360 $Myy_p 189 vstat dMyy 190 lim -n 2 theta 35 37; clear; box; plot theta dMyy; line -c red 0 $Myy_p to 360 $Myy_p 191 lim -n 2 theta dMxx; clear; box; plot theta dMxx; line -c red 0 $Mxx_p to 360 $Mxx_p 192 lim -n 2 theta dMxy; clear; box; plot theta dMxy; line -c red 0 $Mxy_p to 360 $Mxy_p 193 lim -n 1 theta Mxy_s; clear; box; plot theta Mxy_s -c red -pt cir -sz 2; plot theta Mxy_o -c blue -pt cir -sz 2; line -c red 0 $Mxy_p to 360 $Mxy_p 194 input moments.sh 195 show.smear 1 196 lim -n 1 theta Mxy_s; clear; box; plot theta Mxy_s -c red -pt cir -sz 2; plot theta Mxy_o -c blue -pt cir -sz 2; line -c red 0 $Mxy_p to 360 $Mxy_p 197 set dMxy = Mxy_s - Mxy_o 198 lim -n 2 theta dMxy; clear; box; plot theta dMxy; line -c red 0 $Mxy_p to 360 $Mxy_p -
trunk/doc/release.2015/ps1.analysis/examples/moments.sh
r40690 r40693 1 2 macro imconvolve 3 if ($0 != 4) 4 echo "USAGE: imconvolve (image) (kernel) (output)" 5 break 6 end 7 8 # if kernel is not the same size as input, pad 9 if ($1[][0] != $2[][0]) 10 echo "image sizes do not match" 11 break 12 end 13 if ($1[0][] != $2[0][]) 14 echo "image sizes do not match" 15 break 16 end 17 18 local Nx Ny 19 $Nx = $1[][0] 20 $Ny = $1[0][] 21 22 fft2d $1 0 to im_R im_I 23 fft2d $2 0 to kr_R kr_I 24 25 $Npix = $Nx*$Ny 26 set ff_R = $Npix*(im_R * kr_R - im_I * kr_I) 27 set ff_I = $Npix*(im_I * kr_R + im_R * kr_I) 28 29 fft2d -inverse ff_R ff_I to ot_R ot_I 30 set tmppow = $Npix*sqrt(ot_R^2 + ot_I^2) 31 32 extract tmppow $3 0 0 {$Nx/2} {$Ny/2} {$Nx/2} {$Ny/2} $Nx $Ny 33 extract tmppow $3 {$Nx/2} 0 {$Nx/2} {$Ny/2} 0 {$Ny/2} $Nx $Ny 34 extract tmppow $3 0 {$Ny/2} {$Nx/2} {$Ny/2} {$Nx/2} 0 $Nx $Ny 35 extract tmppow $3 {$Nx/2} {$Ny/2} {$Nx/2} {$Ny/2} 0 0 $Nx $Ny 36 end 1 37 2 38 macro show.pol … … 30 66 end 31 67 68 macro show.smear 69 if ($0 != 2) 70 echo "USAGE: show.smear (sigma)" 71 break 72 end 73 74 mcreate z 512 512 75 set x = xramp(z) - z[][0]/2 76 set y = yramp(z) - z[0][]/2 77 78 set f0 = 10*exp(-0.5*((x/2)^2 + (y/10)^2)) 79 set psf_r = exp(-0.5*((x/2)^2 + (y/6)^2)) 80 rotate psf_r 30.0 81 extract psf_r psf {psf_r[][0]/2 - 256} {psf_r[0][]/2 - 256} 512 512 0 0 512 512 82 star -q psf {psf[][0]/2} {psf[0][]/2} 128 83 $Mxx_p = ($SXg/2.355)^2 84 $Myy_p = ($SYg/2.355)^2 85 $Mxy_p = $SXYg 86 87 delete -q e1_s e2_s e1_o e2_o theta Mxx_s Mxy_s Myy_s Mxx_o Mxy_o Myy_o 88 for rot 0 360 5 89 set fr = f0 90 rotate fr $rot 91 delete -q frs 92 extract fr frs {fr[][0]/2 - 256} {fr[0][]/2 - 256} 512 512 0 0 512 512 93 94 imconvolve frs psf fs 95 96 star -q fs {fs[][0]/2} {fs[0][]/2} 128 97 98 $Mxx = ($SXg/2.355)^2 99 $Myy = ($SYg/2.355)^2 100 $Mxy = $SXYg 101 102 $T = $Mxx + $Myy 103 $e1 = ($Mxx - $Myy) / $T 104 $e2 = 2*$Mxy / $T 105 106 concat $rot theta 107 concat $e1 e1_s 108 concat $e2 e2_s 109 concat $Mxx Mxx_s 110 concat $Mxy Mxy_s 111 concat $Myy Myy_s 112 113 # fr is the rotate version of f0 114 star -q fr {fr[][0]/2} {fr[0][]/2} 128 115 116 $Mxx = ($SXg/2.355)^2 117 $Myy = ($SYg/2.355)^2 118 $Mxy = $SXYg 119 120 $T = $Mxx + $Myy 121 $e1 = ($Mxx - $Myy) / $T 122 $e2 = 2*$Mxy / $T 123 124 concat $e1 e1_o 125 concat $e2 e2_o 126 concat $Mxx Mxx_o 127 concat $Mxy Mxy_o 128 concat $Myy Myy_o 129 end 130 131 lim -n graph -1.5 1.5 -1.5 1.5; clear; box; plot -pt cir -sz 2 -c blue e1_o e2_o; plot -pt cir -sz 2 -c red e1_s e2_s; 132 end 32 133 33 134 macro test.rot
Note:
See TracChangeset
for help on using the changeset viewer.
