-
Notifications
You must be signed in to change notification settings - Fork 5
/
juwplot.jl
59 lines (49 loc) · 1.91 KB
/
juwplot.jl
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
module juwplot
import PyPlot
function tfrshow(tfrs,dx,x1,xend,fin1=NaN,finend=NaN,asp=0.7,cmap="CMRmap",vmin=NaN,vmax=NaN)
nft=size(tfrs,1)
nsample=size(tfrs,2)
freqfac=1/nsample/dx/2
if isnan(fin1) || isnan(finend)
f1=freqfac
fe=freqfac*size(tfrs,1)
else
offset=(finend-fin1)/nft
f1=(fin1-offset)*freqfac
fe=(finend-offset)*freqfac
end
if isnan(vmin) || isnan(vmax)
a=PyPlot.imshow(real(tfrs[end:-1:2,:]),cmap=cmap,extent=[x1,xend,f1,fe],aspect=asp*(xend-x1)/(fe-f1),interpolation="nearest")
else
a=PyPlot.imshow(real(tfrs[end:-1:2,:]),cmap=cmap,extent=[x1,xend,f1,fe],aspect=asp*(xend-x1)/(fe-f1),interpolation="nearest",vmin=vmin,vmax=vmax)
end
return a
end
function wtfrshow(tfrs,dx,x1,xend,fin1=NaN,finend=NaN,asp=0.7,cmap="CMRmap",vmin=NaN,vmax=NaN)
nsample=size(tfrs,2)
freqfac=1/nsample/dx/2
if isnan(fin1) || isnan(finend)
f1=freqfac
fe=freqfac*size(tfrs,1)
else
offset=(finend-fin1)/nsample
f1=(fin1-offset)*freqfac
fe=(finend-offset)*freqfac
end
endi=round(Int,size(tfrs,1)/2.0)
if isnan(vmin) || isnan(vmax)
a=PyPlot.imshow(real(tfrs[endi:-1:2,:]),cmap=cmap,extent=[x1,xend,f1,fe],aspect=asp*(xend-x1)/(fe-f1),interpolation="nearest")
else
a=PyPlot.imshow(real(tfrs[endi:-1:2,:]),cmap=cmap,extent=[x1,xend,f1,fe],aspect=asp*(xend-x1)/(fe-f1),interpolation="nearest",vmin=vmin,vmax=vmax)
end
return a
end
function tfrshow_manual(tfrs,dx,x1,xend,f1,fe,asp=0.7,cmap="CMRmap",vmin=NaN,vmax=NaN)
if isnan(vmin) || isnan(vmax)
a=PyPlot.imshow(real(tfrs[end:-1:2,:]),cmap=cmap,extent=[x1,xend,f1,fe],aspect=asp,interpolation="nearest")
else
a=PyPlot.imshow(real(tfrs[end:-1:2,:]),cmap=cmap,extent=[x1,xend,f1,fe],aspect=asp,interpolation="nearest",vmin=vmin,vmax=vmax)
end
return a
end
end