-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallfft.pro
153 lines (130 loc) · 3.3 KB
/
allfft.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
!p.position=0
!p.multi=0
pload, 0, dir='q01', /nodata
nfile=2
tptr=ptrarr(12)
qarr=[0.1, 0.3,0.5,0.7,0.9,1.3,1.5,1.9,1.9]
for i=0,7 do begin
dirnum=qarr[i]
dirtag='q'+string(dirnum*10, format='(I02)')+'/'
print, dirtag
PLOAD, 0, DIR = dirtag, var='vx2'
vy0=vx2(*,*,0)
PLOAD, nfile, DIR = dirtag;, var='vx3'
vx=vx1(*,*,0)
vy=vx2(*,*,0)-vy0
vz=vx3(*,*,0)
narr=reform(sqrt(vx^2+vy^2+vz^2))
;narr=remapfunc (bx2(*,*,0) , t[nfile], nx1,nx2,qarr[i], x1,x2,dx2)
;narr=congrid(narr, nx2,nx2)
tptr[i]=ptr_new(reform(narr))
endfor
items=[ $
'q=0.1' $
, 'q=0.5' $
, 'q=0.7' $
, 'q=0.9' $
, 'q=1.3' $
, 'q=1.5' $
, 'q=1.7' $
, 'q=1.9' $
]
cl=[ $
'red' $
, 'orange' $
, 'yellow' $
, 'green' $
, 'blue' $
, 'violet' $
, 'black' $
, 'black' $
]
ls=[0,1,2,3,4,5,6,7]
;tmax=max([t1,t2,t3 , $
; t4, t13, t15, t17,t19 ])/2/!DPI
;ymax=10*max( [ abs(bxy1) , abs(bxy2) , abs(bxy3) ] )
thick=2.
;cgplot, *tptr[0]/2./!DPI, abs(*bptr[0]), /ylog, yrange=[1e-6*ymax,ymax], color=cl[0], xrange=[0,tmax], lines=ls[0], $
; xtitle='t, orbits', $
; ytitle='BxBy '
pos=cglayout([4,2] , OXMargin=[13,1], OYMargin=[14,1], XGap=0, YGap=0)
;pos=cglayout([4,2] , OXMargin=[9,1], OYMargin=[13,2], XGap=1, YGap=4)
xs=1800
ys=xs/2
cgdisplay,wid=4, xs=xs, ys=ys
cgerase
cgloadct,33
fname="qfft"
for usingps=0,1 do begin
if (usingps eq 1) then begin
cgps_open, fname+'.eps', /encapsulated, /color, tt_font='Times', /quiet, font=1
omega_str='!9W!X'
charsize=cgdefcharsize()*.7
endif else begin
set_plot, 'x'
omega_str='!7X!X'
endelse
kx=(findgen(nx1)/nx1-0.5d)*nx2
ky=findgen(nx2)-nx2/2
qsm=10
for i=0,7 do begin
;cgplot, *tptr[i]/2./!DPI, abs(*bptr[i]), /overplot, color=cl[i], lines=ls[i]
px=pos[*,i]
dat=*tptr[i]
dat=alog10( abs (fft (*tptr[i] , /center)+1e-6))
dat=congrid(dat, nx2,nx2)
dgft= (abs (fft (*tptr[i] , /center)+1e-6))
dgft=congrid(dgft, nx2,nx2)
dgft=smooth(dgft ,qsm, /edge_wrap)
kx=ky
r=cgscalevector(smooth(dat,qsm, /edge_wrap),1,254)
imin=min(dat)
imax=max(dat)
;print, 'q', qarr[i], imin, imax
cgimage, r , pos=px, /noerase , /keep_aspect_ratio
qe=0.01
xtickf="(a1)"
xtit=''
if ( i gt 3 ) then begin
xtickf="(I4)"
xtit="k!DX!N"
qe=0.07
endif
;cgcolorbar, range=[imin,imax], pos=[px[0] , px[1]-0.01-qe, px[2],px[1]-qe], charsize=charsize
ytickf="(a1)"
ytit=''
if ( (i mod 4) eq 0 ) then begin
ytickf="(I4)"
ytit="k!DY!N"
endif
cgcontour, r, kx, ky, $
/noerase, $
/nodata, $
xtickinterval=100,$
ytickinterval=100,$
xtickf=xtickf,$
ytickf=ytickf,$
pos=px, $
charsize=charsize, $
xtitle=xtit, $
ytitle=ytit
;ytitle='q='+string(qarr[i],format='(F4.1)')+' , k!DY!N'
gft=gauss2dfit(dgft, aa,/tilt)
;print, 'a,b',aa[2], aa[3], aa[2]/aa[3]
print, 'q=',qarr[i],' , a/b', aa[2]/aa[3]
cgcontour, gft, kx,ky, pos=px, color='Black', label=0, /overplot ;, lev=[1e-5,1e-4, 1e-3]
cgtext, -100,72 , 'q='+string(qarr[i],format='(F4.1)') ,color='white'
endfor
if ( usingps ) then begin
;device,/close
cgps_close, /jpeg, Width=2048, /nomessage, delete_ps=0
;set_plot,'x'
endif else begin
;set_plot,'x'
fname2=fname
;im=cgsnapshot(filename=fname2,/nodialog,/jpeg)
endelse
endfor
;al_legend, items, lines=ls, colors=cl, /right, charsize=cgdefcharsize()*1.5, linsize=.25
READ_JPEG, 'qfft.jpg', a, TRUE=1 & cgimage, a
end