Commit b291f940 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Ajout scripts pour normaliser et afficher les cartes TFM pour AUto-Cor et...

Ajout scripts pour normaliser et afficher les cartes TFM pour AUto-Cor et cross-cor , Reza 29/11/2018
parent 0fc44146
/* PAON4 / BAORadio
Process TFM maps from visiavg.cc
Effectue une normalisation des cartes auto-cor et cross-cor
R. Ansari, Novembre 2018
*/
vector< TArray< float > * > vac;
vac.push_back(&TFM_1H);
vac.push_back(&TFM_2H);
vac.push_back(&TFM_3H);
vac.push_back(&TFM_4H);
vac.push_back(&TFM_1V);
vac.push_back(&TFM_2V);
vac.push_back(&TFM_3V);
vac.push_back(&TFM_4V);
vector< TArray< complex<float> > * > vcxH;
vcxH.push_back(&TFM_1H2H);
vcxH.push_back(&TFM_1H3H);
vcxH.push_back(&TFM_1H4H);
vcxH.push_back(&TFM_2H3H);
vcxH.push_back(&TFM_2H4H);
vcxH.push_back(&TFM_3H4H);
vector< TArray< complex<float> > * > vcxV;
vcxV.push_back(&TFM_1V2V);
vcxV.push_back(&TFM_1V3V);
vcxV.push_back(&TFM_1V4V);
vcxV.push_back(&TFM_2V3V);
vcxV.push_back(&TFM_2V4V);
vcxV.push_back(&TFM_3V4V);
vector< TArray< complex<float> > * > vcxHV;
vcxHV.push_back(&TFM_1H1V);
vcxHV.push_back(&TFM_1H2V);
vcxHV.push_back(&TFM_1H3V);
vcxHV.push_back(&TFM_1H4V);
vcxHV.push_back(&TFM_2H1V);
vcxHV.push_back(&TFM_2H2V);
vcxHV.push_back(&TFM_2H3V);
vcxHV.push_back(&TFM_2H4V);
vcxHV.push_back(&TFM_3H1V);
vcxHV.push_back(&TFM_3H2V);
vcxHV.push_back(&TFM_3H3V);
vcxHV.push_back(&TFM_3H4V);
vcxHV.push_back(&TFM_4H1V);
vcxHV.push_back(&TFM_4H2V);
vcxHV.push_back(&TFM_4H3V);
vcxHV.push_back(&TFM_4H4V);
cout<<"A/ Computing TFM-AutoCorrelation mean ..."<<endl;
vector< float > vacmean(vac.size());
for (size_t i=0; i<vac.size(); i++) {
vacmean[i]=vac[i]->Sum()/(float)vac[i]->Size();
cout << " TFM-AutoCor["<<i<<"] -> mean="<<vacmean[i]<<endl;
}
cout<<"B/ Normalising TFM-AutoCorrelation ..."<<endl;
for (size_t i=0; i<vac.size(); i++) {
*vac[i] /= vacmean[i];
}
cout<<"B/ Normalising TFM-HH TFM-VV cross-corr ..."<<endl;
size_t k =0;
for (size_t i=0; i<3; i++) {
for (size_t j=i+1; j<4; j++) {
*vcxH[k] /= complex<float>(sqrt(vacmean[i]*vacmean[j]), 0.);
*vcxV[k] /= complex<float>(sqrt(vacmean[i+4]*vacmean[j+4]), 0.);
k++;
}
}
cout<<"C/ Normalising TFM-HV cross-corr ..."<<endl;
k=0;
for (size_t i=0; i<4; i++) {
for (size_t j=4; j<8; j++) {
*vcxHV[k] /= complex<float>(sqrt(vacmean[i]*vacmean[j]), 0.);
k++;
}
}
cout<<"D/ Computing Mean autocor vector ..."<<endl;
const char * nomvac[8]={"ac1H","ac2H","ac3H","ac4H","ac1V","ac2V","ac3V","ac4V"};
for (size_t i=0; i<vac.size(); i++) {
TVector<float> mac(vac[i]->SizeY());
for(sa_size_t j=0; j<vac[i]->SizeX(); j++) {
mac += TVector<float>((*vac[i])(Range(j,j), Range::all(), Range::first()));
}
mac /= (float)(vac[i]->SizeX());
string nom=nomvac[i];
omg.AddObj(mac,nom);
}
cout<<"D/ DONE "<<endl;
######################################################################
####### Process TFM maps from visiavg.cc to study cross-correlations
####### Analyse PAON4 , R. Ansari, Novembre 2018
## Appel proc_tfm.pic FileName , utilise proc_tfm.cc pour les normalisation
## et definit les scripts suivants:
## - dactfm Display AutoCorrelation TFM
## - daclev Display auto-corr level
## - dcxHHtfm Display the 6 HH cross-cor TFM
## - dcxHHtfm Display the 6 VV cross-cor TFM
## - dcx4Vtfm Display cross-corr with 4V channel (bouchon 50 Ohm)
## - dcxHVtfm Display HV cross-cor TFM
######################################################################
if ( $# < 1 ) then
echo 'Script proc_tfm.pic : Nom du fichier TFM manquant '
echo 'Usage: proc_tfm.pic FileName'
endif
set flnm $1
echo '------- Opening file ' $flnm
openppf $flnm
ls
c++execfrf proc_tfm.cc
ls
setaxesatt 'font=helvetica,bold,16 fixedfontsize minorticks'
set grwibk 'wbgcol=white cmapdrw.color=black cmapdrw.font=helvetica,bold,14'
set grwbk 'color=black'
######### Script dactfm
defscript dactfm ' Display AutoCor TFM for 8 H & V channels'
newwin 4 1 1000 650
set onames ( TFM_1H TFM_2H TFM_3H TFM_4H )
for i 0:4
disp $onames[i] "lut=lin,0.9,1.1 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" ' ' "font=helvetica,bold,16 $grwbk"
end
newwin 4 1 1000 650
set onames ( TFM_1V TFM_2V TFM_3V TFM_4V )
for i 0:4
disp $onames[i] "lut=lin,0.9,1.1 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" ' ' "font=helvetica,bold,16 $grwbk"
end
endscript
######### Script daclev
defscript daclev 'Display AutoCorrelation level for H & V channels'
newwin 1 2
set onames ( ac1H ac2H ac3H ac4H )
set cols ( black blue red green )
for i 0:4
set gra "notit $cols[i]"
if ( $i > 0 ) then
set gra "$gra same"
endif
disp $onames[i] "$gra"
if ( $i == 0 ) then
settitle " autoCorH 1H(black) 2H(blue) 3H(red) 4H(green)" ' ' 'font=helvetica,bold,16 black'
endif
end
set onames ( ac1V ac2V ac3V ac4V )
set cols ( black blue red green )
for i 0:4
set gra "notit $cols[i]"
if ( $i > 0 ) then
set gra "$gra same"
endif
disp $onames[i] "$gra"
if ( $i == 0 ) then
settitle " autoCorV 1V(black) 2V(blue) 3V(red) 4V(green)" ' ' 'font=helvetica,bold,16 black'
endif
end
endscript
######### Script dcxHHtfm
defscript dcxHHtfm 'Display 6 HH cross correlation real patr and & phase'
newwin 6 1 1200 650
set onames ( TFM_1H2H TFM_1H3H TFM_1H4H TFM_2H3H TFM_2H4H TFM_3H4H )
for i 0:6
disp $onames[i] "cdreal lut=lin,-0.002,0.002 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" '(real-part)' "font=helvetica,bold,16 $grwbk"
end
newwin 6 1 1200 650
set onames ( TFM_1H2H TFM_1H3H TFM_1H4H TFM_2H3H TFM_2H4H TFM_3H4H )
for i 0:6
disp $onames[i] "cdphase lut=lin,-3,3 midas_pastel showcmap=right $grwibk"
settitle "$onames[i]" '(phase)' "font=helvetica,bold,16 $grwbk"
end
endscript
######### Script dcxVVtfm
defscript dcxVVtfm 'Display 6 HH cross correlation real patr and & phase'
newwin 6 1 1200 650
set onames ( TFM_1V2V TFM_1V3V TFM_1V4V TFM_2V3V TFM_2V4V TFM_3V4V )
for i 0:6
disp $onames[i] "cdreal lut=lin,-0.002,0.002 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" '(real-part)' "font=helvetica,bold,16 $grwbk"
end
newwin 6 1 1200 650
set onames ( TFM_1V2V TFM_1V3V TFM_1V4V TFM_2V3V TFM_2V4V TFM_3V4V )
for i 0:6
disp $onames[i] "cdphase lut=lin,-3,3 midas_pastel showcmap=right $grwibk"
settitle "$onames[i]" '(phase)' "font=helvetica,bold,16 $grwbk"
end
endscript
######### Script dcx4Vtfm
defscript dcx4Vtfm 'Display cross-correlations with 4V signal '
newwin 4 1 1000 650
set onames ( TFM_1H4V TFM_2H4V TFM_3H4V TFM_4H4V )
for i 0:4
disp $onames[i] "cdreal lut=lin,-0.002,0.002 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" '(real-part)' "font=helvetica,bold,16 $grwbk"
end
newwin 4 1 1000 650
for i 0:4
disp $onames[i] "cdphase lut=lin,-3,3 midas_pastel showcmap=right $grwibk"
settitle "$onames[i]" '(phase)' "font=helvetica,bold,16 $grwbk"
end
newwin 3 1 750 650
set onames ( TFM_1V4V TFM_2V4V TFM_3V4V )
for i 0:3
disp $onames[i] "cdreal lut=lin,-0.002,0.002 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" '(real-part)' "font=helvetica,bold,16 $grwbk"
end
newwin 3 1 750 650
for i 0:3
disp $onames[i] "cdphase lut=lin,-3,3 midas_pastel showcmap=right $grwibk"
settitle "$onames[i]" '(phase)' "font=helvetica,bold,16 $grwbk"
end
endscript
######### Script dcxHVtfm
defscript dcxHVtfm 'Display cross-correlations between H-V signals same feed & different feeds'
newwin 4 1 1000 650
set onames ( TFM_1H1V TFM_2H2V TFM_3H3V TFM_4H4V )
for i 0:4
disp $onames[i] "cdreal lut=lin,-0.01,0.01 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" '(real-part)' "font=helvetica,bold,16 $grwbk"
end
newwin 6 1 1200 650
set onames ( TFM_1H2V TFM_2H3V TFM_1H3V TFM_2H1V TFM_2H3V TFM_3H4V )
for i 0:6
disp $onames[i] "cdreal lut=lin,-0.002,0.002 colbr128 showcmap=right $grwibk"
settitle "$onames[i]" '(real-part)' "font=helvetica,bold,16 $grwbk"
end
endscript
echo '------- File opened: ' $flnm
listscripts
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment