Commit 6696576a authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Ajoute methodes P4PhaseCor::writePPF() et readPPF() , ajout programme...

Ajoute methodes P4PhaseCor::writePPF() et readPPF() , ajout programme utilitaire ckconvphases.cc et MAJ makefile, Reza 15/01/2018
parent 0444f010
// Utilisation de SOPHYA pour faciliter les tests ...
#include "sopnamsp.h"
#include "machdefs.h"
/* ----------------------------------------------------------
Projet BAORadio/PAON4 - (C) LAL/IRFU 2008-2018
Programme de lecture / conversion de fichier de parametre
de fit de phase
R. Ansari Janvier 2018
---------------------------------------------------------- */
// include standard c/c++
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <string>
//--- include SOPHYA
#include "array.h"
#include "tarrinit.h"
//--- include AnaPAON4
#include "p4phcor.h"
/* --Fonction-- */
int Usage(bool fgarg)
{
cout << " --- ckconvphases.cc : read phase fiited parameter file and writes the phase vectors in a PPF file \n";
if (fgarg) cout << " Missing argument ! \n";
cout << " Usage: ckconvphases in_parameter_file out_ppf_file " << endl;
return 1;
}
//----------------------------------------------------
//----------------------------------------------------
int main(int narg, char* arg[])
{
if ((narg>1)&&(strcmp(arg[1],"-h")==0)) return Usage(false);
if (narg<3) return Usage(true);
string inparmfile = arg[1];
string outppf = arg[2];
TArrayInitiator _inia;
cout << " ---- ckconvphases.cc doing: \n P4PhaseCor phc("<<inparmfile<<") phc.writePPF("<<outppf<<")"<<endl;
int rc = 0;
try {
P4PhaseCor phc(inparmfile);
phc.writePPF(outppf);
}
catch (PException& exc) {
cerr << " ckconvphases.cc catched PException " << exc.Msg() << endl;
rc = 77;
}
catch (std::exception& sex) {
cerr << "\n ckconvphases.cc std::exception :"
<< (string)typeid(sex).name() << "\n msg= "
<< sex.what() << endl;
rc = 78;
}
catch (...) {
cerr << " ckconvphases.cc catched unknown (...) exception " << endl;
rc = 79;
}
cout << "--- ckconvphases.cc ------- END ----------- RC=" << rc << endl;
return rc;
}
......@@ -10,11 +10,13 @@ MYINCLISTHERE = p4autils.h visip4reader.h visp4winreader.h p4gnugain.h p4gvcor.h
MYOLISTHERE = $(OBJ)/p4autils.o $(OBJ)/visip4reader.o $(OBJ)/visp4winreader.o $(OBJ)/p4gnugain.o $(OBJ)/p4gvcor.o $(OBJ)/p4phcor.o
# Define our target list
all : rdvisip4 visi2ntac visi2dtacx visi2tmfreq p4conv2fits msvis2dt visiavg filt_blind
all : rdvisip4 visi2ntac visi2dtacx visi2tmfreq p4conv2fits msvis2dt visiavg filt_blind ckconvphases
clean :
rm -f $(EXE)/rdvisip4 $(EXE)/visi2ntac $(EXE)/visi2dtacx $(EXE)/visi2tmfreq $(EXE)/p4conv2fits $(EXE)/msvis2dt $(EXE)/visiavg $(EXE)/filt_blind
rm -f $(OBJ)/rdvisip4.o $(OBJ)/visi2ntac.o $(OBJ)/visi2dtacx.o $(OBJ)/visi2tmfreq.o $(OBJ)/p4conv2fits.o $(OBJ)/msvis2dt.o $(OBJ)/visiavg.o $(OBJ)/filt_blind.o
rm -f $(EXE)/rdvisip4 $(EXE)/visi2ntac $(EXE)/visi2dtacx $(EXE)/visi2tmfreq $(EXE)/p4conv2fits $(EXE)/msvis2dt $(EXE)/visiavg \
$(EXE)/filt_blind $(EXE)/ckconvphases
rm -f $(OBJ)/rdvisip4.o $(OBJ)/visi2ntac.o $(OBJ)/visi2dtacx.o $(OBJ)/visi2tmfreq.o $(OBJ)/p4conv2fits.o $(OBJ)/msvis2dt.o $(OBJ)/visiavg.o \
$(OBJ)/filt_blind.o $(OBJ)/ckconvphases.o
rm -f $(MYOLISTHERE)
depend :
......@@ -67,6 +69,16 @@ $(EXE)/filt_blind : $(OBJ)/filt_blind.o $(MYOLISTHERE)
$(OBJ)/filt_blind.o : filt_blind.cc $(MYINCLISTHERE)
$(CXXCOMPILE) -o $(OBJ)/filt_blind.o filt_blind.cc
## Utilitaire pour correction des phases
ckconvphases : $(EXE)/ckconvphases
echo '---filt_blind made'
$(EXE)/ckconvphases : $(OBJ)/ckconvphases.o $(MYOLISTHERE)
$(CXXLINK) -o $(EXE)/ckconvphases $(OBJ)/ckconvphases.o $(MYOLISTHERE) $(SOPHYAEXTSLBLIST)
$(OBJ)/ckconvphases.o : ckconvphases.cc $(MYINCLISTHERE)
$(CXXCOMPILE) -o $(OBJ)/ckconvphases.o ckconvphases.cc
## programme de remplissage de DataTable avec cross-correlation fct du temps
visi2dtacx : $(EXE)/visi2dtacx
......
......@@ -99,6 +99,31 @@ void P4PhaseCor::readFitParamFile(string const & filename)
}
}
void P4PhaseCor::writePPF(string const & filename)
{
POutPersist po(filename);
for(size_t i=0; i<v_phases_.size(); i++) {
string phnm="phase"+P4AVisiNumEncoder::getFeedName(i);
po << PPFNameTag(phnm) << v_phases_[i];
}
cout << " P4PhaseCor::writePPF()/Info : phase vectors written to PPF file " << filename;
return;
}
void P4PhaseCor::readPPF(string const & filename)
{
PInPersist pin(filename);
for(size_t i=0; i<v_phases_.size(); i++) {
string phnm="phase"+P4AVisiNumEncoder::getFeedName(i);
TVector<double> phase;
pin >> PPFNameTag(phnm) >> phase;
setFeedPhases(i, phase);
}
cout << " P4PhaseCor::readPPF()/Info : phase vectors read from PPF file " << filename;
return;
}
void P4PhaseCor::setFeedPhases(size_t numfeed, TVector<double> vphase)
{
if (numfeed >= v_phases_.size())
......
......@@ -42,6 +42,11 @@ public:
*/
void readFitParamFile(string const & filename);
//! write the eight phase vectors in a PPF file
void writePPF(string const & filename);
//! read the eight phase vectors from a PPF file
void readPPF(string const & filename);
//! set/changes the values of the phase=func(freq) (vector \b vphase) for the feed \b numfeed (0...7 -> 1H,2H...,3V,4V)
void setFeedPhases(size_t numfeed, TVector<double> vphase);
......
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