Commit 23d46bd7 authored by OP's avatar OP
Browse files

missing .o file ds clean (makefile)

add something for fits output (unfinished)
add fre & ra vectors (center of bins)
timevect now also gives center of bin
parent 38130d11
......@@ -14,7 +14,7 @@ all : rdvisip4 visi2ntac visi2dtacx visi2tmfreq p4conv2fits msvis2dt visiavg
clean :
rm -f $(EXE)/rdvisip4 $(EXE)/visi2ntac $(EXE)/visi2dtacx $(EXE)/visi2tmfreq $(EXE)/p4conv2fits $(EXE)/msvis2dt $(EXE)/visiavg
rm -f $(OBJ)/rdvisip4.o $(OBJ)/visi2ntac.o $(OBJ)/visi2dtacx.o $(OBJ)/visi2tmfreq.o $(OBJ)/p4conv2fits.o $(OBJ)/msvis2dt.o
rm -f $(OBJ)/rdvisip4.o $(OBJ)/visi2ntac.o $(OBJ)/visi2dtacx.o $(OBJ)/visi2tmfreq.o $(OBJ)/p4conv2fits.o $(OBJ)/msvis2dt.o $(OBJ)/visiavg.o
rm -f $(MYOLISTHERE)
###############################################################
......
......@@ -12,6 +12,8 @@
#include <iomanip>
#include "p4autils.h"
#include "xastropack.h"
//---------------------------------------------------------------------
//---- declaration des constantes (static) de la classe P4FreqBand ---
......@@ -177,7 +179,7 @@ P4AnaParams::P4AnaParams()
: inpath5_("bao5/"), inpath6_("bao6/"), Imin_(0), Imax_(10), Istep_(1),
fgserall_(false), fgtmsel_(false),
fgreorderfreq_(false), gain_gnu_file_("gain.ppf"),
outfile_("p4a.ppf"), Nmean_(10), prtlev_(0), prtmodulo_(1),
fitsoutfile_("p4a.fits"),outfile_("p4a.ppf"), Nmean_(10), prtlev_(0), prtmodulo_(1),
fgTFM_(false), TFMtimebin_(30), TFMfreqbin_(4), fgdtable_(false)
{
......@@ -296,11 +298,14 @@ int P4AnaParams::UsageOptions()
ostream& P4AnaParams::Print(ostream& os) const
{
os<<" In5 path="<<inpath5_<<" In6 path="<<inpath6_ << endl;
if (!fgserall_ && !fgtmsel_)
if (!fgserall_ && !fgtmsel_){
os << " Input VisibMtx seq. number in Range: "<<Imin_<<"<=I<="<<Imax_<<" (step="<<Istep_<<")"<<endl;
if (fgreorderfreq_) os<<" (frequency reordering for FFT firmware) ";
else if (fgserall_)
if (fgreorderfreq_)
os<<" (frequency reordering for FFT firmware) "<< endl;
}
else if (fgserall_){
os << " Process ALL visibilty matrices ... " << endl;
}
else {
TimeStamp tustart = tmsel_tu_; tustart.ShiftSeconds(-tmsel_duration_*30.);
TimeStamp tuend = tmsel_tu_; tuend.ShiftSeconds(tmsel_duration_*30.);
......@@ -313,3 +318,19 @@ ostream& P4AnaParams::Print(ostream& os) const
return os;
}
//coords de paon4 en degres decimaux [antenne centrale]
static double paon_lat = 47.3820 ;// 47deg 22' 55.1''
static double paon_lon = 2.19964; // 2deg 11' 58.7''
double P4Coords::getLon(){return(paon_lon);}
double P4Coords::getLat(){return(paon_lat);}
double P4Coords::RAFromTimeTU(TimeStamp const & tu){
int y,mn,dd;
tu.GetDate(y,mn,dd);
double myjd = MJDfrDate ( dd+tu.SecondsPart()/86400. , mn,dd);
double ra = LSTfrMJD (myjd , getLon() );
return (ra);
}
......@@ -154,6 +154,8 @@ public:
string gain_gnu_file_;
//--- nom du fichier de sortie
string outfile_;
//--- nom du fichier fits de sortie
string fitsoutfile_;
//--- nombre de matrices de visibilites pour les calculs de moyenne, sigma ...
int Nmean_;
//--- print level and print modulo
......@@ -172,6 +174,13 @@ public:
inline ostream& operator << (ostream& os, P4AnaParams const& a)
{ return a.Print(os); }
class P4Coords{
public :
static double getLon();
static double getLat();
// renvoie le RA observe en heures decimales a partir du TU
static double RAFromTimeTU(TimeStamp const & tu);
};
#endif
......@@ -41,6 +41,9 @@
#include "visip4reader.h"
#include "p4gnugain.h"
#include "fitsioserver.h"
#include "fiosinit.h"
int Usage(void);
int Usage(void)
{
......@@ -56,10 +59,17 @@ int main(int narg, const char* arg[])
{
// --- Decoding parameters
if( (narg<2) || ((narg>1)&&(strcmp(arg[1],"-h")==0) ) ) return Usage();
FitsIOServerInit();
P4AnaParams params;
params.DecodeArgs(narg, arg);
string outfile = params.outfile_;
if (outfile.length()<1) outfile = "visavg.ppf";
string fitsoutfile = params.fitsoutfile_;
if (fitsoutfile.length()>=1) {
fitsoutfile = "!"+fitsoutfile ; // adds '!' ?
}
int deltaIavg = params.TFMtimebin_;
sa_size_t TFMfbin = params.TFMfreqbin_;
int Imin = params.Imin_, Imax = params.Imax_, Istep = params.Istep_;
......@@ -91,8 +101,7 @@ int main(int narg, const char* arg[])
for(size_t k=0; k<KVCXHH.size(); k++) {
cout << "KVCXHH["<<k<<"]="<<KVCXHH[k]<<" ->"<<visiencod.Convert2VisiName(KVCXHH[k])<<endl;
}
// --- Open file to store visibility matrices if requested
// ---
HiStatsInitiator _inia;
int rc = 0;
......@@ -135,6 +144,7 @@ int main(int narg, const char* arg[])
bool fgok=true;
// un vecteur avec les temps
TVector< double > timevec((Imax-Imin)/Istep/deltaIavg);
TVector< double > ravec((Imax-Imin)/Istep/deltaIavg);
TMatrix< complex<r_4> > vismtx;
TMatrix< complex<r_4> > acsum;
TMatrix< r_4 > acsum_sq; // wil sum only the real part ^2
......@@ -262,7 +272,10 @@ int main(int narg, const char* arg[])
}
}
} //----- end of loop over the 6 Xcor
timevec(TFMtmidx) = cfdate.TimeDifferenceSeconds(cfdate,datestart);
double tdif = cfdate.TimeDifferenceSeconds(cfdate,dateobs)/2.;
timevec(TFMtmidx) = dateobs.TimeDifferenceSeconds(dateobs.ShiftSeconds (tdif ),datestart); // centre du bin
ravec(TFMtmidx) = P4Coords::RAFromTimeTU(dateobs);
TFMtmidx++;
// ... done
I=0; cntnt++;
......@@ -275,7 +288,12 @@ int main(int narg, const char* arg[])
}
cout<<"visiavg/Info: count="<<cnt<<" visimtx read "<<endl;
// --- Sauvegarde cartes temps-frequence
// --- Sauvegarde cartes temps-frequence en fits
if (fitsoutfile.length()>=1)
FitsInOutFile fos(fitsoutfile, FitsInOutFile::Fits_Create);
// DataTable dt;
POutPersist potfm(outfile);
// --- renormalizing and saving AutoCorr time-frequency maps
cout<<" visiavg/Info: Saving 8 AutoCorr time-frequency maps to PPF file "<<outfile<<endl;
......@@ -289,7 +307,7 @@ int main(int narg, const char* arg[])
tfmapsq = tfmapsq - tfmap.MulElt(tfmap,tfmap) ;
potfm << PPFNameTag(tfm_names[k]) << tfmap;
potfm << PPFNameTag(tfmsq_names[k]) << tfmapsq;
}
// --- 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;
......@@ -318,9 +336,20 @@ int main(int narg, const char* arg[])
potfm << PPFNameTag(vitfmCC_names[k]) << tfmap_sqpi;
}
potfm << PPFNameTag("TimeVec") << timevec ;
potfm << PPFNameTag("RAVec") << ravec ;
// --- FIN sauvegarde cartes temps-frequence
// resu.Update();
P4FreqBand myp4fre;
TVector <double> avg_freqs( myp4fre.getP4NbFreqChannels()/TFMfbin);
double frbase = myp4fre.freqstart_ + myp4fre.getP4FreqResolution()/2. ;
for (int kf=0 ; kf< myp4fre.getP4NbFreqChannels()/TFMfbin ; kf++,frbase +=myp4fre.getP4FreqResolution() )
avg_freqs(kf) = frbase ;
potfm << PPFNameTag("FreqVec") << avg_freqs;
cout << resu; // Update est fait lors du print
}
catch (PException& exc) {
cerr << " visiavg.cc catched PException " << exc.Msg() << endl;
......
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