/* ------------------------ Projet BAORadio -------------------- Programme d'extraction d'une partie de carte synchrotron (HASLAM @ 400 MHz) et fabrication d'un cube 3D (angles,fre) R. Ansari , C. Magneville - Juin 2010 Usage: syncube InFitsName Out3DPPFName [Out2DMapName] --------------------------------------------------------------- */ #include "sopnamsp.h" #include "machdefs.h" #include #include #include #include "tvector.h" #include "srandgen.h" #include "fioarr.h" #include "sopemtx.h" #include "pexceptions.h" #include "randr48.h" #include "tvector.h" // Pour l'utilisation des classes TArray, TMatrix , TVector #include "matharr.h" /* #include "spherehealpix.h" // Pour les cartes spheriques pixelisees au format HEALPix #include "spherethetaphi.h" // Pour les cartes spheriques pixelisees au format Theta-Phi #include "localmap.h" // Pour les cartes locales #include "mapoperation.h" // Pour les cartes locales */ #include "skymap.h" #include "mapoperation.h" // Pour les cartes locales #include "fitsspherehealpix.h" // Pour les I/O fits de HEALPix #include "fitsspherethetaphi.h" // Pour les I/O fits de SphereThetaPhi #include "fitslocalmap.h" // Pour les I/O fits de LocalMap #include "xastropack.h" // Pour faire les conversions de coordonnees celestes // Pour l'initialisation des modules #include "tarrinit.h" #include "skymapinit.h" #include "fiosinit.h" #include "timing.h" #include "ctimer.h" #include "cubedef.h" //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- int main(int narg, char* arg[]) { // Sophya modules initialization TArrayInitiator _inia; SkyMapInitiator _inis; FitsIOServerInitiator _inif; //------- AU LIEU DE ------> SophyaInit(); InitTim(); // Initializing the CPU timer Timer tm("gsm2cube"); if (narg < 6) { cout << "Usage: gsm2cube GSMPPFDirectoryFileName GSMMapNumStart GSMMapNumEnd Out3DPPFName \n" << " GSMPPFDirectoryFileName in form of Directory/gsmJJJJJ " << endl; return 1; } // decodage arguments string inpath = arg[1]; int numapstart = atoi(arg[2]); int numapend = atoi(arg[3]); string outname = arg[4]; int rc = 91; cout << " ====== gsm2cube : Input GSM map path= " << inpath << " NumStart=" << numapstart << " End=" << numapend << " OutName=" << outname << endl; try { int nfreqgsm = numapend-numapstart+1; if (nfreqgsm!=NFreq) { cout << " gsm2cube/ERROR: (nfreqgsm=" << nfreqgsm << ") <> NFreq (=" << NFreq << ") -> exit 9" << endl; return 9; } double tet0 = Angle(Theta0Degre,Angle::Degree).ToRadian(); double phi0 = Angle(Phi0Degre,Angle::Degree).ToRadian(); double dtet = Angle(ThetaSizeDegre,Angle::Degree).ToRadian()/(double)NTheta; double dphi = Angle(PhiSizeDegre,Angle::Degree).ToRadian()/(double)NPhi; TArray ocube(NPhi,NTheta,NFreq); double mjd2000 = MJDfrDate(1,1,2000); // Modified Julian Date pour 1 Janvier 2000 cout << "gsm2cube[1] Loop over input GSM spherical maps ... " << endl; for(sa_size_t kf=0; kf gsm; pin >> gsm; cout << " Freq=" << gsm.Info()["FMHz"] << " MHz " << endl; for (sa_size_t j=0; j " << outname << endl; POutPersist poc(outname); poc << ocube; } rc = 0; } catch (PThrowable& exc) { cerr << " gsm2cube.cc catched Exception " << exc.Msg() << endl; rc = 77; } catch (std::exception& sex) { cerr << "\n gsm2cube.cc std::exception :" << (string)typeid(sex).name() << "\n msg= " << sex.what() << endl; } catch (...) { cerr << " gsm2cube.cc catched unknown (...) exception " << endl; rc = 78; } cout << ">>>> gsm2cube ------- FIN ----------- Rc=" << rc << endl; return rc; }