// Utilisation de SOPHYA pour faciliter les tests ... #include "sopnamsp.h" #include "machdefs.h" /* ---------------------------------------------------------- Projet BAORadio/PAON4 - (C) LAL/IRFU 2008-2015 visi2dtacx: programme de lecture des fichiers matrices de visibilites de PAON4, remplissage et ecriture d'un DataTable avec les cross-correlations en fonction du temps R. Ansari, J.E. Campagne, C. Magneville - LAL/Irfu ---------------------------------------------------------- */ // include standard c/c++ #include #include #include #include #include #include #include "pexceptions.h" #include "tvector.h" #include "fioarr.h" // #include "tarrinit.h" #include "ntuple.h" #include "datatable.h" #include "histinit.h" #include "matharr.h" #include "timestamp.h" #include // include sophya mesure ressource CPU/memoire ... #include "resusage.h" #include "ctimer.h" #include "timing.h" // include lecteur de fichiers visibilites #include "visip4reader.h" //--------------------------- Fonctions de ce fichier ------------------- int Usage(bool fgshort=true); // int DecodeArgs(int narg, char* arg[]); /* --Fonction-- */ int Usage(bool fgea) { cout << " --- visi2dtacx.cc : Read PPF files produced by mfacq time-frequency\n" << endl; if (fgea) cout << " visi2dtacx: Missing or wrong argument ! " << endl; cout << " Usage: visi2dtacx InPathBAO5 InPathBAO6 Imin,Imax GainPPFFile OutPPFFile Freq1 Freq2 DeltaFreq DeltaIAvg [PrtLev=0] \n" << " InPathBAO5/6: path for input vismtx_J_iii.ppf on bao5/6 \n" << " Imin,Imax : read files for Imin<=iii<=Imax iii+=step \n" << " GainPPFFile: Input gains PPF file name \n" << " OutPPFFile: Output PPF file name \n" << " Freq1 Freq2: the two frequencies for which cross-correlations are computed [=1375 1410 MHz] \n" << " DeltaFreq: frequency band (in MHz) [=1 MHz] \n" << " DeltaIAvg: compute average power every DeltaI input vismtx files, def=10 \n" << " Note: bande_freq=[freq1,2-deltafreq , freq1,2+deltafreq] \n"<< endl; /* if (fgshort) { cout << " rdvisip4 -h for detailed instructions" << endl; return 1; } */ return 1; } //---------------------------------------------------- //---------------------------------------------------- int main(int narg, char* arg[]) { if ((narg>1)&&(strcmp(arg[1],"-h")==0)) return Usage(false); if (narg<10) return Usage(true); string path5 = arg[1]; string path6 = arg[2]; int Imin,Imax,Istep=1; sscanf(arg[3],"%d,%d",&Imin,&Imax); Istep=1; string gainfile=arg[4]; string outfile=arg[5]; // frequency range definition double deltafreq=1.; double freq1=1375.; double freq2=1410.; if ((narg>7)&&(strcmp(arg[6],"-")!=0)) freq1=atof(arg[6]); if ((narg>8)&&(strcmp(arg[7],"-")!=0)) freq2=atof(arg[7]); if ((narg>6)&&(strcmp(arg[8],"-")!=0)) deltafreq=atof(arg[8]); // time averaging interval definition, in term of visibility files int deltaIavg=10; if ((narg>9)&&(strcmp(arg[9],"-")!=0)) deltaIavg=atoi(arg[9]); if (deltaIavg<1) deltaIavg=1; int prtlev=1; if (narg>10) prtlev=atoi(arg[10]); cout << " visi2dtacx/Info: Path BAO5:"< "< "< JF=2792) sa_size_t JFmin21=2776,JFmax21=2808; // +/- 1 MHz autour de 1420 MHz sa_size_t JFmin21_5=2710,JFmax21_5=2874; // +/- 5 MHz autour de 1420 MHz cout << " pjHI +/-1 MHz @1420 MHz " << JFmin21<<" <=NumFreq<= "<>PPFNameTag("gains")>>gains; pin>>PPFNameTag("gn")>>gn; for (int p=0; p<8; p++) cout<<"gn["< paths; paths.push_back(path5); paths.push_back(path6); VisiP4Reader vreader(paths, Imin,Imax,Istep,true); vreader.setPrintLevel(prtlev); bool fgok=true; TMatrix< complex > vismtx; TMatrix< complex > acsum; TMatrix< complex > cxsum; double acdt[32]; // les 4*8=32 valeurs d'autocorrelation pour remplissage dans la table complex cxdt[18]; // les 3*6=18 valeurs de cross-correlations pour remplissage dans la table TimeStamp dateobs; TimeStamp dateorg(2015,1,1,12,0,0.); // Date origine 1 jan 2015 double mttag; int cnt=0, cntnt=0, pcntnt=0; int I=0; // Getting en empty row_ptr DataTableRowPtr rowp = dt.EmptyRowPtr(); // while (fgok) { fgok=vreader.ReadNext(vismtx, dateobs, mttag); if (fgok) { if (cnt==0) { //resizing matrices for sum of auto-correlations and sum of 6 cross-correlations acsum.SetSize(8, vismtx.NCols()); cxsum.SetSize(6, vismtx.NCols()); } if (I==0) { // start filling a new DataTable row dt.NextRowPtr(rowp); rowp(0)=(int_4)cnt; rowp(1)=(int_4)(dateobs.DaysPart()-dateorg.DaysPart()); rowp(2)=(r_4)dateobs.SecondsPart(); if (prtlev>0) cout << "visi2dtacx/Info: dateobs="<>>> visi2dtacx.cc ------- END ----------- RC=" << rc << endl; return rc; }