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

1/ Correction d'un petit bug dans p4autils.cc

2/ Ajout des fichiers trkfit.h .cc (utilitaires pour fit de geometrie PAON4) et adaptation makefile
                                                      Reza , 15/02/2019
parent 1b8f91a6
......@@ -6,8 +6,10 @@ OBJ = ./Objs/
EXE = ./Objs/
# List of include files of this package, and .o files to handle dependencies
MYINCLISTHERE = p4autils.h visip4reader.h visp4winreader.h p4gnugain.h p4gvcor.h p4phcor.h p4freqselmgr.h
MYOLISTHERE = $(OBJ)/p4autils.o $(OBJ)/visip4reader.o $(OBJ)/visp4winreader.o $(OBJ)/p4gnugain.o $(OBJ)/p4gvcor.o $(OBJ)/p4phcor.o $(OBJ)/p4freqselmgr.o
MYINCLISTHERE = p4autils.h visip4reader.h visp4winreader.h p4gnugain.h p4gvcor.h p4phcor.h p4freqselmgr.h
MYINCLISTHEREFIT = acbeam.h gacfit.h cxbeam.h gcxfit.h gcxfitbaseline.h trkfit.h
MYOLISTHERE = $(OBJ)/p4autils.o $(OBJ)/visip4reader.o $(OBJ)/visp4winreader.o $(OBJ)/p4gnugain.o $(OBJ)/p4gvcor.o $(OBJ)/p4phcor.o $(OBJ)/p4freqselmgr.o
MYOLISTHEREFIT = $(OBJ)/trkfit.o
# Define our target list
all : rdvisip4 visi2ntac visi2dtacx visi2tmfreq tstutls p4conv2fits msvis2dt visiavg filt_blind ckconvphases vis2ra p4vdblist rdthermrfi visamm trkacfit tfm2dt
......@@ -87,12 +89,15 @@ $(OBJ)/visamm.o : visamm.cc $(MYINCLISTHERE)
trkacfit : $(EXE)/trkacfit
echo '---trkacfit made'
$(EXE)/trkacfit : $(OBJ)/trkacfit.o $(MYOLISTHERE)
$(CXXLINK) -o $(EXE)/trkacfit $(OBJ)/trkacfit.o $(MYOLISTHERE) $(SOPHYAEXTSLBLIST)
$(EXE)/trkacfit : $(OBJ)/trkacfit.o $(MYOLISTHERE) $(MYOLISTHEREFIT)
$(CXXLINK) -o $(EXE)/trkacfit $(OBJ)/trkacfit.o $(MYOLISTHERE) $(MYOLISTHEREFIT) $(SOPHYAEXTSLBLIST)
$(OBJ)/trkacfit.o : trkacfit.cc $(MYINCLISTHERE) acbeam.h gacfit.h cxbeam.h gcxfit.h
$(OBJ)/trkacfit.o : trkacfit.cc $(MYINCLISTHERE) $(MYINCLISTHEREFIT)
$(CXXCOMPILE) -o $(OBJ)/trkacfit.o trkacfit.cc
$(OBJ)/trkfit.o : trkfit.cc $(MYINCLISTHERE) $(MYINCLISTHEREFIT)
$(CXXCOMPILE) -o $(OBJ)/trkfit.o trkfit.cc
## programme pour extraire un DataTable a partir des TFM (fichier PPF), input programme trkacfit
tfm2dt : $(EXE)/tfm2dt
echo '---tfm2dt made'
......
......@@ -388,8 +388,8 @@ static vector<P4FreqBand> dc_fbands_;
static vector<P4FreqBand> dc_kill_fbands_;
static int dc_decode_freqband(string const& key, string const& toks)
{
if (key != "freqband") { // CA NE DEVRAIT PAS ARRIVER
cout << "dc_decode_freqband()/ERROR BAD key = " << key << " ( <> freqband"<<endl;
if ((key != "freqband")&&(key != "killfreqband")) { // CA NE DEVRAIT PAS ARRIVER
cout << "dc_decode_freqband()/ERROR BAD key = " << key << " ( <> freqband , killfreqband) "<<endl;
return 1;
}
double f0=1390.,df=1.;
......
......@@ -85,8 +85,11 @@ static double theta_0=0., phi_0=0.; // Theta, phi angles correspondi
//--- End of list of global parameters
//-------- Declaration of functions in this file - code after the main, below
int decode_args(int narg, char* arg[]);
int read_p4_autocxcors(vector< vector<double> > & v_time_data, vector< vector< vector<double> > > & vv_data,
vector< vector< vector<double> > > & vv_err,
vector< vector<double> > & v_min_data, vector< vector<double> > & v_max_data,
......
/* PAON4 analysis software
classes and functions to read in and perform array geometry determination
using satellites and celestial sources tracks
R. Ansari, Fevrier 2019 */
#include "pexceptions.h"
#include "trkfit.h"
#include "datacards.h"
#include "skymap.h"
//------------------- TrkInputDataSet -------------------------------------
TrkInputDataSet::TrkInputDataSet(string dcfilename)
: zenang(0.) , theta_0(0.) , phi_0(0.)
{
ReadDatacardFile(dcfilename);
}
static vector<string> * dataflnm_p_ = NULL;
static vector<double> * tstart_p_ = NULL;
static vector<double> * tend_p_ = NULL;
static vector<double> * v_freqs_p_ = NULL;
static vector<string> * trkflnm_p_ = NULL;
static size_t trk_cnt = 0;
static int decode_trkcard(string const& key, string const& toks)
{
if (key != "trk") { // CA NE DEVRAIT PAS ARRIVER
cout << "decode_trkcard/ERROR BAD key = " << key << " ( <> trk"<<endl;
return 1;
}
if (! dataflnm_p_ ) { // CA NE DEVRAIT PAS ARRIVER
cout << "decode_trkcard/ERROR dataflnm_p_ = NULL !"<<endl;
return 1;
}
char flnmdata[256], flnmtrk[256];
double ts,te,freq;
sscanf(toks.c_str(),"%s %lg,%lg %lg %s",flnmdata,&ts,&te,&freq,flnmtrk);
dataflnm_p_->push_back(flnmdata);
tstart_p_->push_back(ts*60.);
tend_p_->push_back(te*60.);
v_freqs_p_->push_back(freq);
trkflnm_p_->push_back(flnmtrk);
trk_cnt++;
return 0;
}
size_t TrkInputDataSet::ReadDatacardFile(string dcfilename)
{
DataCards dc;
string match="freqband";
dc.AddProcF(decode_trkcard, match);
zenang=0.; theta_0=0.; phi_0=0.;
dataflnm.clear();
tstart.clear();
tend.clear();
v_freqs.clear();
trkflnm.clear();
dataflnm_p_ = &dataflnm;
tstart_p_ = &tstart;
tend_p_ = &tend;
v_freqs_p_ = &v_freqs;
trkflnm_p_ = &trkflnm;
trk_cnt = 0;
// @trk visiDataTableFile tstart,tend freq TrackFileName
// tstart , tend in minutes freq in MHz
dc.ReadFile(dcfilename);
if (dc.HasKey("inpath")) { // @inpath InputFilesDirectoryPath
input_base_path = dc.SParam("inpath",0,"");
}
if (dc.HasKey("zenang")) { // @zenang Zenith Angle in degree
zenang = dc.DParam("zenang",0,0.);
if (zenang<0.) {
theta_0 = Angle(-zenang, Angle::Degree).ToRadian(); phi_0 = Angle::PioTwoCst()+Angle::OnePiCst();
}
else {
theta_0 = Angle(+zenang, Angle::Degree).ToRadian(); phi_0 = Angle::PioTwoCst();
}
}
dataflnm_p_ = NULL;
tstart_p_ = NULL;
tend_p_ = NULL;
v_freqs_p_ = NULL;
trkflnm_p_ = NULL;
if (trk_cnt != trkflnm.size()) { // ca ne devrait pas arriver
cout << " TrkInputDataSet::ReadDatacardFile()/BUG trk_cnt != trkflnm.size()"<<endl;
throw PError("TrkInputDataSet::ReadDatacardFile() trk_cnt != trkflnm.size()");
}
trk_cnt=0;
dcfilename_ = dcfilename;
return trkflnm.size();
}
ostream & TrkInputDataSet::Print(ostream & os) const
{
os << "TrkInputDataSet(dcfilename="<<dcfilename_<<")/Info: dec-shift(zenithAngle)= "<<zenang<<" NbTrk="<<NbTrk()<<endl;
os << "...InputBaseDirectoryPath="<<input_base_path<<endl;
for(size_t i=0; i<NbTrk(); i++) {
os <<"["<<i<<"] data= "<< dataflnm[i]<<" ts,te(min)= "<<tstart[i]/60.<<","<<tend[i]/60.<<" freg(MHz)= "<<v_freqs[i]
<<" TrkFile="<<trkflnm[i]<<endl;
}
return os;
}
/* PAON4 analysis software
classes and functions to read in and perform array geometry determination
using satellites and celestial sources tracks
R. Ansari, Fevrier 2019 */
#include <string>
#include <vector>
#include <iostream>
using namespace std;
using namespace SOPHYA;
//-------------------------------------------------------------------------
//------------------- TrkInputDataSet -------------------------------------
//----- Class describing the input data set list
class TrkInputDataSet {
public:
TrkInputDataSet() : zenang(0.) , theta_0(0.) , phi_0(0.) { }
TrkInputDataSet(string dcfilename); // create the object reading filenames and other parameters from the datacard file
size_t ReadDatacardFile(string dcfilename);
ostream & Print(ostream & os) const;
inline size_t NbTrk() const { return dataflnm.size(); }
string dcfilename_;
string input_base_path;
vector<string> dataflnm; // PAON4 data Auto+Cross corr DataTable filenames
vector<double> tstart, tend; // time interval in seconds (start,end time)
vector<double> v_freqs; // Central frequency associated to each visibilty = f(time) dataset
vector<string> trkflnm;
double zenang; // zenith angle = shift with declination, used for initial value of fitted angles
double theta_0, phi_0; // Theta, phi angles corresponding
};
inline ostream& operator << (ostream& s, TrkInputDataSet const & trk)
{ trk.Print(s); return(s); }
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