Changeset 1804 in Sophya for trunk/ArchTOIPipe/ProcWSophya
- Timestamp:
- Nov 30, 2001, 10:07:16 PM (24 years ago)
- Location:
- trunk/ArchTOIPipe/ProcWSophya
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/ProcWSophya/Makefile.in
r1800 r1804 45 45 46 46 47 SRCFILES=map2toi.cc toi2map.cc rztoi.cc simtoipr.cc ktoibad.cc smoothtoi.cc toi2gmap.cc47 SRCFILES=map2toi.cc toi2map.cc rztoi.cc simtoipr.cc ktoibad.cc smoothtoi.cc 48 48 49 49 FILES=$(patsubst %.c,%.o,$(SRCFILES:.cc=.o)) -
trunk/ArchTOIPipe/ProcWSophya/toi2map.cc
r1792 r1804 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toi2map.cc,v 1. 19 2001-11-27 12:12:12aubourg Exp $5 // $Id: toi2map.cc,v 1.20 2001-11-30 21:07:16 aubourg Exp $ 6 6 7 7 #include "machdefs.h" … … 9 9 #include "pexceptions.h" 10 10 #include "ctimer.h" 11 #include "toi2 map.h"12 13 //////////////////////////////////////////////////////////////////////// 14 TOI2 Map::TOI2Map(SphereHEALPix<r_8>* sph,SphereHEALPix<r_8>* wsph)15 : m Sph(sph), mWSph(wsph), mWSphInternal(false)11 #include "toi2gmap.h" 12 13 //////////////////////////////////////////////////////////////////////// 14 TOI2GMap::TOI2GMap(PixelMap<r_8>* map,PixelMap<r_8>* wmap) 15 : mMap(map), mWMap(map), mWMapInternal(false) 16 16 { 17 17 SetEquinox(); … … 24 24 mIsColat = false; 25 25 26 if(mSph->NbPixels()<1) { 27 cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mSph " 28 <<mSph->NbPixels()<<endl; 29 throw ParmError("TOI2Map::TOI2Map() - Bad number of pixels in sphere"); 30 } 31 mSph->SetPixels(0.); 32 int nlat = mSph->SizeIndex(); 33 34 if(mWSph==NULL) { 35 mWSph = new SphereHEALPix<r_8>(nlat); 36 mWSphInternal = true; 26 if(mMap->NbPixels()<1) { 27 cout<<"TOI2GMap::TOI2GMap() Bad number of pixels in sphere mMap " 28 <<mMap->NbPixels()<<endl; 29 throw ParmError("TOI2GMap::TOI2GMap() - Bad number of pixels in sphere"); 30 } 31 mMap->SetPixels(0.); 32 int nlat = mMap->SizeIndex(); 33 34 if(mWMap==NULL) { 35 // We would need a cloning function in maps. $$TBD$$ $CHECK$ 36 string typmap = mMap->TypeOfMap(); 37 if (typmap == "LOCAL") { 38 mWMap = new LocalMap<r_8>(*(LocalMap<r_8>*)mMap); 39 } else if (typmap == "RING") { 40 mWMap = new SphereHEALPix<r_8>(nlat); 41 } else { 42 cout << "TOI2GMap::TOI2GMap() cannot handle map of type " << typmap << endl; 43 throw ParmError("TOI2GMap::TOI2GMap() - bad type of map"); 44 } 45 mWMapInternal = true; 37 46 } else { 38 mWSphInternal = false; 39 if(nlat != mWSph->SizeIndex()) mWSph->Resize(nlat); 40 } 41 if(mWSph->NbPixels()<1) { 42 cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mWSph " 43 <<mWSph->NbPixels()<<endl; 44 throw ParmError("TOI2Map::TOI2Map() - Bad number of pixels in sphere"); 45 } 46 mWSph->SetPixels(0); 47 48 } 49 50 TOI2Map::~TOI2Map() 51 { 52 if(mWSph && mWSphInternal) delete mWSph; 53 } 54 55 //////////////////////////////////////////////////////////////////////// 56 void TOI2Map::Print(::ostream & os) 57 { 58 os<<"TOI2Map::Print -- Sphere NLat = "<<mSph->SizeIndex()<<endl 47 mWMapInternal = false; 48 if(nlat != mWMap->SizeIndex()) { 49 cout << "TOI2GMap::TOI2GMap() Bad size for sphere mWMap, does not " 50 << "correspond to mMap : " << mMap->SizeIndex() << ", " << mWMap->SizeIndex() << endl; 51 throw ParmError("TOI2GMap::TOI2GMap() - Different sizes for map and wmap"); 52 } 53 } 54 if(mWMap->NbPixels()<1) { 55 cout<<"TOI2GMap::TOI2GMap() Bad number of pixels in sphere mWMap " 56 <<mWMap->NbPixels()<<endl; 57 throw ParmError("TOI2GMap::TOI2GMap() - Bad number of pixels in sphere"); 58 } 59 mWMap->SetPixels(0); 60 } 61 62 TOI2GMap::~TOI2GMap() 63 { 64 if(mWMap && mWMapInternal) delete mWMap; 65 } 66 67 //////////////////////////////////////////////////////////////////////// 68 void TOI2GMap::Print(::ostream & os) 69 { 70 os<<"TOI2GMap::Print -- Map type " << mMap->TypeOfMap() << " SizeIndex = "<<mMap->SizeIndex()<<endl 59 71 60 72 <<" - Equinoxe="<<mActualYear<<endl … … 78 90 79 91 //////////////////////////////////////////////////////////////////////// 80 void TOI2 Map::init() {81 cout << "TOI2 Map::init" << endl;92 void TOI2GMap::init() { 93 cout << "TOI2GMap::init" << endl; 82 94 declareInput("Coord1In"); // input index 0 83 95 declareInput("Coord2In"); // input index 1 … … 87 99 //////////////////////////////////////////////////////////////////////// 88 100 // define SANS_BUFFER 89 void TOI2 Map::run()101 void TOI2GMap::run() 90 102 { 91 103 long snb = getMinIn(); … … 93 105 94 106 if(snb>sne) { 95 cout<<"TOI2 Map::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;96 throw ParmError("TOI2 Map::run() - Bad sample interval");107 cout<<"TOI2GMap::run() - Bad sample interval"<<snb<<" , "<<sne<<endl; 108 throw ParmError("TOI2GMap::run() - Bad sample interval"); 97 109 } 98 110 if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) { 99 cout<<"TOI2 Map::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;100 throw ParmError("TOI2 Map::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");111 cout<<"TOI2GMap::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl; 112 throw ParmError("TOI2GMap::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!"); 101 113 } 102 114 if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) { 103 cout<<"TOI2 Map::run() - Input Coordinates not Eq or Gal! "<<endl;104 throw ParmError("TOI2 Map::run() - Input Coordinates not Eq or Gal!");115 cout<<"TOI2GMap::run() - Input Coordinates not Eq or Gal! "<<endl; 116 throw ParmError("TOI2GMap::run() - Input Coordinates not Eq or Gal!"); 105 117 } 106 118 if( !(mTypCoorOut&TypCoordEq || mTypCoorOut&TypCoordGal) ) { 107 cout<<"TOI2 Map::run() - Output Coordinates not Eq or Gal! "<<endl;108 throw ParmError("TOI2 Map::run() - Output Coordinates not Eq or Gal!");119 cout<<"TOI2GMap::run() - Output Coordinates not Eq or Gal! "<<endl; 120 throw ParmError("TOI2GMap::run() - Output Coordinates not Eq or Gal!"); 109 121 } 110 122 … … 118 130 double mjd = MJDfrYear(mActualYear); 119 131 120 cout<<"TOI2 Map::run() from "<<snb<<" to "<<sne;132 cout<<"TOI2GMap::run() from "<<snb<<" to "<<sne; 121 133 #ifndef SANS_BUFFER 122 134 int bufsz = 100; … … 189 201 if(theta<0. || theta>=M_PI) continue; 190 202 191 int_4 ipix = m Sph->PixIndexSph(theta,phi);192 (*m Sph)(ipix) += bolo;193 ((*mW Sph)(ipix)) += 1;203 int_4 ipix = mMap->PixIndexSph(theta,phi); 204 (*mMap)(ipix) += bolo; 205 ((*mWMap)(ipix)) += 1; 194 206 mNSnFill++; 195 207 } 196 208 197 cout<<"TOI2 Map::run(): Fin de boucle sur les sampleNum"<<endl;209 cout<<"TOI2GMap::run(): Fin de boucle sur les sampleNum"<<endl; 198 210 199 211 // Remplissage des spheres 200 for(int_4 i=0;i<m Sph->NbPixels();i++) {201 r_8 wf = (*mW Sph)(i);212 for(int_4 i=0;i<mMap->NbPixels();i++) { 213 r_8 wf = (*mWMap)(i); 202 214 if( wf > 0. ) { 203 215 mNpixFill++; 204 (*m Sph)(i) /= wf;216 (*mMap)(i) /= wf; 205 217 } 206 218 int_4 nf = int_4(wf); … … 208 220 } 209 221 210 cout<<"TOI2 Map::run(): mNpixTot="<<mSph->NbPixels()222 cout<<"TOI2GMap::run(): mNpixTot="<<mMap->NbPixels() 211 223 <<" mNpixFill="<<mNpixFill 212 224 <<" mNSnFill="<<mNSnFill<<endl 213 <<" --> FracSky="<<mNpixFill*100./(double)m Sph->NbPixels()<<"%"225 <<" --> FracSky="<<mNpixFill*100./(double)mMap->NbPixels()<<"%" 214 226 <<" NFill["<<NFILL<<"] ="<<endl; 215 227 for(ii=0;ii<NFILL;ii++) {cout<<NFill[ii]<<" "; if(ii%10==9) cout<<endl;} … … 223 235 //--------------------------------------------------------- 224 236 } catch (PException & exc) { 225 cout<<"TOI2 Map: Catched Exception "<<(string)typeid(exc).name()237 cout<<"TOI2GMap: Catched Exception "<<(string)typeid(exc).name() 226 238 <<"\n .... Msg= "<<exc.Msg()<<endl; 227 239 }
Note:
See TracChangeset
for help on using the changeset viewer.