Changeset 2985 in Sophya
- Timestamp:
- Jun 21, 2006, 5:55:29 PM (19 years ago)
- Location:
- trunk/SophyaLib/SkyMap
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/HEALPixUtils.cc
r2973 r2985 707 707 return m; 708 708 } 709 710 //! return the pixel resolution for a given size index (nside) 711 double HEALPix::SizeIndexToResol(int_4 m) 712 { 713 double res = 4.*M_PI/(double)(12*m*m); 714 return sqrt(res); 715 } -
trunk/SophyaLib/SkyMap/HEALPixUtils.h
r2973 r2985 25 25 static inline int_4 ResolToNSide(double res) 26 26 { return ResolToSizeIndex(res); } 27 static double SizeIndexToResol(int_4 m); 28 static inline double NSideToResol(int_4 m) 29 { return SizeIndexToResol(m); } 27 30 }; 28 31 -
trunk/SophyaLib/SkyMap/sphereecp.h
r2978 r2985 26 26 static inline int_4 ResolToSizeIndex(double res) 27 27 { return (int_4)((M_PI/res)+0.5); } 28 //! return the pixel resolution (in radian) for the size index \b m 29 static inline double SizeIndexToResol(int_4 m) 30 { return (M_PI/(double)m); } 28 31 29 32 // Constructeur par defaut -
trunk/SophyaLib/SkyMap/spherehealpix.cc
r2978 r2985 178 178 omeg_ = a.omeg_; 179 179 int k; 180 if (fgring_ != a.fgring_)180 if (fgring_ == a.fgring_) 181 181 for (k=0; k< nPix_; k++) pixels_(k) = a.pixels_(k); 182 182 else { … … 359 359 value(kk)= pixels_(kk+iring); 360 360 } 361 PixThetaPhi(iring, theta, FI); 361 362 } 362 363 else { // NESTED pixelisation scheme … … 367 368 value(kk)= pixels_(kkn); 368 369 } 369 } 370 theta= TH; 370 PixThetaPhi(ring2nest(nSide_,iring), theta, FI); 371 } 372 // theta= TH; 371 373 } 372 374 /*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const … … 422 424 sliceBeginIndex_.ReSize(4*nSide_-1); 423 425 sliceLenght_.ReSize(4*nSide_-1); 424 int sliceIndex; 425 for (sliceIndex=0; sliceIndex< nSide_-1; sliceIndex++) 426 { 427 sliceBeginIndex_(sliceIndex) = 2*sliceIndex*(sliceIndex+1); 428 sliceLenght_(sliceIndex) = 4*(sliceIndex+1); 429 } 430 for (sliceIndex= nSide_-1; sliceIndex< 3*nSide_; sliceIndex++) 431 { 432 sliceBeginIndex_(sliceIndex) = 2*nSide_*(2*sliceIndex-nSide_+1); 433 sliceLenght_(sliceIndex) = 4*nSide_; 434 } 435 for (sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++) 436 { 437 int_4 nc= 4*nSide_-1-sliceIndex; 438 sliceBeginIndex_(sliceIndex) = nPix_-2*nc*(nc+1); 439 sliceLenght_(sliceIndex) = 4*nc; 440 } 426 int_4 sliceIndex; 427 int_4 offp = 0; 428 for (sliceIndex=0; sliceIndex< nSide_-1; sliceIndex++) { 429 // sliceBeginIndex_(sliceIndex) = 2*sliceIndex*(sliceIndex+1); 430 sliceBeginIndex_(sliceIndex) = offp; 431 sliceLenght_(sliceIndex) = 4*(sliceIndex+1); 432 offp += sliceLenght_(sliceIndex); 433 } 434 for (sliceIndex= nSide_-1; sliceIndex< 3*nSide_; sliceIndex++) { 435 // sliceBeginIndex_(sliceIndex) = 2*nSide_*(2*sliceIndex-nSide_+1); 436 sliceBeginIndex_(sliceIndex) = offp; 437 sliceLenght_(sliceIndex) = 4*nSide_; 438 offp += sliceLenght_(sliceIndex); 439 } 440 for (sliceIndex= 3*nSide_; sliceIndex< 4*nSide_-1; sliceIndex++) { 441 int_4 nc= 4*nSide_-1-sliceIndex; 442 // sliceBeginIndex_(sliceIndex) = nPix_-2*nc*(nc+1); 443 sliceBeginIndex_(sliceIndex) = offp; 444 sliceLenght_(sliceIndex) = 4*nc; 445 offp += sliceLenght_(sliceIndex); 446 } 441 447 } 442 448 … … 463 469 } 464 470 465 /*! \fn T& SOPHYA::SphereHEALPix::PixValNest(int_4 k)466 467 \return value of pixel with "NESTED" index k468 469 template<class T>470 T& SphereHEALPix<T>::PixValNest(int_4 k)471 472 //--473 {474 if((k < 0) || (k >= nPix_))475 {476 throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range");477 }478 return pixels_(nest2ring(nSide_,k));479 }480 */481 /*! \fn T const& SOPHYA::SphereHEALPix::PixValNest(int_4 k) const482 483 \return value of pixel with "NESTED" index k484 485 template<class T>486 T const& SphereHEALPix<T>::PixValNest(int_4 k) const487 488 {489 if((k < 0) || (k >= nPix_))490 {491 throw RangeCheckError("SphereHEALPix::PIxValNest Pixel index out of range");492 }493 int_4 pix= nest2ring(nSide_,k);494 return *(pixels_.Data()+pix);495 }496 */497 471 498 472 /*! \fn bool SOPHYA::SphereHEALPix::ContainsSph(double theta, double phi) const … … 518 492 } 519 493 520 /*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSphNest(double theta,double phi) const521 522 \return "NESTED" index of the pixel corresponding to direction (theta, phi).523 524 template<class T>525 int_4 SphereHEALPix<T>::PixIndexSphNest(double theta,double phi) const526 527 {528 return ang2pix_nest(nSide_,theta,phi);529 }530 */531 494 532 495 //! \return (theta,phi) coordinates of middle of pixel with "RING" index k … … 547 510 548 511 549 550 /*! \fn void SOPHYA::SphereHEALPix::PixThetaPhiNest(int_4 k,double& theta,double& phi) const551 552 \return (theta,phi) coordinates of middle of pixel with "NESTED" index k553 template<class T>554 void SphereHEALPix<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const555 556 {557 pix2ang_nest(nSide_,k,theta,phi);558 }559 */560 512 561 513 //! Conversion from NESTED index into RING index -
trunk/SophyaLib/SkyMap/spherehealpix.h
r2978 r2985 51 51 static inline int_4 ResolToNSide(double res) 52 52 { return HEALPix::ResolToSizeIndex(res); } 53 //! return the pixel resolution (in radian) for the size index (=nside) m 54 static inline double SizeIndexToResol(int_4 m) 55 { return HEALPix::SizeIndexToResol(m); } 56 //! return the pixel resolution (in radian) for the size index (=nside) m 57 static inline double NSideToResol(int_4 m) 58 { return HEALPix::SizeIndexToResol(m); } 53 59 54 60 SphereHEALPix(bool fgring=true); … … 113 119 inline bool IfNESTED() const { return ( (fgring_) ? false : true ); } 114 120 115 /*116 virtual T& PixValNest(int_4 k);117 virtual T const& PixValNest(int_4 k) const;118 virtual int_4 PixIndexSphNest(double theta,double phi) const;119 virtual void PixThetaPhiNest(int_4 k,double& theta,double& phi) const;120 */121 121 122 122 void Pixelize(int_4); -
trunk/SophyaLib/SkyMap/spherethetaphi.cc
r2973 r2985 631 631 632 632 if(index < 0 || index >= NbThetaSlices()) 633 throw RangeCheckError("SphereThetaPhi::GetThetaSlice( ) index out of range");633 throw RangeCheckError("SphereThetaPhi::GetThetaSlice(idx...) index out of range"); 634 634 635 635 … … 641 641 double Te= 0.; 642 642 double Fi= 0.; 643 for(int kk = 0; kk < lring; kk++) 644 { 645 PixThetaPhi(kk+iring,Te,Fi); 646 phi(kk)= Fi; 647 value(kk)= PixVal(kk+iring); 648 } 643 PixThetaPhi(iring,Te,Fi); 644 double DFi = DeuxPi/(double)NPhi(index); 645 for(int kk = 0; kk < lring; kk++) { 646 value(kk)= pixels_(kk+iring); 647 phi(kk)= Fi; 648 Fi += DFi; 649 } 649 650 theta= Te; 650 651 } … … 665 666 666 667 if(index < 0 || index >= NbThetaSlices()) 667 { 668 throw RangeCheckError("SphereThetaPhi::PIxVal Pixel index out of range"); 669 670 } 668 throw RangeCheckError("SphereThetaPhi::GetThetaSlice(idx...) idx out of range"); 671 669 672 670 int iring= Index(index,0); … … 677 675 double Te= 0.; 678 676 double Fi= 0.; 679 for(int kk = 0; kk < lring; kk++) 680 { 681 pixelIndices(kk)=kk+iring ; 682 value(kk)= PixVal(kk+iring); 683 } 684 PixThetaPhi(iring,theta,phi0); 677 for(int kk = 0; kk < lring; kk++) { 678 pixelIndices(kk)=kk+iring ; 679 value(kk)= pixels_(kk+iring); 680 } 681 PixThetaPhi(iring,theta,phi0); 685 682 } 686 683 … … 692 689 { 693 690 Show(os); 691 os << "SphereThetaPhi<T> NTheta_= " << NTheta_ << " NPix_ = " << NPix_ 692 << " Omega_ = " << Omega_ << endl; 694 693 if(this->mInfo_) os << " DVList Info= " << *(this->mInfo_) << endl; 695 // 696 os << " NTheta_= " << NTheta_ << endl; 697 os << " NPix_ = " << NPix_ << endl; 698 os << " Omega_ = " << Omega_ << endl; 699 700 os << " contenu de NPhi_ : "; 694 695 os << "... NPhi_ Values : "; 701 696 int i; 702 697 for(i=0; i < NTheta_; i++) … … 707 702 os << endl; 708 703 709 os << " contenu de Theta_: ";704 os << "... Theta_ Values : "; 710 705 for(i=0; i < NTheta_+1; i++) 711 706 { … … 715 710 os << endl; 716 711 717 os << " contenu de TNphi_: ";712 os << "... TNphi_ Values : "; 718 713 for(i=0; i < NTheta_+1; i++) 719 714 { … … 723 718 os << endl; 724 719 725 os << " contenu de pixels : ";720 os << "... Pixel Values : "; 726 721 for(i=0; i < NPix_; i++) 727 722 { -
trunk/SophyaLib/SkyMap/spherethetaphi.h
r2978 r2985 27 27 public : 28 28 29 //! return the size index value corresponding to resolution res (in radian)29 //! return the size index value corresponding to resolution \b res (in radian) 30 30 static inline int_4 ResolToSizeIndex(double res) 31 31 { return (int_4)((M_PI/2./res)+0.5); } 32 //! return the pixel resolution (in radian) for the size index \b m 33 static inline double SizeIndexToResol(int_4 m) 34 { return (M_PI/(2.*(double)m)); } 32 35 33 36 SphereThetaPhi();
Note:
See TracChangeset
for help on using the changeset viewer.