Commit 3de8eafe authored by OP's avatar OP
Browse files

saves auto-cor t-f map before messing it

parent 996ebaf9
...@@ -181,9 +181,11 @@ int main(int narg, const char* arg[]) ...@@ -181,9 +181,11 @@ int main(int narg, const char* arg[])
fgok=vreader.ReadNext(vismtx, cfdate, mttag); fgok=vreader.ReadNext(vismtx, cfdate, mttag);
if (!fgok) break; if (!fgok) break;
// Apply gain g(nu) // Apply gain g(nu)
p4g.applyGain(vismtx); p4g.applyGain(vismtx);
if (cnt==0) { //resizing matrices for sum of auto-correlations and sum of 6 cross-correlations if (cnt==0) { //resizing matrices for sum of auto-correlations and sum of 6 cross-correlations
acsum.SetSize(8, vismtx.NCols()); acsum.SetSize(8, vismtx.NCols());
acsum_sq.SetSize(8, vismtx.NCols()); acsum_sq.SetSize(8, vismtx.NCols());
...@@ -243,6 +245,7 @@ int main(int narg, const char* arg[]) ...@@ -243,6 +245,7 @@ int main(int narg, const char* arg[])
I++; // incrementing DeltaTime counter I++; // incrementing DeltaTime counter
if (I==deltaIavg) { if (I==deltaIavg) {
//---- On s'occupe d'abord des autocorrelations P1 ... P8 //---- On s'occupe d'abord des autocorrelations P1 ... P8
for(size_t k=0; k<KVAC.size(); k++) { // Loop over the 8 auto-correlations for(size_t k=0; k<KVAC.size(); k++) { // Loop over the 8 auto-correlations
TVector<r_4> vac = real(acsum.Row(k)); TVector<r_4> vac = real(acsum.Row(k));
...@@ -256,8 +259,8 @@ int main(int narg, const char* arg[]) ...@@ -256,8 +259,8 @@ int main(int narg, const char* arg[])
} }
} }
} //----- end of loop over the 8 AutoCor } //----- end of loop over the 8 AutoCor
//---- On s'occupe des 6 cross-correlations 1H-2H ... 3H-4H //---- On s'occupe des 6 cross-correlations 1H-2H ... 3H-4H
for(size_t k=0; k<KVCXHH.size(); k++) { // loop over the 6 Xcor for(size_t k=0; k<KVCXHH.size(); k++) { // loop over the 6 Xcor
TVector< complex<r_4> > vcx = cxsum.Row(k); TVector< complex<r_4> > vcx = cxsum.Row(k);
...@@ -293,12 +296,8 @@ int main(int narg, const char* arg[]) ...@@ -293,12 +296,8 @@ int main(int narg, const char* arg[])
// --- Sauvegarde cartes temps-frequence en fits // --- Sauvegarde cartes temps-frequence en fits
//FitsABTWriter * fbtw = NULL; //FitsABTWriter * fbtw = NULL;
FitsInOutFile * fos = NULL ; FitsInOutFile * fos = NULL ;
if (fitsoutfile.length()>=1){
//cout<<">>>>> Creating a new fits file with FitsABTWriter"<<endl;
//fbtw = new FitsABTWriter(fitsoutfile,BINARY_TBL,3);
//fbtw->SetExtName("Test fits table 1");
//i1 = fbtw.AddCol("Time",NULL,"unit1",TDOUBLE);
if (fitsoutfile.length()>=1){
cout << " fitsoutfile" <<fitsoutfile<< endl; cout << " fitsoutfile" <<fitsoutfile<< endl;
fos = new FitsInOutFile(fitsoutfile, FitsInOutFile::Fits_Create); fos = new FitsInOutFile(fitsoutfile, FitsInOutFile::Fits_Create);
} }
...@@ -314,19 +313,23 @@ int main(int narg, const char* arg[]) ...@@ -314,19 +313,23 @@ int main(int narg, const char* arg[])
for(int k=0; k<8; k++) { // loop over the 8 AutoCorr for(int k=0; k<8; k++) { // loop over the 8 AutoCorr
TArray< r_4 > & tfmap = vtfmac[k]; TArray< r_4 > & tfmap = vtfmac[k];
tfmap *= (r_4)(1./((double)deltaIavg*(double)TFMfbin)); tfmap *= (r_4)(1./((double)deltaIavg*(double)TFMfbin));
TArray< r_4 > & tfmapsq = vtfmac_sq[k];
tfmapsq *= (r_4)(1./((double)deltaIavg*(double)TFMfbin));
tfmapsq = tfmapsq - tfmap.MulElt(tfmap,tfmap) ;
potfm << PPFNameTag(tfm_names[k]) << tfmap; potfm << PPFNameTag(tfm_names[k]) << tfmap;
potfm << PPFNameTag(tfmsq_names[k]) << tfmapsq;
if (fos != NULL) { if (fos != NULL) {
ext_names.push_back(tfm_names[k]); ext_names.push_back(tfm_names[k]);
(*fos)<< tfmap; (*fos)<< tfmap;
}
TArray< r_4 > & tfmapsq = vtfmac_sq[k];
tfmapsq *= (r_4)(1./((double)deltaIavg*(double)TFMfbin));
tfmapsq = tfmapsq - tfmap.MulElt(tfmap,tfmap) ; // tfmap ->tfmap*tfmap !!
potfm << PPFNameTag(tfmsq_names[k]) << tfmapsq;
if (fos != NULL) {
ext_names.push_back(tfmsq_names[k]); ext_names.push_back(tfmsq_names[k]);
(*fos)<< tfmapsq; (*fos)<< tfmapsq;
} }
} }
// --- renormalizing and saving H-H Cross-Corr time-frequency maps // --- renormalizing and saving H-H Cross-Corr time-frequency maps
cout<<" visiavg/Info: Saving 6 H-H cross-corr time-frequency maps to PPF file "<<outfile<<endl; cout<<" visiavg/Info: Saving 6 H-H cross-corr time-frequency maps to PPF file "<<outfile<<endl;
...@@ -340,6 +343,13 @@ int main(int narg, const char* arg[]) ...@@ -340,6 +343,13 @@ int main(int narg, const char* arg[])
TArray< r_4 > & tfmap_sqpr = vtfm_rp_sq[k]; TArray< r_4 > & tfmap_sqpr = vtfm_rp_sq[k];
TArray< r_4 > & tfmap_sqpi = vtfm_ip_sq[k]; TArray< r_4 > & tfmap_sqpi = vtfm_ip_sq[k];
tfmap *= complex<r_4>((r_4)(1./((double)deltaIavg*(double)TFMfbin)), 0.); tfmap *= complex<r_4>((r_4)(1./((double)deltaIavg*(double)TFMfbin)), 0.);
potfm << PPFNameTag(tfmCC_names[k]) << tfmap;
if (fos != NULL) {
ext_names.push_back(string(tfmCC_names[k])+"_real");
(*fos)<< real(tfmap);
ext_names.push_back(string(tfmCC_names[k])+"_imag");
(*fos)<< imag(tfmap);
}
TArray< r_4 > tfmapr = real(tfmap); TArray< r_4 > tfmapr = real(tfmap);
TArray< r_4 > tfmapi = imag(tfmap); TArray< r_4 > tfmapi = imag(tfmap);
...@@ -349,14 +359,9 @@ int main(int narg, const char* arg[]) ...@@ -349,14 +359,9 @@ int main(int narg, const char* arg[])
tfmap_sqpr -= tfmapr ; tfmap_sqpr -= tfmapr ;
tfmapi = tfmapi.MulElt(tfmapi,tfmapi) ; tfmapi = tfmapi.MulElt(tfmapi,tfmapi) ;
tfmap_sqpi -= tfmapi; tfmap_sqpi -= tfmapi;
potfm << PPFNameTag(tfmCC_names[k]) << tfmap;
potfm << PPFNameTag(vrtfmCC_names[k]) << tfmap_sqpr; potfm << PPFNameTag(vrtfmCC_names[k]) << tfmap_sqpr;
potfm << PPFNameTag(vitfmCC_names[k]) << tfmap_sqpi; potfm << PPFNameTag(vitfmCC_names[k]) << tfmap_sqpi;
if (fos != NULL) { if (fos != NULL) {
ext_names.push_back(string(tfmCC_names[k])+"_real");
(*fos)<< real(tfmap);
ext_names.push_back(string(tfmCC_names[k])+"_imag");
(*fos)<< imag(tfmap);
ext_names.push_back(vrtfmCC_names[k]); ext_names.push_back(vrtfmCC_names[k]);
(*fos)<< tfmap_sqpr; (*fos)<< tfmap_sqpr;
ext_names.push_back(vitfmCC_names[k]); ext_names.push_back(vitfmCC_names[k]);
...@@ -364,6 +369,7 @@ int main(int narg, const char* arg[]) ...@@ -364,6 +369,7 @@ int main(int narg, const char* arg[])
} }
} }
potfm << PPFNameTag("TimeVec") << timevec ; potfm << PPFNameTag("TimeVec") << timevec ;
potfm << PPFNameTag("RAVec") << ravec ; potfm << PPFNameTag("RAVec") << ravec ;
// --- FIN sauvegarde cartes temps-frequence // --- FIN sauvegarde cartes temps-frequence
......
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