Changeset 568 in Sophya
- Timestamp:
- Nov 10, 1999, 3:17:10 PM (26 years ago)
- Location:
- trunk/SophyaLib/Samba
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/bruit.cc
r517 r568 17 17 // Le code des classes NoiseGenerator RWalkNoise 18 18 19 20 /* --Methode-- */ 19 //++ 20 // Class NoiseGenerator 21 // 22 // include bruit.h math.h fmath.h nbrandom.h 23 // 24 //-- 25 //++ 26 // 27 // Links Childs 28 // 29 // RWalkNoise OOFNoise EXPNoise MemNoise SumNoise 30 // 31 //-- 32 //++ 33 // Titre Constructors 34 //-- 35 36 /* --Methode-- */ 37 //++ 21 38 NoiseGenerator::NoiseGenerator(float sigma) 39 // 40 //-- 22 41 { 23 42 if (sigma < 0.) sigma = 1.; … … 27 46 } 28 47 29 /* --Methode-- */ 48 //++ 49 // Titre Destructor 50 //-- 51 /* --Methode-- */ 52 //++ 30 53 NoiseGenerator::~NoiseGenerator() 54 // 55 //-- 31 56 { 32 57 //printf("-- NoiseGenerator::~NoiseGenerator() (Destructeur) --- \n"); 33 58 } 34 59 35 /* --Methode-- */ 60 61 //++ 62 // 63 // inline unsigned long int NoiseGenerator::NCoups() 64 //-- 65 //++ 66 // Titre Public Methods 67 //-- 68 69 /* --Methode-- */ 70 //++ 36 71 float NoiseGenerator::Noise() 72 // 73 //-- 37 74 { 38 75 mNCoups++; 39 76 return(NorRand()*mSigma); 40 77 } 41 42 /* --Methode-- */ 78 //++ 79 // Class RWalkNoise 80 // 81 // include bruit.h math.h fmath.h nbrandom.h 82 // 83 //-- 84 //++ 85 // 86 // Links Parents 87 // 88 // NoiseGenerator 89 // 90 //-- 91 //++ 92 // Titre Constructor 93 //-- 94 95 /* --Methode-- */ 96 //++ 43 97 RWalkNoise::RWalkNoise(float sigma) 44 98 : NoiseGenerator(sigma) 99 // 100 //-- 45 101 { 46 102 mState = 0.; … … 49 105 50 106 51 /* --Methode-- */ 107 //++ 108 // Titre Destructor 109 //-- 110 /* --Methode-- */ 111 //++ 52 112 RWalkNoise::~RWalkNoise() 113 // 114 //-- 53 115 { 54 116 //printf("-- RWalkNoise::~RWalkNoise (Destructeur) ---\n"); … … 56 118 } 57 119 58 /* --Methode-- */ 120 //++ 121 // Titre Public Methods 122 //-- 123 /* --Methode-- */ 124 //++ 59 125 float RWalkNoise::Noise() 126 // 127 //-- 60 128 { 61 129 mState += NoiseGenerator::Noise(); … … 63 131 } 64 132 65 66 /* --Methode-- */ 133 //++ 134 // Class OOFNoise 135 // 136 // include bruit.h math.h fmath.h nbrandom.h 137 // 138 //-- 139 //++ 140 // 141 // Links Parents 142 // 143 // NoiseGenerator 144 // 145 //-- 146 //++ 147 // Titre Constructor 148 //-- 149 150 /* --Methode-- */ 151 //++ 67 152 OOFNoise::OOFNoise(float sigma, int typacf, int mem, float tau) 68 153 : NoiseGenerator(sigma) 154 // 155 //-- 69 156 { 70 157 if (typacf != ACF_Exp) typacf = ACF_Exp; … … 89 176 90 177 91 /* --Methode-- */ 178 //++ 179 // Titre Destructor 180 //-- 181 /* --Methode-- */ 182 //++ 92 183 OOFNoise::~OOFNoise() 184 // 185 //-- 93 186 { 94 187 delete[] mState; … … 98 191 99 192 100 /* --Methode-- */ 193 //++ 194 // Titre Public Methods 195 //-- 196 /* --Methode-- */ 197 //++ 101 198 float OOFNoise::Noise() 199 // 200 //-- 102 201 { 103 202 int i; … … 112 211 113 212 /* --Methode-- */ 213 //++ 114 214 void OOFNoise::Print() 215 // 216 //-- 115 217 { 116 218 int i,j; … … 122 224 return; 123 225 } 124 125 /* --Methode-- */ 226 //++ 227 // Class EXPNoise 228 // 229 // include bruit.h math.h fmath.h nbrandom.h 230 // 231 //-- 232 //++ 233 // 234 // Links Parents 235 // 236 // NoiseGenerator 237 // 238 //-- 239 //++ 240 // Titre Constructor 241 //-- 242 243 /* --Methode-- */ 244 //++ 126 245 EXPNoise::EXPNoise(float sigma, int typacf, int mem, float tau) 127 246 : NoiseGenerator(sigma) 247 // 248 //-- 128 249 { 129 250 if (typacf != ACF_Exp) typacf = ACF_Exp; … … 146 267 147 268 148 /* --Methode-- */ 269 //++ 270 // Titre Destructor 271 //-- 272 /* --Methode-- */ 273 //++ 149 274 EXPNoise::~EXPNoise() 275 // 276 //-- 150 277 { 151 278 delete[] mState; … … 155 282 156 283 157 /* --Methode-- */ 284 //++ 285 // Titre Public Methods 286 //-- 287 /* --Methode-- */ 288 //++ 158 289 float EXPNoise::Noise() 290 // 291 //-- 159 292 { 160 293 int i; … … 169 302 170 303 /* --Methode-- */ 304 //++ 171 305 void EXPNoise::Print() 306 // 307 //-- 172 308 { 173 309 int i,j; … … 180 316 return; 181 317 } 182 /* --Methode-- */ 318 319 //++ 320 // Class MemNoise 321 // 322 // include bruit.h math.h fmath.h nbrandom.h 323 // 324 //-- 325 //++ 326 // 327 // Links Parents 328 // 329 // NoiseGenerator 330 // 331 //-- 332 //++ 333 // Titre Constructor 334 //-- 335 336 337 338 /* --Methode-- */ 339 //++ 183 340 MemNoise::MemNoise(float sigma, int mem, float tau, int ava) 184 341 : NoiseGenerator(sqrtf(fabsf(tau))*sigma) 342 // 343 //-- 185 344 { 186 345 /* on tire les instants des impulsions successives selon une … … 223 382 224 383 225 /* --Methode-- */ 384 //++ 385 // Titre Destructor 386 //-- 387 /* --Methode-- */ 388 //++ 226 389 MemNoise::~MemNoise() 390 // 391 //-- 227 392 { 228 393 delete[] mStPos; … … 233 398 } 234 399 235 /* --Methode-- */ 400 //++ 401 // Titre Public Methods 402 //-- 403 /* --Methode-- */ 404 //++ 236 405 float MemNoise::Noise() 406 // 407 //-- 237 408 { 238 409 return(Avance(0)); … … 240 411 241 412 /* --Methode-- */ 413 //++ 242 414 float MemNoise::Avance(long Asauter) 415 // 416 //-- 243 417 { 244 418 int i,j; … … 421 595 } 422 596 /* --Methode-- */ 423 597 //++ 424 598 int MemNoise::Print() 599 // 600 //-- 425 601 { 426 602 int i,j,rc=0; … … 436 612 437 613 614 //++ 615 // Class SumNoise 616 // Generateur de bruit blanc + 1/f avec fknee 617 // 618 // include bruit.h math.h fmath.h nbrandom.h 619 // 620 //-- 621 //++ 622 // 623 // Links Parents 624 // 625 // NoiseGenerator 626 // 627 //-- 628 //++ 629 // Titre Constructor 630 //-- 438 631 // Generateur de bruit blanc + 1/f avec fknee 439 632 440 633 441 634 /* --Methode-- */ 635 //++ 442 636 SumNoise::SumNoise(float fknee, float sig) 443 637 : NoiseGenerator(sig) 638 // 639 //-- 444 640 { 445 641 // Reza 27/01/98 : … … 449 645 450 646 451 /* --Methode-- */ 647 //++ 648 // Titre Destructor 649 //-- 650 /* --Methode-- */ 651 //++ 452 652 SumNoise::~SumNoise() 653 // 654 //-- 453 655 { 454 656 delete mn; 455 657 } 456 658 457 /* --Methode-- */ 659 //++ 660 // Titre Public Methods 661 //-- 662 /* --Methode-- */ 663 //++ 458 664 float SumNoise::Noise() 665 // 666 //-- 459 667 { 460 668 return(NoiseGenerator::Noise() + mn->Noise()); -
trunk/SophyaLib/Samba/circle.cc
r470 r568 1 1 #include <math.h> 2 2 #include "circle.h" 3 3 //++ 4 // Class Circle 5 // 6 // include circle.h math.h 7 //-- 8 //++ 9 // 10 // Links Parents 11 // 12 // Geometry 13 // 14 //-- 15 //++ 16 // Titre Constructors 17 //-- 18 //++ 4 19 Circle::Circle() 20 // 21 //-- 5 22 { 6 23 UnitVector temp; 7 24 SetCircle(temp,M_PI/2.); 8 25 } 9 26 //++ 10 27 Circle::Circle(double theta, double phi, double aperture) 28 // 29 //-- 11 30 { 12 31 UnitVector temp(theta,phi); 13 32 SetCircle(temp,aperture); 14 33 } 15 34 //++ 16 35 Circle::Circle(double x, double y, double z, double aperture) 36 // 37 //-- 17 38 { 18 39 UnitVector temp(x,y,z); 19 40 SetCircle(temp,aperture); 20 41 } 21 42 //++ 22 43 Circle::Circle(const Vector3d& v, double aperture) 44 // 45 //-- 23 46 { 24 47 UnitVector temp=v; 25 48 SetCircle(temp,aperture); 26 49 } 27 50 //++ 28 51 Circle::Circle(const Circle& c) 52 // 53 // copy constructor 54 //-- 29 55 { 30 56 UnitVector temp=c.Omega(); 31 57 SetCircle(temp,c._angouv); 32 58 } 33 59 //++ 60 // Titre Public Methods 61 //-- 62 //++ 34 63 void Circle::SetCircle(const UnitVector& temp, double aperture) 64 // 65 //-- 35 66 { 36 67 _spinunitaxis=temp; … … 43 74 _z=_spinunitaxis.Z(); 44 75 } 45 76 //++ 46 77 void Circle::SetSpinAxis(double theta, double phi) 78 // 79 //-- 47 80 { 48 81 UnitVector temp(theta,phi); 49 82 SetCircle(temp,_angouv); 50 83 } 51 84 //++ 52 85 void Circle::SetSpinAxis(const Vector3d& u) 86 // 87 //-- 53 88 { 54 89 UnitVector temp=u; 55 90 SetCircle(temp,_angouv); 56 91 } 57 92 //++ 58 93 void Circle::SetSpinAxis(double x, double y, double z) 94 // 95 //-- 59 96 { 60 97 UnitVector temp(x,y,z); 61 98 SetCircle(temp,_angouv); 62 99 } 63 100 //++ 64 101 void Circle::SetApertureAngle(double aperture) 102 // 103 //-- 65 104 { 66 105 SetCircle(_spinunitaxis,aperture); 67 106 } 68 107 //++ 69 108 void Circle::SetApertureAngle(const Circle& c) 109 // 110 //-- 70 111 { 71 112 SetCircle(_spinunitaxis,c._angouv); 72 113 } 73 114 //++ 74 115 bool Circle::Intersection(const Circle& c, double* psi) const 116 // 117 // psi contains 4 values of the intersection angles. 118 // -1 if circles do not intersect 119 // psi[0]=psi(i,j,0) 120 // psi[1]=psi(i,j,1) 121 // psi[2]=psi(j,i,0) 122 // psi[3]=psi(j,i,1) 123 //-- 75 124 { 76 125 double alphak=_angouv; … … 119 168 } 120 169 } 121 170 //++ 122 171 UnitVector Circle::ConvToSphere(double psi) const 172 // 173 // Return UnitVector corresponding to a given position donnee on the circle 174 //-- 123 175 { 124 176 psi=mod(psi,pi2); … … 137 189 return UnitVector(xout,yout,zout); 138 190 } 139 191 //++ 140 192 UnitVector Circle::TanOnCircle(double psi) const 193 // 194 // Return UnitVector corresponding to the tangent to the circle 195 // at given position on the circle. 196 //-- 141 197 { 142 198 psi=mod(psi,pi2); … … 153 209 return UnitVector(xout,yout,zout); 154 210 } 155 211 //++ 156 212 UnitVector Circle::EPhi(double psi) const 213 // 214 // Return the vector tangent to the sphere in the plane (xy) 215 // at a given position on the circle. 216 //-- 157 217 { 158 218 psi=mod(psi,pi2); 159 219 return ConvToSphere(psi).EPhi(); 160 220 } 161 221 //++ 162 222 UnitVector Circle::ETheta(double psi) const 223 // 224 // Return the other tangent vector( orthogonal to EPhi)-- 225 // see previous method 226 //-- 163 227 { 164 228 psi=mod(psi,pi2); 165 229 return ConvToSphere(psi).ETheta(); 166 230 } 167 231 //++ 168 232 double Circle::SepAngleTanEPhi02PI(double psi) const 233 // 234 // Return separation angle in [0,2Pi] at a given position on the 235 // circle and EPhi 236 //-- 169 237 { 170 238 psi=mod(psi,pi2); … … 175 243 return angle; 176 244 } 245 //++ 246 void Circle::Print(ostream& os) const 247 // 248 //-- 249 { 250 os << "1 - Circle - Axe de Spin Unitaire : " << _spinunitaxis << endl; 251 os << "1 - Circle - Axe de Spin : " << _spinaxis << endl; 252 os << "2 - Circle - Angle d'ouverture : " << _angouv << endl; 253 os << "3 - Circle - Theta,Phi : " << _theta << "," << _phi << endl; 254 os << "4 - Circle - x,y,z : " << _x << "," << _y << "," << _z << endl; 255 } 256 //++ 257 // 258 // inline double Theta() const 259 // inline double Phi() const 260 // inline double ApertureAngle() const 261 // inline Vector3d Omega() const 262 //-- 263 //++ 264 // Titre Operators 265 //-- 177 266 178 267 Circle& Circle::operator=(const Circle& c) … … 185 274 return *this; 186 275 } 187 276 //++ 188 277 bool Circle::operator==(const Circle& c) const 278 // 279 //-- 189 280 { 190 281 bool flag; … … 193 284 return flag; 194 285 } 195 286 //++ 196 287 bool Circle::operator!=(const Circle& c) const 288 // 289 //-- 197 290 { 198 291 return (bool)(1-(this->operator==(c))); 199 292 } 200 201 void Circle::Print(ostream& os) const202 {203 os << "1 - Circle - Axe de Spin Unitaire : " << _spinunitaxis << endl;204 os << "1 - Circle - Axe de Spin : " << _spinaxis << endl;205 os << "2 - Circle - Angle d'ouverture : " << _angouv << endl;206 os << "3 - Circle - Theta,Phi : " << _theta << "," << _phi << endl;207 os << "4 - Circle - x,y,z : " << _x << "," << _y << "," << _z << endl;208 } -
trunk/SophyaLib/Samba/circle.h
r470 r568 30 30 // psi contient les 4 valeurs des angles d intersection. -1 si les cercles ne se coupent pas 31 31 // voir la numerotation dans le .cc 32 /* psi contains 4 values of the intersection angles. 33 -1 if circles do not intersect 34 psi[0]=psi(i,j,0) 35 psi[1]=psi(i,j,1) 36 psi[2]=psi(j,i,0) 37 psi[3]=psi(j,i,1) 38 */ 32 39 bool Intersection(const Circle&, double* psi) const; 33 40 34 41 // donne le UnitVector correspondant a une position donnee sur le cercle 42 /*! Return UnitVector corresponding to a given position donnee on the circle 43 */ 35 44 UnitVector ConvToSphere(double psi) const; 36 45 37 46 // donne le UnitVector correspondant la tangente au cercle en une position donnee sur le cercle 47 /*! Return UnitVector corresponding to the tangent to the circle */ 48 // at given position on the circle. 38 49 UnitVector TanOnCircle(double psi) const; 39 50 40 51 // donne le vecteur tangent dans le plan (xy) a la sphere en une position donnee sur le cercle 52 /*! Return the vector tangent to the sphere in the plane (xy) 53 at a given position on the circle. 54 */ 41 55 UnitVector EPhi(double psi) const; 42 56 43 57 // donne l autre vecteur tangent (orthogonal a EPhi) 58 /*! Return the other tangent vector( orthogonal to EPhi)-- 59 see previous method 60 */ 44 61 UnitVector ETheta(double psi) const; 45 62 46 63 // donne l angle de separation dans [0,2Pi] en une position donnee sur le cercle et EPhi 64 /*! Return separation angle in [0,2Pi] at a given position on the 65 circle and EPhi 66 */ 47 67 double SepAngleTanEPhi02PI(double psi) const; 48 68 -
trunk/SophyaLib/Samba/lambuilder.cc
r518 r568 2 2 #include "lambuilder.h" 3 3 #include <iostream.h> 4 //++ 5 // Class Lambda2Builder 6 // 7 // (see separate documentation) 8 //-- 4 9 5 10 double Lambda2Builder::bignorm = 1.e268; // = 1e-20*1.d288 -
trunk/SophyaLib/Samba/localmap.cc
r518 r568 40 40 // pixel(nx/2, ny/2) 41 41 // 42 // la carte est consideree comme un tableau a deux indices i et j, i etant 43 // indice de colonne et j indice de ligne. La carte est supposee resider 44 // dans un plan tangent, dont le point de tangence est repere (x0,y0) dans 45 // la carte et (theta0, phi0) sur la sphere celeste. L'extension de la 46 // carte est definie par les valeurs de deux angles couverts respectivement 47 // par la totalite des pixels en x de la carte et la totalite des pixels 48 // en y. (SetSize()). 49 // On considere un "plan de reference" : plan tangent a la sphere celeste 50 // aux angles theta=Pi/2 et phi=0. Dans ce plan L'origine des coordonnees 51 // est le point de tangence. L'axe Ox est la tangente parallele a 52 // l'equateur, dirige vers les phi croissants, l'axe Oy est parallele 53 // au meridien, dirige vers le pole nord. 54 // De maniere interne a la classe une carte est definie dans ce plan de 55 // reference et transportee jusqu'au point (theta0, phi0) de sorte que 56 // les axes restent paralleles aux meridiens et paralleles. L'utilisateur 57 // peut definir sa carte selon un repere en rotation par rapport au repere 58 // de reference (par l'angle entre le parallele et l'axe Ox souhaite -- 59 // methode SetOrigin(...)) 42 // A local map is a 2 dimensional array, with i as column index and j 43 // as row index. The map is supposed to lie on a plan tangent to the 44 // celestial sphere in a point whose coordinates are (x0,y0) on the local 45 // map and (theta0, phi0) on the sphere. The range of the map is defined 46 // by two values of angles covered respectively by all the pixels in 47 // x direction and all the pixels in y direction (SetSize()). 48 // 49 // A "reference plane" is considered : this plane is tangent to the 50 // celestial sphere in a point with angles theta=Pi/2 and phi=0. This 51 // point is the origine of coordinates is of the reference plane. The 52 // x-axis is the tangent parallel to the equatorial line and oriented 53 // toward the increasing phi's ; the y-axis is parallel to the meridian 54 // line and oriented toward the north pole. 55 // 56 // Internally, a map is first defined within this reference plane and 57 // tranported until the point (theta0, phi0) in such a way that both 58 // axes are kept parallel to meridian and parallel lines of the sphere. 59 // The user can define its own map with axes rotated with respect to 60 // reference axes (this rotation is characterized by angle between 61 // the local parallel line and the wanted x-axis-- see method 62 // SetOrigin(...)) 63 // 64 // 60 65 61 66 // … … 70 75 //++ 71 76 // 72 // Links Descendants77 // Links Childs 73 78 // 74 79 // 75 80 //-- 76 81 //++ 77 // Titre Construct eurs82 // Titre Constructors 78 83 //-- 79 84 //++ … … 81 86 LocalMap<T>::LocalMap() 82 87 // 83 // Constructeur par defaut88 // 84 89 //-- 85 90 { … … 91 96 LocalMap<T>::LocalMap(int nx, int ny) : nSzX_(nx), nSzY_(ny) 92 97 // 93 // Constructeur98 // 94 99 //-- 95 100 { … … 104 109 LocalMap<T>::LocalMap(const LocalMap<T>& lm) 105 110 // 106 // Constructeur de recopie111 // copy constructor 107 112 //-- 108 113 { … … 130 135 131 136 //++ 137 // Titre Destructor 138 //-- 139 //++ 132 140 template<class T> 133 141 LocalMap<T>::~LocalMap() 134 142 // 135 // Destructeur136 143 //-- 137 144 { … … 139 146 } 140 147 141 //++ 142 template<class T> 143 void LocalMap<T>::InitNul() 144 // 145 // Initialise à zéro certaines variables internes 146 //-- 147 { 148 originFlag_= false; 149 extensFlag_= false; 150 cos_angle_= 1.0; 151 sin_angle_= 0.0; 152 pixels_.Reset(); 153 } 148 149 150 //++ 151 // Titre Public Methods 152 //-- 154 153 155 154 //++ … … 157 156 void LocalMap<T>::ReSize(int nx, int ny) 158 157 // 159 // Redimensionne l'espace de stokage des pixels158 // Resize storage area for pixels 160 159 //-- 161 160 { … … 169 168 170 169 //++ 171 // Titre Methodes172 //--173 174 175 //++176 170 template<class T> 177 171 int LocalMap<T>::NbPixels() const 178 172 // 179 // Ret ourne le nombre de pixels du découpage173 // Return number of pixels 180 174 //-- 181 175 { … … 187 181 T& LocalMap<T>::PixVal(int k) 188 182 // 189 // Ret ourne la valeur du contenu du pixel d'indicek183 // Return value of pixel with index k 190 184 //-- 191 185 { … … 205 199 T const& LocalMap<T>::PixVal(int k) const 206 200 // 207 // Retourne la valeur du contenu du pixel d'indice k201 // const version of previous method 208 202 //-- 209 203 { … … 220 214 //++ 221 215 template<class T> 222 bool LocalMap<T>::ContainsSph(double theta, double phi) const223 //--224 {225 return(true); // $CHECK$ A MODIFIER - Reza 26/10/99226 }227 228 //++229 template<class T>230 216 int LocalMap<T>::PixIndexSph(double theta,double phi) const 231 217 // 232 // Retourne l'indice du pixel vers lequel pointe une direction définie par 233 // ses coordonnées sphériques 218 // Return index of the pixel with spherical coordinates (theta,phi) 234 219 //-- 235 220 { … … 275 260 void LocalMap<T>::PixThetaPhi(int k,double& theta,double& phi) const 276 261 // 277 // Ret ourne les coordonnées (theta,phi) du milieu du pixel d'indicek262 // Return (theta, phi) coordinates of pixel with index k 278 263 //-- 279 264 { … … 302 287 double LocalMap<T>::PixSolAngle(int k) const 303 288 // 304 // Pixel Solid angle (steradians)305 // All the pixels have not necessarly the same size in (theta, phi)306 // because of the projection scheme which is not yet fixed.289 // Pixel Solid angle (steradians) 290 // All the pixels have not necessarly the same size in (theta, phi) 291 // because of the projection scheme which is not yet fixed. 307 292 //-- 308 293 { … … 339 324 void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle) 340 325 // 341 // Fixe la repere de reference ( angles en degres) 326 // set the referential of the map (angles in degrees) 327 // (default x0=siz_x/2, y0=siz_y/2) 342 328 //-- 343 329 { … … 357 343 void LocalMap<T>::SetOrigin(double theta0,double phi0,int x0,int y0,double angle) 358 344 // 359 // Fixe le repere de reference (angles en degres)345 // set the referential of the map (angles in degrees) 360 346 //-- 361 347 { … … 375 361 void LocalMap<T>::SetSize(double angleX,double angleY) 376 362 // 377 // Fixe l'extension de la carte (angles en degres)363 // angle range of tthe map (angles in degrees) 378 364 //-- 379 365 { … … 393 379 void LocalMap<T>::Project(SphericalMap<T>& sphere) const 394 380 // 395 // Projection tospherical map381 // Projection to a spherical map 396 382 //-- 397 383 { … … 404 390 } 405 391 } 392 // Titre Private Methods 393 //++ 394 template<class T> 395 void LocalMap<T>::InitNul() 396 // 397 // set some attributes to zero 398 //-- 399 { 400 originFlag_= false; 401 extensFlag_= false; 402 cos_angle_= 1.0; 403 sin_angle_= 0.0; 404 pixels_.Reset(); 405 } 406 406 407 407 //++ … … 409 409 void LocalMap<T>::Getij(int k,int& i,int& j) const 410 410 // 411 // Return 2 indices corresponding to the pixel number k 411 412 //-- 412 413 { … … 420 421 void LocalMap<T>::ReferenceToUser(double& theta,double& phi) const 421 422 // 422 // -- 423 // Transform a pair of coordinates (theta, phi) given in 424 // reference coordinates into map coordinates 425 //-- 423 426 { 424 427 if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi) … … 457 460 void LocalMap<T>::UserToReference(double& theta,double& phi) const 458 461 // 459 // -- 462 // Transform a pair of coordinates (theta, phi) given in 463 // map coordinates into reference coordinates 464 //-- 460 465 { 461 466 if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi) … … 498 503 void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const 499 504 // 500 // (x,y) representent les coordonnees en unites de pixels d'un point DANS LE PLAN DE REFERENCE. 501 // On recupere (theta,phi) par rapport au repere "absolu" theta=pi/2 et phi=0. 505 // 506 // Given coordinates in pixel units in the REFERENCE PLANE, return 507 // (theta, phi) in "absolute" referential theta=pi/2 ,phi=0. 502 508 //-- 503 509 { … … 511 517 void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const 512 518 // 513 // (theta,phi) par rapport au repere "absolu" theta=pi/2,phi=0. On recupere514 // (i,j) DANS LE PLAN DE REFERENCE.519 // Given coordinates (theta, phi) in "absolute" referential 520 // theta=pi/2 ,phi=0 return pixel indices (i,j) in the REFERENCE PLANE. 515 521 //-- 516 522 { … … 542 548 os << endl; 543 549 } 550 //++ 551 // Titre class FIO_LocalMap 552 // Delegated objects for persitance management 553 //-- 544 554 545 555 //******************************************************************* … … 548 558 //******************************************************************* 549 559 560 //++ 550 561 template <class T> 551 562 FIO_LocalMap<T>::FIO_LocalMap() 563 // 564 //-- 552 565 { 553 566 dobj= new LocalMap<T>; 554 567 ownobj= true; 555 568 } 556 569 //++ 557 570 template <class T> 558 571 FIO_LocalMap<T>::FIO_LocalMap(string const& filename) 572 // 573 //-- 559 574 { 560 575 dobj= new LocalMap<T>; … … 563 578 } 564 579 580 //++ 565 581 template <class T> 566 582 FIO_LocalMap<T>::FIO_LocalMap(const LocalMap<T>& obj) 583 // 584 //-- 567 585 { 568 586 dobj= new LocalMap<T>(obj); … … 577 595 } 578 596 597 //++ 579 598 template <class T> 580 599 FIO_LocalMap<T>::~FIO_LocalMap() 600 // 601 //-- 581 602 { 582 603 if (ownobj && dobj) delete dobj; 583 604 } 584 605 //++ 585 606 template <class T> 586 607 AnyDataObj* FIO_LocalMap<T>::DataObj() 608 // 609 //-- 587 610 { 588 611 return(dobj); 589 612 } 590 613 614 //++ 591 615 template <class T> 592 616 void FIO_LocalMap<T>::ReadSelf(PInPersist& is) 593 { 594 cout << " FIO_LocalMap:: ReadSelf " << endl; 617 // 618 //-- 619 { 595 620 596 621 if(dobj == NULL) … … 598 623 dobj= new LocalMap<T>; 599 624 } 600 601 // Let's Read the SphereCoordSys object -- ATTENTIOn - $CHECK$602 SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());603 dobj->SetCoordSys(cs);604 625 605 626 // Pour savoir s'il y avait un DVList Info associe … … 652 673 } 653 674 675 //++ 654 676 template <class T> 655 677 void FIO_LocalMap<T>::WriteSelf(POutPersist& os) const 656 { 657 cout << " FIO_LocalMap:: WriteSelf " << endl; 658 678 // 679 //-- 680 { 659 681 if(dobj == NULL) 660 682 { 661 cout << " WriteSelf:: dobj= null " << endl;683 cout << " FIO_LocalMap::WriteSelf:: dobj= null " << endl; 662 684 return; 663 685 } 664 686 665 // Let's write the SphereCoordSys object666 dobj->GetCoordSys()->Write(os);667 668 687 char strg[256]; 669 688 int nSzX= dobj->Size_x(); -
trunk/SophyaLib/Samba/localmap.h
r518 r568 10 10 #include "ppersist.h" 11 11 12 // A local map of a region of the sky, in cartesian coordinates. 13 // It has an origin in (theta0, phi0), mapped to pixel(x0, y0) 14 // (x0, y0 might be outside of this local map) 15 // default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2) 12 //! A local map of a region of the sky, in cartesian coordinates. 13 /*! A local map has an origin in (theta0, phi0), mapped to pixel(x0, y0) 14 (x0, y0 might be outside of this local map) 15 default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2) 16 A local map is a 2 dimensional array, with i as column index and j 17 as row index. The map is supposed to lie on a plan tangent to the 18 celestial sphere in a point whose coordinates are (x0,y0) on the local 19 map and (theta0, phi0) on the sphere. The range of the map is defined 20 by two values of angles covered respectively by all the pixels in 21 x direction and all the pixels in y direction (SetSize()). 22 23 A "reference plane" is considered : this plane is tangent to the 24 celestial sphere in a point with angles theta=Pi/2 and phi=0. This 25 point is the origine of coordinates is of the reference plane. The 26 x-axis is the tangent parallel to the equatorial line and oriented 27 toward the increasing phi's ; the y-axis is parallel to the meridian 28 line and oriented toward the north pole. 29 30 Internally, a map is first defined within this reference plane and 31 tranported until the point (theta0, phi0) in such a way that both 32 axes are kept parallel to meridian and parallel lines of the sphere. 33 The user can define its own map with axes rotated with respect to 34 reference axes (this rotation is characterized by angle between 35 the local parallel line and the wanted x-axis-- see method 36 SetOrigin(...)) 37 */ 16 38 // 17 39 // la carte est consideree comme un tableau a deux indices i et j, i etant … … 57 79 58 80 /* return/set the number of pixels */ 81 /*! Return number of pixels */ 59 82 virtual int NbPixels() const; 60 83 inline void setNbPixels(int n) {nPix_= n;} 61 84 62 85 /* return the value of pixel number k */ 86 /*! Return value of pixel with index k */ 63 87 virtual T& PixVal(int k); 88 /*! const version of previous method */ 64 89 virtual T const& PixVal(int k) const; 65 90 … … 67 92 virtual bool ContainsSph(double theta, double phi) const; 68 93 /* return the index of pixel at (theta,phi) */ 94 /*! Return index of the pixel with spherical coordinates (theta,phi) */ 69 95 virtual int PixIndexSph(double theta,double phi) const; 70 96 71 97 /* return the spherical coordinates of center of pixel number k */ 98 /*! Return (theta, phi) coordinates of pixel with index k */ 72 99 virtual void PixThetaPhi(int k,double& theta,double& phi) const; 73 100 74 101 /* return the Pixel Solid angle (steradians) */ 102 /*! Pixel Solid angle (steradians) 103 104 All the pixels have not necessarly the same size in (theta, phi) 105 because of the projection scheme which is not yet fixed. 106 */ 75 107 virtual double PixSolAngle(int k) const; 76 108 77 109 // ---------- Specific methods ------------------------------ 78 110 111 /*! Resize storage area for pixels */ 79 112 void ReSize(int nx, int ny); 80 113 … … 82 115 83 116 /* Origin (with angle between x axis and phi axis, in degrees) x0,y0 the default: middle of map*/ 117 /*! set the referential of the map (angles in degrees) 118 119 (default x0=siz_x/2, y0=siz_y/2) 120 */ 84 121 virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.); 122 /*! set the referential of the map (angles in degrees) */ 85 123 virtual void SetOrigin(double theta,double phi,int x0,int y0,double angle=0.); 86 124 87 125 /* Pixel size (degres) */ 126 /*! angle range of tthe map (angles in degrees) */ 88 127 virtual void SetSize(double angleX,double angleY); 89 128 … … 91 130 inline bool LocalMap_isDone() const {return(originFlag_ && extensFlag_);}; 92 131 93 /* Projection to/fromspherical map */132 /*! Projection to a spherical map */ 94 133 virtual void Project(SphericalMap<T>& sphere) const; 95 134 … … 120 159 121 160 void InitNul(); 161 /*! Return 2 indices corresponding to the pixel number k */ 122 162 void Getij(int k,int& i,int& j) const; 163 /*! Transform a pair of coordinates (theta, phi) given in 164 reference coordinates into map coordinates 165 */ 123 166 void ReferenceToUser(double& theta,double& phi) const; 167 /*! Transform a pair of coordinates (theta, phi) given in 168 map coordinates into reference coordinates 169 */ 124 170 void UserToReference(double& theta,double& phi) const; 171 /*! Given coordinates in pixel units in the REFERENCE PLANE, return 172 (theta, phi) in "absolute" referential theta=pi/2 ,phi=0. 173 */ 125 174 void PixProjToAngle(double x,double y,double& theta,double& phi) const; 175 /*! Given coordinates (theta, phi) in "absolute" referential 176 theta=pi/2 ,phi=0 return pixel indices (i,j) in the REFERENCE PLANE. 177 */ 126 178 void AngleProjToPix(double theta,double phi,double& x,double& y) const; 127 179 … … 148 200 149 201 // ------------- Classe pour la gestion de persistance -- 202 //! Delegated objects for persitance management 150 203 template <class T> 151 204 class FIO_LocalMap : public PPersist … … 161 214 virtual AnyDataObj* DataObj(); 162 215 inline operator LocalMap<T>() { return(*dobj); } 163 inline LocalMap<T> getObj() { return(*dobj); }216 //inline LocalMap<T> getObj() { return(*dobj); } 164 217 165 218 protected : -
trunk/SophyaLib/Samba/longlat.cc
r262 r568 1 1 #include "longlat.h" 2 2 //++ 3 // Class LongLat 4 // 5 // include longlat.h 6 // 7 // translation from coordinates (longitude, latitude) 8 // to theta,phi 9 // 10 // longitude=phi 11 // 12 // latitude=Pi/2-theta 13 // 14 //-- 15 //++ 16 // Titre Constructors 17 //-- 18 //++ 3 19 LongLat::LongLat() 20 // 21 //-- 4 22 { 5 23 _lon=0.; 6 24 _lat=0.; 7 25 } 8 26 //++ 9 27 LongLat::LongLat(double longitude, double latitude) 28 // 29 //-- 10 30 { 11 31 _lon=mod(longitude,pi2); … … 13 33 else _lat=mod(latitude+pi_over_2,M_PI)-pi_over_2; // dans [-Pi/2,Pi/2] 14 34 } 15 35 //++ 16 36 LongLat::LongLat(double x, double y, double z) 37 // 38 //-- 17 39 { 18 40 double norm=sqrt(x*x+y*y+z*z); … … 32 54 _lat=pi_over_2-theta; 33 55 } 34 56 //++ 57 // Titre Public Methods 58 //-- 59 //++ 35 60 void LongLat::Set(double longitude, double latitude) 61 // 62 //-- 36 63 { 37 64 _lon=mod(longitude,pi2); … … 39 66 else _lat=mod(latitude+pi_over_2,M_PI)-pi_over_2; // dans [-Pi/2,Pi/2] 40 67 } 41 68 //++ 42 69 void LongLat::Print(ostream& os) const 70 // 71 //-- 43 72 { 44 73 os << "LongLat : longitude = " << _lon << " phi = " << this->Phi() << endl; 45 74 os << "LongLat : latitude = " << _lat << " theta = " << this->Theta() << endl; 46 75 } 76 //++ 77 // 78 // double Longitude() const 79 // double Phi() const 80 // double Latitude() 81 // double Theta() const 82 //-- -
trunk/SophyaLib/Samba/mlobe.cc
r470 r568 4 4 #include "timing.h" 5 5 // #include "nbrandom.h" 6 7 /* --Methode-- */ 6 //++ 7 // Class MainLobe 8 // 9 // include mlobe.h sphericalmap.h unitvector.h math.h 10 // 11 // Class for computation of main lobe. 12 // 13 // The lobe values are computed in pixels laying on "nc" slices 14 // with hexagonal pavement around theta=0 , phi=0. The lobe is 15 // gaussian with sigma="sig". The slices are built every 16 // "dels"*sigma. 17 // 18 //-- 19 //++ 20 // Titre Constructor 21 //-- 22 /* --Methode-- */ 23 //++ 8 24 MainLobe::MainLobe(float sig, float dels, int nc) 25 // 26 //-- 9 27 { 10 28 if (sig < 1.e-9) sig = M_PI/100.; // Sigma du lobe gaussien (radians) … … 58 76 59 77 60 /* --Methode-- */ 78 //++ 79 // Titre Constructor 80 //-- 81 /* --Methode-- */ 82 //++ 61 83 MainLobe::~MainLobe() 84 // 85 //-- 62 86 { 63 87 delete mT0; … … 70 94 delete mVal; 71 95 } 72 73 /* --Methode-- */ 96 //++ 97 // Titre Public Methods 98 //-- 99 //++ 100 // 101 // inline int NPix() 102 // Return the total number of pixels of the lobe 103 // inline float Sigma() 104 // inline double Integral() 105 //-- 106 /* --Methode-- */ 107 //++ 74 108 void MainLobe::SetDirection(float teta, float phi) 109 // 110 // orientate the lobe toward the direction (theta, phi) 111 //-- 75 112 { 76 113 int k; … … 124 161 125 162 /* --Methode-- */ 163 //++ 126 164 double MainLobe::Value(int kpx, float& teta, float& phi) 165 // 166 // return the value of the lobe as also the (theta, phi) of the 167 // pixel "kpx" 168 //-- 127 169 { 128 170 if ( (kpx < 0) || (kpx >= mNpix) ) { teta = phi = 0.; return(0.); } … … 133 175 134 176 /* --Methode-- */ 177 //++ 135 178 double MainLobe::Convol(SphericalMap<double>& sph) 179 // 180 // return the value of the lobe convolved with the sky (sphere) "sph" 181 //-- 136 182 { 137 183 double ret=0.; … … 146 192 } 147 193 148 /* --Methode-- */ 194 //++ 195 // 196 // inline void Print() 197 //-- 198 199 //++ 200 // Titre Operators 201 //-- 202 203 /* --Methode-- */ 204 //++ 149 205 ostream& operator << (ostream& s, MainLobe const& lob) 206 // 207 //-- 150 208 { 151 209 s << "MainLobe_Info() : Sigma= " << lob.mSigma << " Dels= " << lob.mDels << " NC= " -
trunk/SophyaLib/Samba/pixelmap.h
r525 r568 8 8 #include <iostream.h> 9 9 10 // General map of pixels on part of sphere or whole sphere 11 // Class hierarchy : 12 // PixelMap 13 // SphericalMap 14 // SphereThetaPhi 15 // SphereGorski 16 // SphereIco 17 // LocalMap 18 10 //! General map of pixels on part of sphere or whole sphere 11 /*! Class hierarchy : 12 \verbatim 13 PixelMap 14 SphericalMap 15 SphereThetaPhi 16 SphereGorski 17 SphereIco 18 LocalMap 19 \endverbatim 20 */ 19 21 template<class T> 20 22 class PixelMap … … 33 35 inline SphereCoordSys* GetCoordSys() const { return(cs_); } 34 36 35 / / Number of pixels37 /*! Number of pixels */ 36 38 virtual int NbPixels() const=0; 37 39 38 / / Value of pixel number k40 /*! Value of pixel number k */ 39 41 virtual T& PixVal(int k)=0; 40 42 virtual T const& PixVal(int k) const=0; … … 44 46 virtual bool Contains(const SpherePosition& spos) const; 45 47 46 / / Index of pixel at (theta,phi)48 /*! Index of pixel at (theta,phi) */ 47 49 virtual int PixIndexSph(double theta, double phi) const=0; 48 50 // Index of pixel at a sky-position 49 51 virtual int PixIndex(const SpherePosition& spos); 50 52 51 52 // Value of pixel number at (theta,phi) 53 /*! Value of pixel number at (theta,phi) */ 53 54 virtual T& PixValSph(double theta, double phi) 54 55 {return PixVal(PixIndexSph(theta,phi));} … … 56 57 {return PixVal(PixIndexSph(theta,phi));} 57 58 58 / / Spherical coordinates of center of pixel number k59 /*! Spherical coordinates of center of pixel number k */ 59 60 virtual void PixThetaPhi(int k, double& theta, double& phi) const=0; 60 61 61 // provides a integer characterizing the pixelization refinement 62 // (depending of the type of the map) 62 /*! provides a integer characterizing the pixelization refinement 63 (depending of the type of the map) 64 */ 63 65 virtual int SizeIndex() const=0; 64 66 virtual char* TypeOfMap() const =0; 65 67 66 / / Pixel (steradians)68 /*! Pixel (steradians) */ 67 69 virtual double PixSolAngle(int k) const =0; 68 70 69 / / Overloading of () to access pixel number k.71 /*! Overloading of () to access pixel number k. */ 70 72 inline T& operator()(int k) {return(PixVal(k));} 71 73 inline T const& operator()(int k) const {return(PixVal(k));}
Note:
See TracChangeset
for help on using the changeset viewer.