source: BAORadio/AmasNancay/trunk/imgdrift.pic@ 639

Last change on this file since 639 was 639, checked in by campagne, 14 years ago

improve interactive drift analysis (jec)

File size: 5.6 KB
RevLine 
[638]1#source en minuscule
2set source $1
3set srcMaj $2
4set date $3
5set fcycle $4
6set lcycle $5
7set nframes $6
8maxcycle = ${lcycle}+1
9
10set path "/sps/baoradio/AmasNancay/JEC/${srcMaj}"
11
[639]12#first script executed
[638]13clearscript image
[639]14
15#mergeimg should be executed before timeevol, fwhnInt
16clearscript mergeimg
17clearscript timeevol
18clearscript fwhmInt
19
20#script independant from mergeimg
21clearscript timeevol2
[638]22#######################
23defscript image
24#
25set cycle $1
26openppf ${path}/img_${date}_${source}_cycle${cycle}.ppf
27del ich0
28objaoper img${cycle} slicexz 0 ich0
29c++exec TMatrix<r_4>zCh0(ich0(Range(0),Range::all()),false); \
30for (sa_size_t i=1;i<50;i++){zCh0+=ich0(Range(i),Range::all());} \
31zCh0/=50.; \
32for (sa_size_t i=0;i<ich0.NRows();i++){ich0(Range(i),Range::all())-=zCh0;}
33#
34rename ich0 ich${cycle}0
35
36del ich1
37objaoper img${cycle} slicexz 1 ich1
38c++exec TMatrix<r_4>zCh1(ich1(Range(0),Range::all()),false); \
39for (sa_size_t i=1;i<50;i++){zCh1+=ich1(Range(i),Range::all());} \
40zCh1/=50.; \
41for (sa_size_t i=0;i<ich1.NRows();i++){ich1(Range(i),Range::all())-=zCh1;}
42#
43rename ich1 ich${cycle}1
44
45endscript
46#######################
47
48
[639]49#######################
50defscript mergeimg
51#
[638]52del ich0Tot
53del ich1Tot
54del ncycles
55c++exec TMatrix<r_4>ich0Tot(ich${fcycle}0(Range(0,${nframes}),Range::all()),false); \
56 TMatrix<r_4>ich1Tot(ich${fcycle}1(Range(0,${nframes}),Range::all()),false); \
57 TVector<r_4>ncycles(1); ncycles(0)=1; \
58 KeepObj(ich0Tot); KeepObj(ich1Tot); KeepObj(ncycles);
59
60fp1cycle = ${fcycle}+1
61
62for ic ${fp1cycle}:${maxcycle}
63 c++exec ich0Tot+=ich${ic}0(Range(0,${nframes}),Range::all()); \
64 ich1Tot+=ich${ic}1(Range(0,${nframes}),Range::all()); \
65 ncycles(0)+=1;
66end
67
68c++exec ich0Tot/=ncycles(0); ich1Tot/=ncycles(0);
69
70setaxesatt 'font=helvetica,bold,14 fixedfontsize'
71newwin
72disp ich0Tot 'lut=lin,-0.1,3.5 colbr128 showcmap=top'
73
74newwin
75disp ich1Tot 'lut=lin,-0.1,3.5 colbr128 showcmap=top'
[639]76endscript
77#######################
78defscript timeevol
79#
80#intensite en ft du temps avec image cumulee
[638]81del rg0Tot
82del rg1Tot
83#1405,1415 MHz => range [5080,5405]
84c++exec TMatrix<r_4>tmp0(ich0Tot(Range::all(),Range(5080,5405)),false); \
85 TVector<r_4>rg0Tot(ich0Tot.NRows()); \
86 for(sa_size_t i=0;i<tmp0.NRows();++i){ \
87 double mean,sigma; \
88 MeanSigma(tmp0(Range(i),Range::all()),mean,sigma); \
89 rg0Tot(i) = mean; \
90 } \
91 KeepObj(rg0Tot); \
92 TMatrix<r_4>tmp1(ich1Tot(Range::all(),Range(5080,5405)),false); \
93 TVector<r_4>rg1Tot(ich1Tot.NRows()); \
94 for(sa_size_t i=0;i<tmp1.NRows();++i){ \
95 double mean,sigma; \
96 MeanSigma(tmp1(Range(i),Range::all()),mean,sigma); \
97 rg1Tot(i) = mean; \
98 } \
99 KeepObj(rg1Tot);
100
101newwin
102setaxesatt 'grid'
103graphicatt ''
104#90sec = milieu du cycle = maximum
105#donne 7.56kHz
106#273 canaux en 170sec => 8.22kHz
107plot2d rg0Tot (n*170)/273 val 1 'blue cpts notit nsta'
108plot2d rg1Tot (n*170)/273 val 1 'same red cpts notit nsta'
[639]109settitle "${srcMaj} Drift Scan [1405,1415]MHz all cycles Ch 0 (blue) Ch 1 (red)"
[638]110setaxelabels 't(sec)' 'I (a.u)'
[639]111endscript
[638]112
[639]113#######################
114defscript fwhmInt
115#
[638]116#spectre de frequence canal en temps [120,146] FWHM.
117#
118del s0
119del s1
120c++exec TMatrix<r_4>tmp0(ich0Tot(Range(120,146),Range::all()),false); \
121 TVector<r_4>s0(ich0Tot.NCols()); \
122 for(sa_size_t i=0;i<tmp0.NCols();++i){ \
123 double mean,sigma; \
124 MeanSigma(tmp0(Range::all(),Range(i)),mean,sigma); \
125 s0(i) = mean; \
126 } \
127 KeepObj(s0); \
128 TMatrix<r_4>tmp1(ich1Tot(Range(120,146),Range::all()),false); \
129 TVector<r_4>s1(ich1Tot.NCols()); \
130 for(sa_size_t i=0;i<tmp1.NCols();++i){ \
131 double mean,sigma; \
132 MeanSigma(tmp1(Range::all(),Range(i)),mean,sigma); \
133 s1(i) = mean; \
134 } \
135 KeepObj(s1);
136newwin
137setaxesatt 'grid'
138graphicatt 'xylimits=1250,1500,0,2'
139plot2d s0 (n/8192)*250+1250 val n>0 'blue cpts notit nsta'
140plot2d s1 (n/8192)*250+1250 val 1 'same red cpts notit nsta'
[639]141settitle "${srcMaj} Drift Scan all cycles Ch 0 (blue) Ch 1 (red)"
[638]142setaxelabels 'Freq. (MHz)' 'I (a.u)'
[639]143endscript
144#######################
145#######################
146defscript timeevol2
[638]147
[639]148#append all images
149del ch0evol
150del ch1evol
151c++exec sa_size_t nrows=(${nframes}+1)*(${lcycle}-${fcycle}+1); \
152 sa_size_t ncols=ich${fcycle}0.NCols(); \
153 TMatrix<r_4>ch0evol(nrows,ncols); TMatrix<r_4>ch1evol(nrows,ncols); \
154 KeepObj(ch0evol); KeepObj(ch1evol);
155
156for ic ${fcycle}:${maxcycle}
157 c++exec sa_size_t curRow=(${ic}-${fcycle})*(${nframes}+1); sa_size_t nextm1CurRow=curRow+(${nframes}+1)-1; \
158 cout << "ic, curRow, next : "<<${ic}<<" "<<curRow<<" "<<nextm1CurRow<<endl; \
159 ch0evol(Range(curRow,nextm1CurRow),Range::all())=ich${ic}0(Range(0,${nframes}),Range::all()); \
160 ch1evol(Range(curRow,nextm1CurRow),Range::all())=ich${ic}1(Range(0,${nframes}),Range::all());
161end
162
163echo "Coucou......"
164
165#intensite en ft du temps avec image cumulee
166del i0evol
167del i1evol
168#1405,1415 MHz => range [5080,5405]
169c++exec TMatrix<r_4>tmp0(ch0evol(Range::all(),Range(5080,5405)),false); \
170 TVector<r_4>i0evol(ch0evol.NRows()); \
171 for(sa_size_t i=0;i<tmp0.NRows();++i){ \
172 double mean,sigma; \
173 MeanSigma(tmp0(Range(i),Range::all()),mean,sigma); \
174 i0evol(i) = mean; \
175 } \
176 KeepObj(i0evol); \
177 TMatrix<r_4>tmp1(ch1evol(Range::all(),Range(5080,5405)),false); \
178 TVector<r_4>i1evol(ch1evol.NRows()); \
179 for(sa_size_t i=0;i<tmp1.NRows();++i){ \
180 double mean,sigma; \
181 MeanSigma(tmp1(Range(i),Range::all()),mean,sigma); \
182 i1evol(i) = mean; \
183 } \
184 KeepObj(i1evol);
185
186
187
188newwin
189setaxesatt 'grid'
190graphicatt ''
191plot2d i0evol n val 1 'blue cpts notit nsta'
192plot2d i1evol n val 1 'same red cpts notit nsta'
193settitle "${srcMaj} Drift Scan [1405,1415]MHz all cycles Ch 0 (blue) Ch 1 (red)"
194setaxelabels 't(a.u)' 'I (a.u)'
195
196endscript
197###################
198#for ic ${fcycle}:${maxcycle}
199#echo "process $ic"
200#image $ic
201#end
202
Note: See TracBrowser for help on using the repository browser.