Ignore:
Timestamp:
Oct 3, 2000, 10:19:18 AM (25 years ago)
Author:
ansari
Message:

doc dans les .cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyMap/spherehealpix.cc

    r1196 r1217  
    1717using namespace SOPHYA;
    1818
    19 //*******************************************************************
    20 //++
    21 // Class        SphereHEALPix
    22 //
    23 // include      SphereHealpix.h strutil.h
    24 //
    25 //    Pixelisation Gorski 
    26 //
    27 //
    28 //|    -----------------------------------------------------------------------
    29 //|     version 0.8.2  Aug97 TAC  Eric Hivon, Kris Gorski
    30 //|    -----------------------------------------------------------------------
    31 //
    32 //    the sphere is split in 12 diamond-faces containing nside**2 pixels each
    33 //
    34 //    the numbering of the pixels (in the nested scheme) is similar to
    35 //    quad-cube
    36 //    In each face the first pixel is in the lowest corner of the diamond
    37 //
    38 //    the faces are                    (x,y) coordinate on each face
    39 //|        .   .   .   .   <--- North Pole
    40 //|       / \ / \ / \ / \                          ^        ^     
    41 //|      . 0 . 1 . 2 . 3 . <--- z = 2/3             \      /     
    42 //|       \ / \ / \ / \ /                        y   \    /  x   
    43 //|      4 . 5 . 6 . 7 . 4 <--- equator               \  /                     
    44 //|       / \ / \ / \ / \                              \/       
    45 //|      . 8 . 9 .10 .11 . <--- z = -2/3              (0,0) : lowest corner 
    46 //|       \ / \ / \ / \ /                                 
    47 //|        .   .   .   .   <--- South Pole
    48 //|
    49 //    phi:0               2Pi                                 
    50 //
    51 //    in the ring scheme pixels are numbered along the parallels
    52 //    the first parallel is the one closest to the north pole and so on
    53 //    on each parallel, pixels are numbered starting from the one closest
    54 //    to phi = 0
    55 //
    56 //    nside MUST be a power of 2 (<= 8192)
    57 //--
    58 //++
    59 //
    60 // Links        Parents
    61 //
    62 //    SphericalMap
    63 //--
     19/*!
     20  \class SOPHYA::SphereHEALPix
     21
     22*******************************************************************
     23   Pixelisation Gorski 
     24
     25\verbatim
     26
     27    -----------------------------------------------------------------------
     28     version 0.8.2  Aug97 TAC  Eric Hivon, Kris Gorski
     29    -----------------------------------------------------------------------
     30
     31    the sphere is split in 12 diamond-faces containing nside**2 pixels each
     32    the numbering of the pixels (in the nested scheme) is similar to
     33    quad-cube
     34    In each face the first pixel is in the lowest corner of the diamond
     35    the faces are                    (x,y) coordinate on each face
     36
     37        .   .   .   .   <--- North Pole
     38       / \ / \ / \ / \                          ^        ^     
     39      . 0 . 1 . 2 . 3 . <--- z = 2/3             \      /
     40       \ / \ / \ / \ /                        y   \    /  x 
     41      4 . 5 . 6 . 7 . 4 <--- equator               \  /     
     42       / \ / \ / \ / \                              \/     
     43      . 8 . 9 .10 .11 . <--- z = -2/3              (0,0) : lowest corner
     44       \ / \ / \ / \ /     
     45        .   .   .   .   <--- South Pole
     46\endverbatim
     47    phi:0               2Pi                                 
     48
     49   in the ring scheme pixels are numbered along the parallels
     50   the first parallel is the one closest to the north pole and so on 
     51   on each parallel, pixels are numbered starting from the one closest
     52    to phi = 0
     53
     54    nside MUST be a power of 2 (<= 8192)
     55
     56*/
    6457
    6558/* --Methode-- */
    66 //++
    67 // Titre        Constructors
    68 //--
    69 //++
    7059
    7160template<class T>
     
    7362                                                sliceLenght_()
    7463
    75 //--
     64
    7665{
    7766  InitNul();
    78   //  SetTemp(false);
    79 }
    80 
    81 //++
     67}
     68
     69/*! \fn   SOPHYA::SphereHEALPix::SphereHEALPix(int_4 m)
     70 
     71  \param <m> : "nside" of the Healpix algorithm
     72
     73  The total number of pixels will be Npix =  12*nside**2
     74
     75  nside MUST be a power of 2 (<= 8192)
     76*/
     77
    8278template<class T>
    8379SphereHEALPix<T>::SphereHEALPix(int_4 m)
    8480
    85 //    m is the "nside" of the Gorski algorithm
    86 //
    87 //    The total number of pixels will be Npix =  12*nside**2
    88 //
    89 //    nside MUST be a power of 2 (<= 8192)
    90 //--
    9181{
    9282
     
    202192//--
    203193
    204 //++
     194/*!  \fn   void SOPHYA::SphereHEALPix::Resize(int_4 m)
     195  \param <m>   "nside" of the Gorski algorithm
     196
     197  The total number of pixels will be Npix =  12*nside**2
     198
     199  nside MUST be a power of 2 (<= 8192)
     200*/
    205201template<class T>
    206202void SphereHEALPix<T>::Resize(int_4 m)
    207203
    208 //    m is the "nside" of the Gorski algorithm
    209 //
    210 //    The total number of pixels will be Npix =  12*nside**2
    211 //
    212 //    nside MUST be a power of 2 (<= 8192)
    213 //--
     204
    214205{
    215206  if (m<=0 || m> 8192) {
     
    270261
    271262/* --Methode-- */
    272 //++
     263/* Nombre de pixels du decoupage */
     264/*! \fn int_4 SOPHYA::SphereHEALPix::NbPixels() const
     265
     266   Return number of  pixels of the  splitting
     267*/
    273268template<class T>
    274269int_4 SphereHEALPix<T>::NbPixels() const
    275 
    276 //    Retourne le nombre de pixels du découpage
    277 //--
    278270
    279271  return(nPix_);
    280272}
    281273
    282 //++
     274
     275/*! \fn uint_4 SOPHYA::SphereHEALPix::NbThetaSlices() const
     276
     277   \return number of slices in theta direction on the  sphere
     278*/
    283279template<class T>
    284280uint_4 SphereHEALPix<T>::NbThetaSlices() const
    285 
    286 //    Return number of slices in theta direction on the  sphere
    287 //--
    288281{
    289282  uint_4 nbslices = uint_4(4*nSide_-1);
     
    296289}
    297290
    298 //++
     291/*!  \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
     292
     293 For a theta-slice with index 'index', return :
     294 
     295   the corresponding "theta"
     296
     297   a vector containing the phi's of the pixels of the slice
     298
     299   a vector containing the corresponding values of pixels
     300*/
    299301template<class T>
    300302void SphereHEALPix<T>::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
    301303
    302 //    For a theta-slice with index 'index', return :
    303 //
    304 //    the corresponding "theta"
    305 //
    306 //    a vector containing the phi's of the pixels of the slice
    307 //
    308 //    a vector containing the corresponding values of pixels
    309 //
    310 //--
    311304{
    312305
    313306  if (index<0 || index >= NbThetaSlices())
    314307    {
    315       // THROW(out_of_range("SphereHEALPix::PIxVal Pixel index out of range"));
    316308      cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl;
    317309      throw RangeCheckError(" SphereHEALPix::GetThetaSlice : Pixel index out of range");
     
    335327  theta= TH;
    336328}
    337 //++
    338 //++
     329/*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
     330
     331   For a theta-slice with index 'index', return :
     332
     333   the corresponding "theta"
     334
     335   the corresponding "phi" for first pixel of the slice
     336
     337    a vector containing indices of the pixels of the slice
     338
     339   (equally distributed in phi)
     340
     341    a vector containing the corresponding values of pixels
     342*/
    339343
    340344template<class T>
    341345void SphereHEALPix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
    342346
    343 //    For a theta-slice with index 'sliceIndex', return :
    344 //
    345 //    the corresponding "theta"
    346 //    the corresponding "phi" for first pixel of the slice
    347 //
    348 //    a vector containing the indices of the pixels of the slice
    349 //    (equally distributed in phi)
    350 //
    351 //    a vector containing the corresponding values of pixels
    352 //
    353 //--
    354347{
    355348
    356349  if (sliceIndex<0 || sliceIndex >= NbThetaSlices())
    357350    {
    358       // THROW(out_of_range("SphereHEALPix::PIxVal Pixel index out of range"));
    359351      cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl;
    360352      throw RangeCheckError(" SphereHEALPix::GetThetaSlice : Pixel index out of range");
     
    372364  PixThetaPhi(iring, theta, phi0);
    373365}
    374 //++
     366
    375367template<class T>
    376368void SphereHEALPix<T>::SetThetaSlices() 
    377 
    378 //--
    379369{
    380370  sliceBeginIndex_.ReSize(4*nSide_-1);
     
    399389}
    400390
    401 /* --Methode-- */
    402 //++
     391
     392/*! \fn T& SOPHYA::SphereHEALPix::PixVal(int_4 k)
     393
     394   \return value of  pixel with "RING" index k
     395*/
    403396template<class T>
    404397T& SphereHEALPix<T>::PixVal(int_4 k)
    405398
    406 //    Return value of  pixel with "RING" index k
    407 //--
    408399{
    409400  if((k < 0) || (k >= nPix_))
     
    414405}
    415406
    416 /* --Methode-- */
    417 //++
     407/*! \fn T const& SOPHYA::SphereHEALPix::PixVal(int_4 k) const
     408
     409   \return value of  pixel with "RING" index k
     410*/
    418411template<class T>
    419412T const& SphereHEALPix<T>::PixVal(int_4 k) const
    420413
    421 //    Return value of  pixel with "RING" index k
    422 //--
    423414{
    424415  if((k < 0) || (k >= nPix_))
     
    429420}
    430421
    431 //++
     422/*! \fn T& SOPHYA::SphereHEALPix::PixValNest(int_4 k)
     423
     424   \return value of  pixel with "NESTED" index k
     425*/
    432426template<class T>
    433427T& SphereHEALPix<T>::PixValNest(int_4 k)
    434428
    435 //    Return value of  pixel with "NESTED" index k
    436429//--
    437430{
     
    442435  return pixels_(nest2ring(nSide_,k));
    443436}
    444 //++
     437
     438/*!  \fn T const& SOPHYA::SphereHEALPix::PixValNest(int_4 k) const
     439
     440  \return value of  pixel with "NESTED" index k
     441*/
    445442
    446443template<class T>
    447444T const& SphereHEALPix<T>::PixValNest(int_4 k) const
    448445
    449 //    Return value of  pixel with "NESTED" index k
    450 //--
    451446{
    452447  if((k < 0) || (k >= nPix_))
     
    458453}
    459454
     455/*! \fn bool SOPHYA::SphereHEALPix::ContainsSph(double theta, double phi) const
     456
     457\return true if teta,phi in map
     458*/
     459template<class T>
     460bool SphereHEALPix<T>::ContainsSph(double theta, double phi) const
     461{
     462return(true);
     463}
     464
     465/*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSph(double theta,double phi) const
     466
     467 \return "RING" index of the pixel corresponding to direction (theta, phi).
     468 */
     469template<class T>
     470int_4 SphereHEALPix<T>::PixIndexSph(double theta,double phi) const
     471
     472{
     473  return ang2pix_ring(nSide_,theta,phi);
     474}
     475
     476/*! \fn int_4 SOPHYA::SphereHEALPix::PixIndexSphNest(double theta,double phi) const
     477
     478 \return "NESTED" index of the pixel corresponding to direction (theta, phi).
     479 */
     480template<class T>
     481int_4 SphereHEALPix<T>::PixIndexSphNest(double theta,double  phi) const
     482
     483{
     484  return ang2pix_nest(nSide_,theta,phi);
     485}
     486
     487
    460488/* --Methode-- */
    461 //++
    462 template<class T>
    463 bool SphereHEALPix<T>::ContainsSph(double /*theta*/, double /*phi*/) const
    464 //--
    465 {
    466 return(true);
    467 }
    468 
    469 /* --Methode-- */
    470 //++
    471 template<class T>
    472 int_4 SphereHEALPix<T>::PixIndexSph(double theta,double phi) const
    473 
    474 //    Return "RING" index of the pixel corresponding to
    475 //    direction (theta, phi).
    476 //--
    477 {
    478   return ang2pix_ring(nSide_,theta,phi);
    479 }
    480 
    481 //++
    482 template<class T>
    483 int_4 SphereHEALPix<T>::PixIndexSphNest(double theta,double  phi) const
    484 
    485 //    Return "NESTED" index of the pixel corresponding to
    486 //    direction (theta, phi).
    487 //--
    488 {
    489   return ang2pix_nest(nSide_,theta,phi);
    490 }
    491 
    492 
    493 /* --Methode-- */
    494 //++
     489/*! \fn void SOPHYA::SphereHEALPix::PixThetaPhi(int_4 k,double& theta,double& phi) const
     490 \return (theta,phi) coordinates of middle of  pixel with "RING" index k
     491 */
    495492template<class T>
    496493void SphereHEALPix<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
    497 
    498 //   Return (theta,phi) coordinates of middle of  pixel with "RING" index k
    499 //--
    500494{
    501495  pix2ang_ring(nSide_,k,theta,phi);
    502496}
    503497
     498/*! \fn T SOPHYA::SphereHEALPix::SetPixels(T v)
     499
     500Set all pixels to value v
     501*/
    504502template <class T>
    505503T SphereHEALPix<T>::SetPixels(T v)
     
    509507}
    510508
    511 //++
    512 template<class T>
    513 double SphereHEALPix<T>::PixSolAngle(int_4 /*dummy*/) const
    514 //    Pixel Solid angle  (steradians)
    515 //    All the pixels have the same solid angle. The dummy argument is
    516 //    for compatibility with eventual pixelizations which would not
    517 //    fulfil this requirement.
    518 //--
    519 {
    520   return omeg_;
    521 }
    522 
    523 //++
     509
     510
     511/*! \fn void SOPHYA::SphereHEALPix::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
     512
     513  \return (theta,phi) coordinates of middle of  pixel with "NESTED" index k
     514 */
    524515template<class T>
    525516void SphereHEALPix<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
    526517
    527 //   Return (theta,phi) coordinates of middle of  pixel with "NESTED" index k
    528 //--
    529518{   
    530519  pix2ang_nest(nSide_,k,theta,phi);
    531520}
    532521
    533 //++
     522
     523/*! \fn int_4 SOPHYA::SphereHEALPix::NestToRing(int_4 k) const
     524
     525   translation from NESTED index  into RING index
     526*/
    534527template<class T>
    535528int_4 SphereHEALPix<T>::NestToRing(int_4 k) const
    536529
    537 //    translation from NESTED index  into RING index
    538 //
    539 //--
    540530{
    541531  return  nest2ring(nSide_,k);
    542532}
    543533
    544 //++
     534
     535/*!  \fn  int_4 SOPHYA::SphereHEALPix::RingToNest(int_4 k) const
     536
     537 translation from  RING index  into NESTED index
     538*/
    545539template<class T>
    546540int_4 SphereHEALPix<T>::RingToNest(int_4 k) const
    547 //
    548 //    translation from  RING index  into NESTED index
    549 //
    550 //--
    551541{
    552542  return  ring2nest(nSide_,k);
     
    571561  os << endl;
    572562
    573   os << endl;
    574   //const PIXELS_XY& PXY= PIXELS_XY::instance();
    575 
    576   //os << endl;  os << " contenu des tableaux conversions "<<endl;
    577   //for(int i=0; i < 5; i++)
    578   //  {
    579   //   os<<PXY.pix2x_(i)<<", "<<PXY.pix2y_(i)<<", "<<PXY.x2pix_(i)<<", "<<PXY.y2pix_(i)<<endl;
    580   // }
    581   os << endl;
    582563
    583564}
Note: See TracChangeset for help on using the changeset viewer.