Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 9eab3f44 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Ajout programme visi2ntac.cc de creation du NTuple ptot=f(time) pour les 8...

Ajout programme visi2ntac.cc de creation du NTuple ptot=f(time) pour les 8 auto-correlation , Reza 01/03/2015
parent 547a98a6
......@@ -8,5 +8,7 @@ List of files:
- visip4reader.h .cc a class to read sequentially the visibility files
produced by mfac, merge the different frequency bands and set of visibilities
and reorder frequencies
- rdvisip4 : a simple main program to read visibilitiy files and produce a single
- rdvisip4.cc : a simple main program to read visibilitiy files and produce a single
mean visibility matrix
- visi2ntac.cc : a simple main program to read visibilitiy files and produce a NTuple
with total power as a function of time for the 8 PAON4 auto-correlations
......@@ -3,20 +3,27 @@
include $(SOPHYABASE)/include/sophyamake.inc
# Define our target list
all : Objs/rdvisip4
all : Objs/rdvisip4 Objs/visi2ntac
clean :
rm -f Objs/*
######
Objs/visi2ntac : Objs/visi2ntac.o Objs/visip4reader.o
$(CXXLINK) -o Objs/visi2ntac Objs/visi2ntac.o Objs/visip4reader.o $(SOPHYAEXTSLBLIST)
Objs/visi2ntac.o : visi2ntac.cc visip4reader.h
$(CXXCOMPILE) -o Objs/visi2ntac.o visi2ntac.cc
######
Objs/rdvisip4 : Objs/rdvisip4.o Objs/visip4reader.o
$(CXXLINK) -o Objs/rdvisip4 Objs/rdvisip4.o Objs/visip4reader.o $(SOPHYAEXTSLBLIST)
Objs/rdvisip4.o : rdvisip4.cc visip4reader.h
$(CXXCOMPILE) -o Objs/rdvisip4.o rdvisip4.cc
######
Objs/visip4reader.o : visip4reader.cc visip4reader.h
$(CXXCOMPILE) -o Objs/visip4reader.o visip4reader.cc
......@@ -44,14 +44,20 @@ int Usage(bool fgshort=true);
// int DecodeArgs(int narg, char* arg[]);
/* --Fonction-- */
int Usage(bool fgshort)
int Usage(bool fgea)
{
cout << " --- rdvisip4.cc : Read PPF files produced by mfacq time-frequency\n" << endl;
cout << " Usage: rdvisip4 InPathBAO5 InPathBAO6 Imin,Imax,step OutPPFFile \n" << endl;
if (fgea) cout << " rdvisip4: Missing or wrong argument ! " << endl;
cout << " Usage: rdvisip4 InPathBAO5 InPathBAO6 Imin,Imax,step OutPPFFile \n"
<< " InPathBAO5/6: path for input vismtx_J_iii.ppf on bao5/6 \n"
<< " Imin,Imax,step : read files for Imin<=iii<=Imax iii+=step \n"
<< " OutPPFFile: Output PPF file name \n"<<endl;
/*
if (fgshort) {
cout << " rdvisip4 -h for detailed instructions" << endl;
return 1;
}
*/
return 1;
}
......
// Utilisation de SOPHYA pour faciliter les tests ...
#include "sopnamsp.h"
#include "machdefs.h"
/* ----------------------------------------------------------
Projet BAORadio/PAON4 - (C) LAL/IRFU 2008-2015
visi2ntac: programme de lecture des fichiers matrices de
visibilites de PAON4, remplissage et ecriture d'un
DataTable avec la puissance des 8 voies en fonction du temps
R. Ansari, J.E. Campagne, C. Magneville - LAL/Irfu
---------------------------------------------------------- */
// include standard c/c++
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <string>
#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 <utilarr.h>
// 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 << " --- visi2ntac.cc : Read PPF files produced by mfacq time-frequency\n" << endl;
if (fgea) cout << " visi2ntac: Missing or wrong argument ! " << endl;
cout << " Usage: visi2ntac InPathBAO5 InPathBAO6 Imin,Imax OutPPFFile [Jf1,Jf2] [DeltaIAvg] \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"
<< " OutPPFFile: Output PPF file name \n"
<< " Jf1,Jf2: frequency index (Jf1<=f<=Jf2) range for power integration, def=768,2768 \n"
<< " DeltaIAvg: compute average power every DeltaI input vismtx files, def=1 \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<5) 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 outfile=arg[4];
// frequency range definition
sa_size_t JFmin=768,JFmax=2768;
int jf1,jf2;
if ((narg>5)&&(strcmp(arg[5],"-")!=0)) sscanf(arg[5],"%d,%d",&jf1,&jf2);
JFmin=jf1; JFmax=jf2;
// time averaging interval definition, in term of visibility files
int deltaIavg=1;
if (narg>6) deltaIavg=atoi(arg[6]);
if (deltaIavg<1) deltaIavg=1;
cout << " visi2ntac/Info: Path BAO5:"<<path5<<" BAO6:"<<path6<<"\n"
<< " Imin,max,step="<<Imin<<","<<Imax<<","<<Istep<<" OutFile:"<<outfile<<"\n"
<< JFmin<<" <=NumFreq<= "<<JFmax<<" DeltaIAvg="<<deltaIavg<<endl;
HiStatsInitiator _inia;
// TArrayInitiator _inia;
int rc = 0;
try {
ResourceUsage resu;
vector<string> paths;
paths.push_back(path5);
paths.push_back(path6);
const char* ntnames[10]={"k","time","p1","p2","p3","p4","p5","p6","p7","p8"};
NTuple nt(10,ntnames);
r_8 xnt[20];
// Numero de ligne des auto-correlations dans la matrice des visibilites
sa_size_t KVAC[8]={0,8,15,21,26,30,33,35};
double pac[8]; // autocorrelation power
Range freqs(JFmin,JFmax);
VisiP4Reader vreader(paths, Imin,Imax,Istep,true);
vreader.setPrintLevel(1);
bool fgok=true;
TMatrix< complex<r_4> > vismtx;
TimeStamp dateobs;
double mttag;
int cnt=0;
int I=0;
while (fgok) {
fgok=vreader.ReadNext(vismtx, dateobs, mttag);
if (fgok) {
if (I==0) {
xnt[0]=cnt; xnt[1]=dateobs.SecondsPart();
cout << "visi2ntac/Info/*DBG* dateobs="<<dateobs<<" SecondsPart()="<<dateobs.SecondsPart()<<endl;
for(int k=0; k<8; k++) xnt[2+k]=0.;
}
for(int k=0; k<8; k++) {
TVector< complex<r_4> > vac = vismtx.Row(KVAC[k]);
xnt[2+k] += vac(freqs).Sum().real();
}
I++;
if (I==deltaIavg) {
double fnorm=(1./(double)deltaIavg)/(double)(JFmax-JFmin+1);
for(int k=0; k<8; k++) xnt[2+k]*=fnorm;
nt.Fill(xnt);
I=0;
}
cnt++;
}
}
cout << " visi2ntac/Info: count="<<cnt<<" visimtx read "<<endl;
cout << nt;
cout<<" rdvisip4/Info: Saving auto-corr=f(time) ntuple to PPF file "<<outfile<<endl;
POutPersist po(outfile);
po<<nt;
// resu.Update();
cout << resu; // Update est fait lors du print
}
catch (PException& exc) {
cerr << " visi2ntac.cc catched PException " << exc.Msg() << endl;
rc = 77;
}
catch (std::exception& sex) {
cerr << "\n visi2ntac.cc std::exception :"
<< (string)typeid(sex).name() << "\n msg= "
<< sex.what() << endl;
rc = 78;
}
catch (...) {
cerr << " visi2ntac.cc catched unknown (...) exception " << endl;
rc = 79;
}
cout << ">>>> visi2ntac.cc ------- END ----------- RC=" << rc << endl;
return rc;
}
......@@ -72,7 +72,7 @@ bool VisiP4Reader::ReadNext(TMatrix< complex<r_4> > & vismtx, TimeStamp& dateobs
sprintf(filenamebuff,"%s/vismtx_%d_%d.ppf",paths[b].c_str(), g, curfilenum);
if (prtlevel>1)
cout << " VisiP4Reader::ReadNext() - opening file: "<<filenamebuff
<<" freqRange="<<cvf<<"-"<<cvl<<endl;
<<" freqRange="<<cvf<<"-"<<cvl<<" DateObs="<<endl;
{
PInPersist pin(filenamebuff);
TMatrix< complex<r_4> > vmtx;
......
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