1 | #source en minuscule |
---|
2 | set source $1 |
---|
3 | set srcMaj $2 |
---|
4 | set date $3 |
---|
5 | set fcycle $4 |
---|
6 | set lcycle $5 |
---|
7 | set nframes $6 |
---|
8 | maxcycle = ${lcycle}+1 |
---|
9 | |
---|
10 | set path "/sps/baoradio/AmasNancay/JEC/${srcMaj}" |
---|
11 | |
---|
12 | #first script executed |
---|
13 | clearscript image |
---|
14 | clearscript doImage |
---|
15 | |
---|
16 | #mergeimg should be executed before timeevol, fwhnInt |
---|
17 | clearscript mergeimg |
---|
18 | clearscript timeevol |
---|
19 | clearscript fwhmInt |
---|
20 | |
---|
21 | #script independant from mergeimg |
---|
22 | clearscript timeevol2 |
---|
23 | ####################### |
---|
24 | defscript image |
---|
25 | # |
---|
26 | #compute (ON-OFF)/OFFn with OFF computed from the first 30s of each image |
---|
27 | set cycle $1 |
---|
28 | openppf ${path}/img_${date}_${source}_cycle${cycle}.ppf |
---|
29 | del ich0 |
---|
30 | del zCh0 |
---|
31 | objaoper img${cycle} slicexz 0 ich0 |
---|
32 | c++exec TMatrix<r_4>zCh0(ich0(Range(0),Range::all()),false); \ |
---|
33 | for (sa_size_t i=1;i<50;i++){zCh0+=ich0(Range(i),Range::all());} \ |
---|
34 | zCh0/=50.; KeepObj(zCh0);\ |
---|
35 | for (sa_size_t i=0;i<ich0.NRows();i++){ich0(Range(i),Range::all())-=zCh0;ich0(Range(i),Range::all()).Div(zCh0);} |
---|
36 | # |
---|
37 | rename ich0 ich${cycle}0 |
---|
38 | rename zCh0 tsys${cycle}0 |
---|
39 | |
---|
40 | del ich1 |
---|
41 | del zCh1 |
---|
42 | objaoper img${cycle} slicexz 1 ich1 |
---|
43 | c++exec TMatrix<r_4>zCh1(ich1(Range(0),Range::all()),false); \ |
---|
44 | for (sa_size_t i=1;i<50;i++){zCh1+=ich1(Range(i),Range::all());} \ |
---|
45 | zCh1/=50.; KeepObj(zCh1);\ |
---|
46 | for (sa_size_t i=0;i<ich1.NRows();i++){ich1(Range(i),Range::all())-=zCh1;ich1(Range(i),Range::all()).Div(zCh1);} |
---|
47 | # |
---|
48 | rename ich1 ich${cycle}1 |
---|
49 | rename zCh1 tsys${cycle}1 |
---|
50 | |
---|
51 | endscript |
---|
52 | ####################### |
---|
53 | ################### |
---|
54 | defscript doImage |
---|
55 | |
---|
56 | for ic ${fcycle}:${maxcycle} |
---|
57 | echo "process ${ic}" |
---|
58 | image $ic |
---|
59 | end |
---|
60 | endscript |
---|
61 | |
---|
62 | |
---|
63 | ####################### |
---|
64 | defscript mergeimg |
---|
65 | # |
---|
66 | del ich0Tot |
---|
67 | del ich1Tot |
---|
68 | del ncycles |
---|
69 | c++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 | |
---|
74 | fp1cycle = ${fcycle}+1 |
---|
75 | |
---|
76 | for 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; |
---|
80 | end |
---|
81 | |
---|
82 | c++exec ich0Tot/=ncycles(0); ich1Tot/=ncycles(0); |
---|
83 | |
---|
84 | setaxesatt 'font=helvetica,bold,14 fixedfontsize' |
---|
85 | newwin |
---|
86 | disp ich0Tot 'lut=lin,-0.1,3.5 colbr128 showcmap=top' |
---|
87 | |
---|
88 | newwin |
---|
89 | disp ich1Tot 'lut=lin,-0.1,3.5 colbr128 showcmap=top' |
---|
90 | endscript |
---|
91 | ####################### |
---|
92 | defscript timeevol |
---|
93 | # |
---|
94 | #intensite en ft du temps avec image cumulee |
---|
95 | del rg0Tot |
---|
96 | del rg1Tot |
---|
97 | #1405,1415 MHz => range [5080,5405] |
---|
98 | c++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 | |
---|
115 | newwin |
---|
116 | setaxesatt 'grid' |
---|
117 | graphicatt '' |
---|
118 | #90sec = milieu du cycle = maximum |
---|
119 | #donne 7.56kHz |
---|
120 | #273 canaux en 170sec => 8.22kHz |
---|
121 | plot2d rg0Tot (n*170)/273 val 1 'blue cpts notit nsta' |
---|
122 | plot2d rg1Tot (n*170)/273 val 1 'same red cpts notit nsta' |
---|
123 | settitle "${srcMaj} Drift Scan [1405,1415]MHz all cycles Ch 0 (blue) Ch 1 (red)" |
---|
124 | setaxelabels 't(sec)' 'I (a.u)' |
---|
125 | endscript |
---|
126 | |
---|
127 | ####################### |
---|
128 | defscript fwhmInt |
---|
129 | # |
---|
130 | #spectre de frequence canal en temps [120,146] FWHM. |
---|
131 | # |
---|
132 | del s0 |
---|
133 | del s1 |
---|
134 | c++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); |
---|
150 | newwin |
---|
151 | setaxesatt 'grid' |
---|
152 | graphicatt 'xylimits=1250,1500,0,2' |
---|
153 | plot2d s0 (n/8192)*250+1250 val n>0 'blue cpts notit nsta' |
---|
154 | plot2d s1 (n/8192)*250+1250 val 1 'same red cpts notit nsta' |
---|
155 | settitle "${srcMaj} Drift Scan all cycles Ch 0 (blue) Ch 1 (red)" |
---|
156 | setaxelabels 'Freq. (MHz)' 'I (a.u)' |
---|
157 | endscript |
---|
158 | ####################### |
---|
159 | ####################### |
---|
160 | defscript timeevol2 |
---|
161 | |
---|
162 | #append all images |
---|
163 | del ch0evol |
---|
164 | del ch1evol |
---|
165 | c++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 | |
---|
170 | for 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()); |
---|
175 | end |
---|
176 | |
---|
177 | #intensite en ft du temps avec image cumulee |
---|
178 | del i0evol |
---|
179 | del i1evol |
---|
180 | #1405,1415 MHz => range [5080,5405] |
---|
181 | c++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 | |
---|
200 | newwin |
---|
201 | setaxesatt 'grid' |
---|
202 | graphicatt '' |
---|
203 | plot2d i0evol n val 1 'blue cpts notit nsta' |
---|
204 | plot2d i1evol n val 1 'same red cpts notit nsta' |
---|
205 | settitle "${srcMaj} Drift Scan [1405,1415]MHz all cycles Ch 0 (blue) Ch 1 (red)" |
---|
206 | setaxelabels 't(a.u)' '(I-OFF)/OFF (a.u)' |
---|
207 | |
---|
208 | |
---|
209 | #Tsys en ft du temps |
---|
210 | c++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 | |
---|
215 | for 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()); |
---|
220 | end |
---|
221 | |
---|
222 | del T0evol |
---|
223 | del T1evol |
---|
224 | #1405,1415 MHz => range [5080,5405] |
---|
225 | c++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 | |
---|
242 | newwin |
---|
243 | setaxesatt 'grid' |
---|
244 | graphicatt '' |
---|
245 | plot2d T0evol n+${fcycle} val 1 'blue cpts notit nsta' |
---|
246 | plot2d T1evol n+${fcycle} val 1 'same red cpts notit nsta' |
---|
247 | settitle "${srcMaj} Drift Scan [1405,1415]MHz all cycles Ch 0 (blue) Ch 1 (red)" |
---|
248 | setaxelabels 'cycle num.' 'OFF/Gain (a.u)' |
---|
249 | |
---|
250 | |
---|
251 | endscript |
---|
252 | |
---|