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

Last change on this file since 675 was 640, checked in by campagne, 12 years ago

add timeevol2 for Tsys survey

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