Changeset 1148 in Sophya for trunk/SigPredictor/makebolotimeline.cc
- Timestamp:
- Aug 29, 2000, 12:03:24 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SigPredictor/makebolotimeline.cc
r801 r1148 2 2 3 3 #include <iomanip.h> 4 #include <new> 4 5 #ifdef __MWERKS__ 5 6 #include "macenvvariables.h" … … 9 10 10 11 #include "makebolotimeline.h" 12 //#include "fitsioserver.h" 11 13 12 14 13 15 MakeBoloTimeline::MakeBoloTimeline(char file[], AbsLightSource& LSrc, 14 AbsLobeNoPolar& Lobe, SpectralResponse &Filter, Normalisation Norm) 15 :tool(&LSrc,&Lobe,&Filter), NormMethode(Norm) 16 { 16 AbsLobeNoPolar& Lobe, SpectralResponse& Filter, Normalisation Norm) 17 { IsSigCalctool=true; 18 IsPtSrcInBandtool=false; 19 pSigCalcTool=new SigCalcTool(&LSrc,&Lobe,&Filter); 20 MakeBoloTimeline(file,*pSigCalcTool,Norm); 21 } 22 23 MakeBoloTimeline::MakeBoloTimeline(char file[], LightPtSrcLevSInBand& LSrc, 24 MeanFreqLobe& Lobe, LevSPanckBand band, Normalisation Norm) 25 { IsSigCalctool=false; 26 IsPtSrcInBandtool=true; 27 28 pPtSrcInBandCalTools=new PtSrcInBandCalTools(&LSrc,&Lobe,band); 29 MakeBoloTimeline(file,*pPtSrcInBandCalTools,Norm); 30 } 31 32 MakeBoloTimeline::MakeBoloTimeline(char file[], AbsCalcTool& Tool, Normalisation Norm) 33 :NormMethode(Norm), ptool(&Tool) 34 { 35 17 36 #ifndef __MWERKS__ 18 37 char* PATHResults=getenv("PATHResults"); 19 38 #endif 39 40 saveReadMe(file); 41 20 42 char filecur[150]; 21 // On remplit le ReadMe 22 sprintf(filecur,"%s%s.ReadMe", PATHResults,file); 43 sprintf(filecur,"%s%s.dat", PATHResults,file); 44 45 pMystr= new ofstream(filecur,ios::out|ios::trunc); 46 // pMystr->setf(ios::scientific); 47 (*pMystr)<<setprecision(5); 48 49 #ifdef VisuIsActive 50 // Visu de controle 51 try 52 { pSphere=new SphereHEALPix<r_4>(64); 53 pSphereInt=new SphereHEALPix<uint_2>(64); 54 } 55 catch (bad_alloc) 56 { cerr<<"bad alloc in MakeBoloTimeline:"<<file<<endl; 57 } 58 59 sprintf(Name, "%s%s%s",PATHResults,file,".visu"); 60 #endif 61 } 62 63 64 MakeBoloTimeline::~MakeBoloTimeline() 65 { 66 (*pMystr)<<flush; 67 pMystr->close(); 68 delete pMystr; 69 70 if(IsSigCalctool) delete pSigCalcTool; 71 if(IsPtSrcInBandtool) delete pPtSrcInBandCalTools; 72 73 #ifdef VisuIsActive 74 for(long index=0; index<(*pSphere).NbPixels();index++) 75 if ((*pSphereInt).PixVal(index)!=0) 76 (*pSphere).PixVal(index)=(*pSphere).PixVal(index)/(*pSphereInt).PixVal(index); 77 78 // FitsIoServer FitsServer; 79 #ifndef __MWERKS__ 80 char* PATHResults=getenv("PATHResults"); 81 #endif 82 83 // FitsServer.Mollweide_picture_projection((*pSphere),Name); // BUGG XXXXXXXXX 84 85 delete pSphere; 86 delete pSphereInt; 87 #endif 88 } 89 90 void MakeBoloTimeline::addToStreamArchTOI(double theta,double phi) 91 { // Theta en heures, Phi en degres, systeme RA Dec 92 if((theta==ERROR_LABEL)||(phi==ERROR_LABEL)) return; 93 94 // On passe en Radian 95 double thetaRad=theta*15./180*M_PI; 96 double phiRad=phi/180.*M_PI; 97 98 // Go to Galactic ccordinates 99 double lgalax=0.; 100 double bgalax=0.; 101 kmg_eulerRad(thetaRad,phiRad,1,&lgalax,&bgalax); 102 103 // Add to time line 104 addToStream(lgalax,bgalax); 105 } 106 107 void MakeBoloTimeline::addToStream(double lgalax,double bgalax) 108 { // lgalax et bgalax en Radian, Systeme coord Galactique J2000 109 110 double theta=M_PI/2.-bgalax; // Coordonnees Spheriques galactiques 111 double phi=lgalax; 112 double value; 113 114 switch (NormMethode) 115 { 116 case RayleighJeans: // Value en TempeRJ 117 { value= NormRJ*ptool->compPixelQD(theta,phi); 118 break; 119 } 120 case TempeCMB: // Value en tempeCMB 121 { value= NormTCMB*ptool->compPixelQD(theta,phi); 122 break; 123 } 124 default: // Value en power 125 { value =ptool->compPixelQD(theta,phi); 126 break; 127 } 128 } 129 (*pMystr)<<lgalax<<'\t'<<bgalax<<'\t'<<value<<'\n'; 130 131 long PixelNumb=(*pSphere).PixIndexSph(theta,phi); 132 (*pSphere).PixVal(PixelNumb)+=value; 133 (*pSphereInt).PixVal(PixelNumb)++; 134 135 return; 136 } 137 138 void MakeBoloTimeline::saveReadMe(char File[]) 139 { char filecur[150]; 140 // Fill Header file for ascii output 141 sprintf(filecur,"%s%s.ReadMe", PATHResults,File); 23 142 cout<<filecur<<endl; 24 143 ofstream ReadMe(filecur,ios::out|ios::trunc); 25 144 26 145 ReadMe<<" Fichier de timeline pour:"<<endl; 27 ReadMe<<" La source physique: "<<endl; 28 LSrc.print(ReadMe); 29 ReadMe<<" Le Lobe : "<<endl; 30 Lobe.print(ReadMe); 31 ReadMe<<" Le Filtre: "<<endl; 32 Filter.Print(ReadMe); 33 ReadMe<<endl; 146 ptool->print(ReadMe); 34 147 35 NormRJ= tool.NormKelvinRayleighJeans();36 NormTCMB= tool.NormKelvinCMB();148 NormRJ=ptool->NormKelvinRayleighJeans(); 149 NormTCMB=ptool->NormKelvinCMB(); 37 150 38 // ReadMe.setf(ios::scientific);39 151 ReadMe<< setprecision(3); 40 152 ReadMe<<" Constantes de normalisation"<<endl; … … 55 167 default: ReadMe<< "Watt/m2 effectif de mirroir"<<endl; 56 168 } 57 ReadMe<<"Fichier ecrit selon le format"<<endl; 58 ReadMe<<"Radian\tRadian\tAbove Unit"<<endl; 169 170 ReadMe<<"Fichier coordones galactique J2000ecrit selon le format"<<endl; 171 ReadMe<<"l_galax(Radian)\tb_galax(Radian)\tAbove Unit"<<endl; 59 172 60 173 // J'espere que c'est assez 61 174 ReadMe.close(); 62 175 63 sprintf(filecur,"%s%s.dat", PATHResults,file); 64 65 pMystr= new ofstream(filecur,ios::out|ios::trunc); 66 // pMystr->setf(ios::scientific); 67 (*pMystr)<<setprecision(5); 176 return; 68 177 } 69 178 70 void MakeBoloTimeline::addToStreamArchTOI(double theta,double phi)71 { // Theta en heures, Phi en degres72 if((theta==ERROR_LABEL)||(phi==ERROR_LABEL)) return;73 double thetaRad=theta*15./180*M_PI;74 double phiRad=phi/180.*M_PI;75 76 addToStream(theta,phi);77 }78 79 void MakeBoloTimeline::addToStream(double theta,double phi)80 { // theta et Phi en Radian.81 switch (NormMethode)82 {83 case RayleighJeans:84 { double TempeRJ= NormRJ*tool.compPixel(theta,phi);85 (*pMystr)<<theta<<'\t'<<phi<<'\t'<<TempeRJ<<'\n';86 return;87 }88 case TempeCMB:89 { double tempeCMB= NormTCMB*tool.compPixel(theta,phi);90 (*pMystr)<<theta<<'\t'<<phi<<'\t'<<tempeCMB<<'\n';91 return;92 }93 default:94 { double power=tool.compPixel(theta,phi);95 (*pMystr)<<theta<<'\t'<<phi<<'\t'<<power<<'\n';96 return;97 }98 }99 }
Note:
See TracChangeset
for help on using the changeset viewer.