#include "racquproc.h" #include #include #include #include "pexceptions.h" #include "tvector.h" #include "fioarr.h" #include "timestamp.h" #include "fftpserver.h" #include "fftwserver.h" #include "FFTW/fftw3.h" #include "pciewrap.h" #include "brpaqu.h" #include "minifits.h" //------------------------------------------------------- // Classe thread de traitement //------------------------------------------------------- DataProc::DataProc(RAcqMemZoneMgr& mem, string& path, uint_4 nmean, uint_4 nmax) : memgr(mem) { nmax_ = nmax; nmean_ = nmean; stop_ = false; path_ = path; } inline r_4 Zmod2(complex z) { return (z.real()*z.real()+z.imag()*z.imag()); } void DataProc::run() { setRC(1); try { TimeStamp ts; cout << " DataProc::run() - Starting " << ts << " NMaxMemZones=" << nmax_ << endl; char fname[512]; sprintf(fname,"%s/proc.log",path_.c_str()); ofstream filog(fname); filog << " DataProc::run() - starting log file " << ts << endl; // Initialisation pour clcul FFT TVector< complex > cfour; // composant TF uint_4 paqsz = memgr.PaqSize(); BRPaquet pq(NULL, NULL, paqsz); TVector vx(pq.DataSize()); vx = (r_4)(0.); FFTPackServer ffts; ffts.FFTForward(vx, cfour); TVector spectre; spectre.ReSize(cfour.Size()); fftwf_plan plan = fftwf_plan_dft_r2c_1d(pq.DataSize(), vx.Data(), (fftwf_complex *)cfour.Data(), FFTW_ESTIMATE); uint_4 ifile = 0; for (uint_4 kmz=0; kmz NULL" << endl; setRC(2); return; } BRPaquet paq0(NULL, buff, paqsz); uint_4 nzm = 0; for(uint_4 i=0; i= nmean_) { spectre /= (r_4)(nzm); sprintf(fname,"%s/spectre%d.ppf",path_.c_str(),(int)ifile); POutPersist po(fname); po << spectre; spectre = (r_4)(0.); nzm = 0; ifile++; ts.SetNow(); filog << ts << " : proc file " << fname << endl; cout << " DataProc::run() " << ts << " : created file " << fname << endl; } memgr.FreeMemZone(mid, MemZS_Proc); } } catch (PException& exc) { cout << " DataProc::run()/catched PException " << exc.Msg() << endl; setRC(3); return; } catch(...) { cout << " DataProc::run()/catched unknown ... exception " << endl; setRC(4); return; } setRC(0); return; }