Changeset 1217 in Sophya for trunk/SophyaLib


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

doc dans les .cc

Location:
trunk/SophyaLib/SkyMap
Files:
4 edited

Legend:

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

    r979 r1217  
    99
    1010
    11 //*****************************************************************************
    12 //++
    13 // Class        LocalMap
    14 //
    15 // include      localmap.h
    16 //
    17 //    A local map of a region of the sky, in cartesian coordinates.
    18 //    It has an origin in (theta0, phi0), mapped to pixel(x0, y0)
    19 //    (x0, y0 might be outside of this local map)
    20 //    default value of (x0, y0) is middle of the map, center of
    21 //    pixel(nx/2, ny/2)
    22 //
    23 //    A local map is a 2 dimensional array, with i as column index and j
    24 //    as row index. The map is supposed to lie on a plan tangent to the
    25 //    celestial sphere in a point whose coordinates are (x0,y0) on the local
    26 //    map and (theta0, phi0) on the sphere. The range of the map is defined
    27 //    by two values of angles covered respectively by all the pixels in
    28 //    x direction and all the pixels in y direction (SetSize()).
    29 //
    30 //    A "reference plane" is considered : this plane is tangent to the
    31 //    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
    32 //    point is the origine of coordinates is of the reference plane. The
    33 //    x-axis is the tangent parallel to the equatorial line and oriented
    34 //    toward the increasing phi's ; the y-axis is parallel to the meridian
    35 //    line and oriented toward the north pole.
    36 //   
    37 //    Internally, a map is first defined within this reference plane and
    38 //    tranported until the point (theta0, phi0) in such a way that both
    39 //    axes are kept parallel to meridian and parallel lines of the sphere.
    40 //    The user can define its own map with axes rotated with respect to
    41 //    reference axes (this rotation is characterized by angle between
    42 //    the local parallel line and the wanted x-axis-- see method
    43 //    SetOrigin(...))
    44 //   
    45 //
    46 
    47 //
    48 //--
    49 //++
    50 //
    51 // Links        Parents
    52 //
    53 //    PixelMap
    54 //   
    55 //--
    56 //++
    57 //
    58 // Links        Childs
    59 //
    60 //     
    61 //--
    62 //++
    63 // Titre        Constructors
    64 //--
    65 //++
     11/*!
     12  \class SOPHYA::LocalMap
     13
     14  A local map has an origin in (theta0, phi0), mapped to pixel(x0, y0)
     15   (x0, y0 might be outside of this local map)
     16 default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2)
     17    A local map is a 2 dimensional array, with i as column index and j
     18    as row index. The map is supposed to lie on a plan tangent to the
     19    celestial sphere in a point whose coordinates are (x0,y0) on the local
     20   map and (theta0, phi0) on the sphere. The range of the map is defined
     21    by two values of angles covered respectively by all the pixels in
     22    x direction and all the pixels in y direction (SetSize()).
     23
     24    A "reference plane" is considered : this plane is tangent to the
     25    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
     26    point is the origine of coordinates is of the reference plane. The
     27    x-axis is the tangent parallel to the equatorial line and oriented
     28    toward the increasing phi's ; the y-axis is parallel to the meridian
     29    line and oriented toward the north pole.
     30   
     31    Internally, a map is first defined within this reference plane and
     32    tranported until the point (theta0, phi0) in such a way that both
     33    axes are kept parallel to meridian and parallel lines of the sphere.
     34    The user can define its own map with axes rotated with respect to
     35    reference axes (this rotation is characterized by angle between
     36    the local parallel line and the wanted x-axis-- see method
     37    SetOrigin(...))
     38*/
    6639template<class T>
    6740LocalMap<T>::LocalMap() :  pixels_()
    68 //
    69 //     
    70 //--
    7141{
    7242  InitNul();
    73   //  pixels_.Reset();
    74 }
    75 
    76 //++
     43}
     44
    7745template<class T>
    7846LocalMap<T>::LocalMap(int_4 nx, int_4 ny) : nSzX_(nx), nSzY_(ny)
    79 //
    80 //   
    81 //--
    8247{
    8348  InitNul();
     
    8752}
    8853
    89 //++
    9054template<class T>
    9155LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
    9256  : pixels_(lm.pixels_, share)
    93 
    94 //
    95 //    copy constructor
    96 //--
    9757{
    9858
     
    10161}
    10262
    103 //++
    10463template<class T>
    10564LocalMap<T>::LocalMap(const LocalMap<T>& lm)
    10665  : pixels_(lm.pixels_)
    10766
    108 //
    109 //    copy constructor
    110 //--
    11167{
    11268
     
    11571}
    11672
    117 //++
    118 // Titre        Destructor
    119 //--
    120 //++
    12173template<class T>
    12274LocalMap<T>::~LocalMap()
    123 //
    124 //--
    12575{
    12676  InitNul();
     
    12979
    13080
    131 //++
    132 // Titre        Public Methods
    133 //--
    134 
    135 //++
     81/*!  \fn void SOPHYA::LocalMap::ReSize(int_4 nx, int_4 ny)
     82
     83  Resize storage area for pixels
     84*/
    13685template<class T>
    13786void LocalMap<T>::ReSize(int_4 nx, int_4 ny)
    138 //
    139 //    Resize storage area for pixels
    140 //--
    14187{
    14288  InitNul();
     
    188134
    189135
    190 //++
     136/*! \fn int_4 SOPHYA::LocalMap::NbPixels() const
     137
     138   \return number of pixels
     139*/
    191140template<class T>
    192141int_4 LocalMap<T>::NbPixels() const
    193 //
    194 //    Return number of pixels
    195 //--
    196142{
    197143  return(nPix_);
    198144}
    199145
    200 //++
     146/*! \fn T& SOPHYA::LocalMap::PixVal(int_4 k)
     147
     148   \return value of pixel with index k
     149*/
    201150template<class T>
    202151T& LocalMap<T>::PixVal(int_4 k)
    203 //
    204 //    Return value of pixel with index k
    205 //--
    206152{
    207153  if((k < 0) || (k >= nPix_))
    208154    {
    209155      cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
    210       //  THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    211156      THROW(rangeCheckErr);
    212       //throw "LocalMap::PIxVal Pixel index out of range";
    213157    }
    214158  return(pixels_(k));
    215159}
    216160
    217 //++
    218 
     161/*! \fn T const& SOPHYA::LocalMap::PixVal(int_4 k) const
     162  const version of previous method
     163*/
    219164template<class T>
    220165T const& LocalMap<T>::PixVal(int_4 k) const
    221 //
    222 //   const version of previous method
    223 //--
    224166{
    225167  if((k < 0) || (k >= nPix_))
    226168    {
    227169      cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
    228       //    THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    229      
    230170      throw "LocalMap::PIxVal Pixel index out of range";
    231171    }
     
    233173}
    234174
     175/*! \fn bool SOPHYA::LocalMap::ContainsSph(double theta, double phi) const
     176
     177 \return true if teta,phi in map 
     178*/
    235179template<class T>
    236180bool LocalMap<T>::ContainsSph(double theta, double phi) const
     
    240184}
    241185
    242 //++
     186/*!  \fn int_4 SOPHYA::LocalMap::PixIndexSph(double theta,double phi) const
     187
     188  \return index of the pixel with spherical coordinates (theta,phi)
     189*/
    243190template<class T>
    244191int_4 LocalMap<T>::PixIndexSph(double theta,double phi) const
    245 //
    246 //    Return index of the pixel with spherical coordinates (theta,phi)
    247 //--
    248192{
    249193  int_4 i,j;
     
    284228}
    285229
    286 //++
     230/*! \fn void SOPHYA::LocalMap::PixThetaPhi(int_4 k,double& theta,double& phi) const
     231
     232   \return (theta, phi) coordinates of pixel with index k
     233*/
    287234template<class T>
    288235void LocalMap<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
    289 //
    290 //    Return (theta, phi) coordinates of pixel with index k
    291 //--
    292236{
    293237  if(!(originFlag_) || !(extensFlag_))
     
    311255}
    312256
     257/*! \fn T SOPHYA::LocalMap::SetPixels(T v)
     258
     259Set all pixels to value v
     260*/
    313261template <class T>
    314262T LocalMap<T>::SetPixels(T v)
     
    318266}
    319267 
    320 //++
     268/*! \fn double SOPHYA::LocalMap::PixSolAngle(int_4 k) const
     269
     270   Pixel Solid angle  (steradians)
     271
     272    All the pixels have not necessarly the same size in (theta, phi)
     273    because of the projection scheme which is not yet fixed.
     274*/ 
    321275template<class T>
    322276double LocalMap<T>::PixSolAngle(int_4 k) const
    323 //
    324 //    Pixel Solid angle  (steradians)
    325 //    All the pixels have not necessarly the same size in (theta, phi)
    326 //    because of the projection scheme which is not yet fixed.   
    327 //--
    328277{
    329278  int_4 i,j;
     
    355304}
    356305
    357 //++
     306/*! \fn void SOPHYA::LocalMap::SetOrigin(double theta0,double phi0,double angle)
     307
     308   set the referential of the map (angles in degrees)
     309
     310    (default x0=siz_x/2,  y0=siz_y/2)
     311*/
    358312template<class T>
    359313void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle)
    360 //
    361 //    set the referential of the map (angles in degrees)
    362 //    (default x0=siz_x/2,  y0=siz_y/2)
    363 //--
    364314{
    365315  theta0_= theta0;
     
    374324}
    375325 
    376 //++
     326/*!  \fn void SOPHYA::LocalMap::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
     327
     328  set the referential of the map (angles in degrees)
     329*/
    377330template<class T>
    378331void LocalMap<T>::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
    379 //
    380 //    set the referential of the map (angles in degrees)
    381 //--
    382332{
    383333  theta0_= theta0;
     
    392342}
    393343
    394 //++
     344/*! \fn void SOPHYA::LocalMap::SetSize(double angleX,double angleY)
     345
     346   angle range of tthe map (angles in degrees)
     347*/
    395348template<class T>
    396349void LocalMap<T>::SetSize(double angleX,double angleY)
    397 //
    398 //    angle range of tthe map (angles in degrees)
    399 //--
    400350{
    401351  angleX_= angleX;
     
    410360}
    411361
    412 //++
     362/*! \fn void SOPHYA::LocalMap::Project(SphericalMap<T>& sphere) const
     363
     364Projection to a spherical map
     365*/
    413366template<class T>
    414367void LocalMap<T>::Project(SphericalMap<T>& sphere) const
    415 //
    416 //    Projection to a spherical map   
    417 //--
    418368{
    419369  for(int m = 0; m < nPix_; m++)
     
    440390}
    441391
    442 //++
     392
     393/*!   \fn void SOPHYA::LocalMap::Getij(int_4 k,int_4& i,int_4& j) const
     394
     395 \return 2 indices corresponding to the pixel number k
     396*/
    443397template<class T>
    444398void LocalMap<T>::Getij(int_4 k,int_4& i,int_4& j) const
    445 //
    446 //    Return 2 indices corresponding to the pixel number k
    447 //--
    448399{
    449400  i= (k+1)%nSzX_-1;
     
    452403}
    453404
    454 //++
     405/*! \fn void  SOPHYA::LocalMap::ReferenceToUser(double& theta,double& phi) const
     406
     407   Transform a pair of coordinates (theta, phi) given in
     408    reference coordinates into map coordinates
     409*/
    455410template<class T>
    456411void  LocalMap<T>::ReferenceToUser(double& theta,double& phi) const
    457 //
    458 //    Transform a pair of coordinates (theta, phi) given in
    459 //    reference coordinates into map coordinates
    460 //--     
    461412{
    462413  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     
    491442}
    492443
    493 //++
     444/*!  \fn void  SOPHYA::LocalMap::UserToReference(double& theta,double& phi) const
     445
     446  Transform a pair of coordinates (theta, phi) given in
     447   map coordinates into reference coordinates
     448*/
    494449template<class T>
    495450void  LocalMap<T>::UserToReference(double& theta,double& phi) const
    496 //
    497 //    Transform a pair of coordinates (theta, phi) given in
    498 //    map coordinates into reference coordinates
    499 //--     
    500451{
    501452  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     
    534485}
    535486
    536 //++
     487/*! \fn void SOPHYA::LocalMap::PixProjToAngle(double x,double y,double& theta,double& phi) const
     488
     489  Given coordinates in pixel units in the REFERENCE PLANE, return
     490    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
     491*/
    537492template<class T>
    538493void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const
    539 //
    540 // 
    541 //    Given coordinates in pixel units in the REFERENCE PLANE, return
    542 //    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
    543 //--
    544494{
    545495  theta= Pi*0.5-atan(2.*y*tgAngleY_/(double)nSzY_);
     
    548498}
    549499
    550 //++
     500/*! \fn void SOPHYA::LocalMap::AngleProjToPix(double theta,double phi,double& x,double& y) const
     501
     502   Given coordinates  (theta, phi) in "absolute" referential
     503    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
     504*/
    551505template<class T>
    552506void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const
    553 //
    554 //    Given coordinates  (theta, phi) in "absolute" referential
    555 //    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
    556 //--
    557507{
    558508  if(phi >= Pi) phi-= DeuxPi;
  • trunk/SophyaLib/SkyMap/localmap.h

    r1163 r1217  
    1010#include "ppersist.h"
    1111
    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 */
    38 //
    39 //    la carte est consideree comme un tableau a deux indices i et j, i etant
    40 //    indice de colonne et j indice de ligne. La carte est supposee resider
    41 //    dans un plan tangent, dont le point de tangence est repere (x0,y0) dans
    42 //    la carte et (theta0, phi0) sur la sphere celeste. L extension de la
    43 //    carte est definie par les valeurs de deux angles couverts respectivement
    44 //    par la totalite des pixels en x de la carte et la totalite des pixels
    45 //    en y. (SetSize()).
    46 //    On considere un "plan de reference" : plan tangent a la sphere celeste
    47 //    aux angles theta=Pi/2 et phi=0. Dans ce plan L origine des coordonnees
    48 //    est le point de tangence. L axe Ox est la tangente parallele a
    49 //    lequateur, dirige vers les phi croissants, l axe Oy est parallele
    50 //    au meridien, dirige vers le pole nord.
    51 //    De maniere interne a la classe une carte est definie dans ce plan de
    52 //    reference et transportee  jusqu au point (theta0, phi0) de sorte que les //    axes restent paralleles aux meridiens et paralleles. L utilisateur peut
    53 //    definir sa carte selon un repere en rotation par rapport au repere de
    54 //    reference (par l angle entre le parallele et l axe Ox souhaite --
    55 //    methode SetOrigin(...))
    5612
    5713
     
    6117
    6218namespace SOPHYA {
     19
     20
     21/* Class LocalMap */
    6322
    6423
     
    7635
    7736inline virtual bool IsTemp(void) const { return pixels_.IsTemp();}
     37
    7838/*! Setting blockdata to temporary (see ndatablock documentation) */
    7939inline virtual void SetTemp(bool temp=false) const {pixels_.SetTemp(temp);};
     
    8949// ---------- Definition of PixelMap abstract methods -------
    9050
    91 /* return/set the number of pixels */
    92 /*!    Return number of pixels */
    9351virtual int_4 NbPixels() const;   // D.Y. int change en int_4 rationalisation Mac
    9452 
    95 /* return the value of pixel number k */
    96 /*!    Return value of pixel with index k */
    9753virtual T& PixVal(int_4 k);
    98 /*!   const version of previous method */
    9954virtual T const& PixVal(int_4 k) const;
    10055
    101 /* Return true if teta,phi in map  */
    10256virtual bool ContainsSph(double theta, double phi) const;
    103 /* return the index of pixel at (theta,phi) */
    104 /*!    Return index of the pixel with spherical coordinates (theta,phi) */
    10557virtual int_4 PixIndexSph(double theta,double phi) const;
    10658   
    107 /* return the spherical coordinates of center of pixel number k */
    108 /*!    Return (theta, phi) coordinates of pixel with index k */
    10959virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const;
    11060
    111 /*! Set all pixels to value v */
    11261virtual T SetPixels(T v);
    11362
    114 /* return the Pixel Solid angle  (steradians) */
    115 /*!    Pixel Solid angle  (steradians)
    116 
    117     All the pixels have not necessarly the same size in (theta, phi)
    118     because of the projection scheme which is not yet fixed.
    119 */ 
    12063virtual double PixSolAngle(int_4 k) const;
    12164
    12265// ---------- Specific methods ------------------------------
    12366
    124 /*!    Resize storage area for pixels */
    12567void ReSize(int_4 nx, int_4 ny);
    12668
    12769inline virtual char* TypeOfMap() const {return "LOCAL";};
    12870 
    129 /* Origin (with angle between x axis and phi axis, in degrees)  x0,y0  the default: middle of map*/
    130 /*!    set the referential of the map (angles in degrees)
    131 
    132     (default x0=siz_x/2,  y0=siz_y/2)
    133 */
    13471virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
    135 /*!    set the referential of the map (angles in degrees) */
    13672virtual void SetOrigin(double theta,double phi,int_4 x0,int_4 y0,double angle=0.);
    13773
    138 /* Pixel size (degres) */
    139 /*!    angle range of tthe map (angles in degrees) */
    14074virtual void SetSize(double angleX,double angleY);
    14175
    142 /* Check to see if the local mapping is done */
     76/*! Check to see if the local mapping is done */
    14377inline bool LocalMap_isDone() const {return(originFlag_ && extensFlag_);};
    14478
    145 /*! Projection to a spherical map */
    14679virtual void Project(SphericalMap<T>& sphere) const;
    14780 
     
    14982      -> static method, or separate class */
    15083 
    151 /* provides a integer characterizing the pixelization refinement  (here : number of pixels) */
     84/*! provides a integer characterizing the pixelization refinement  (here : number of pixels) */
    15285inline virtual int_4 SizeIndex() const {return(nPix_);}
    15386inline int_4 Size_x() const {return nSzX_;}
     
    180113
    181114void InitNul();
    182 /*!    Return 2 indices corresponding to the pixel number k */
    183115void Getij(int_4 k,int_4& i,int_4& j) const;
    184 /*!    Transform a pair of coordinates (theta, phi) given in
    185     reference coordinates into map coordinates
    186 */
    187116void ReferenceToUser(double& theta,double& phi) const;
    188 /*!    Transform a pair of coordinates (theta, phi) given in
    189    map coordinates into reference coordinates
    190 */
    191117void UserToReference(double& theta,double& phi) const;
    192 /*!   Given coordinates in pixel units in the REFERENCE PLANE, return
    193     (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
    194 */
    195118void PixProjToAngle(double x,double y,double& theta,double& phi) const;
    196 /*!    Given coordinates  (theta, phi) in "absolute" referential
    197     theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
    198 */
    199119void AngleProjToPix(double theta,double phi,double& x,double& y) const;
    200120
  • 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}
  • trunk/SophyaLib/SkyMap/spherehealpix.h

    r1196 r1217  
    1616// ***************** CLASSE SphereHEALPix *****************************
    1717
    18 //!  class SphereHEALPix
    19 /*!
    20    Pixelisation Gorski 
    21 
    22 
    23     -----------------------------------------------------------------------
    24      version 0.8.2  Aug97 TAC  Eric Hivon, Kris Gorski
    25     -----------------------------------------------------------------------
    26 
    27     the sphere is split in 12 diamond-faces containing nside**2 pixels each
    28 
    29     the numbering of the pixels (in the nested scheme) is similar to
    30     quad-cube
    31     In each face the first pixel is in the lowest corner of the diamond
    32 
    33     the faces are                    (x,y) coordinate on each face
    34 \verbatim
    35         .   .   .   .   <--- North Pole
    36        / \ / \ / \ / \                          ^        ^     
    37       . 0 . 1 . 2 . 3 . <--- z = 2/3             \      /
    38        \ / \ / \ / \ /                        y   \    /  x 
    39       4 . 5 . 6 . 7 . 4 <--- equator               \  /     
    40        / \ / \ / \ / \                              \/     
    41       . 8 . 9 .10 .11 . <--- z = -2/3              (0,0) : lowest corner
    42        \ / \ / \ / \ /     
    43         .   .   .   .   <--- South Pole
    44 \endverbatim
    45     phi:0               2Pi                                 
    46 
    47    in the ring scheme pixels are numbered along the parallels
    48    the first parallel is the one closest to the north pole and so on 
    49    on each parallel, pixels are numbered starting from the one closest
    50     to phi = 0
    51 
    52     nside MUST be a power of 2 (<= 8192)
    53 
    54 */
     18  /*! Class SphereHEALPix */
    5519
    5620
     
    8145
    8246SphereHEALPix();
    83 /*!   
    84   m is the "nside" of the Gorski algorithm
    85 
    86   The total number of pixels will be Npix =  12*nside**2
    87 
    88   nside MUST be a power of 2 (<= 8192)
    89 */
    9047SphereHEALPix(int_4 m);
    9148SphereHEALPix(const SphereHEALPix<T>& s, bool share);
    9249SphereHEALPix(const SphereHEALPix<T>& s);
    93 //!     Destructor
    9450virtual ~SphereHEALPix();
    9551
    96   // Temporaire?
    9752inline virtual bool   IsTemp(void) const {
    9853
     
    10156    return pixels_.IsTemp();
    10257}
    103 /*! Setting blockdata to temporary (see ndatablock documentation) */
     58
    10459inline virtual void SetTemp(bool temp=false) const
    10560  {
     
    11065// ------------------ Definition of PixelMap abstract methods
    11166
    112 /* Nombre de pixels du decoupage */
    113 /*!    Return number of  pixels of the  splitting */
    11467virtual int_4 NbPixels() const;
    11568
    116 /* Valeur du contenu du pixel d'indice "RING" k  */
    117 /*!    Return value of  pixel with "RING" index k */
    11869virtual T& PixVal(int_4 k);
    11970virtual T const& PixVal(int_4 k) const;
    12071
    121 /* Nombre de tranches en theta */
    122 /*!    Return number of slices in theta direction on the  sphere */
    12372uint_4 NbThetaSlices() const;
    124 /*!   For a theta-slice with index 'index', return :
    125 
    126    the corresponding "theta"
    127 
    128     a vector containing the phi's of the pixels of the slice
    129 
    130     a vector containing the corresponding values of pixels
    131 */
    13273virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const;
    133 /*!   For a theta-slice with index 'index', return :
    134 
    135    the corresponding "theta"
    136 
    137    the corresponding "phi" for first pixel of the slice
    138 
    139     a vector containing indices of the pixels of the slice
    140 
    141    (equally distributed in phi)
    142 
    143     a vector containing the corresponding values of pixels
    144 */
    14574virtual void GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const ;
    14675
    147 /* Return true if teta,phi in map  */
    14876virtual bool ContainsSph(double theta, double phi) const;
    149 /* Indice "RING" du pixel vers lequel pointe une direction definie par
    150 ses  coordonnees spheriques */                                   
    151 /*!  Return "RING" index of the pixel corresponding to direction (theta, phi).
    152  */
    15377virtual int_4 PixIndexSph(double theta,double phi) const;
    15478
    155 /* Coordonnees spheriques du milieu du pixel d'indice "RING" k   */
    15679virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const;
    15780
    158 /*! Set all pixels to value v */
    15981virtual T SetPixels(T v);
    16082
    161 /* Pixel Solid angle  (steradians) */
    162 /*!    Pixel Solid angle  (steradians)
     83/*! Pixel Solid angle  (steradians)
    16384
    16485    All the pixels have the same solid angle. The dummy argument is
     
    16687   fulfil this requirement.
    16788*/
    168 virtual double PixSolAngle(int_4 dummy=0) const;
     89inline virtual double PixSolAngle(int_4 dummy=0) const {return omeg_;}
    16990
    17091/*  Acces to the DataBlock  */
     
    17495// --------------- Specific methods
    17596
    176 /*!   
    177   m is the "nside" of the Gorski algorithm
    178 
    179   The total number of pixels will be Npix =  12*nside**2
    180 
    181   nside MUST be a power of 2 (<= 8192)
    182 */
    18397virtual void Resize(int_4 m);
    18498
    185 // pour l'instant le tableau est ordonne selon RING, uniquement
     99/*!
     100
     101\return type of storage of the map : RING or NESTED
     102
     103at the moment, always RING
     104*/
    186105inline virtual char* TypeOfMap() const {return "RING";};
    187106
    188107
    189 /* Valeur du contenu du pixel d'indice "NEST" k */
    190 /*!    Return value of  pixel with "NESTED" index k */
    191108virtual T& PixValNest(int_4 k);
    192 /*!    Return value of  pixel with "NESTED" index k */
    193109virtual T const& PixValNest(int_4 k) const;
    194110
    195 /* Indice "NEST" du pixel vers lequel pointe une direction definie par
    196 ses  coordonnees spheriques */                                   
    197 /*! Return "NESTED" index of the pixel corresponding to direction (theta, phi).
    198  */
    199111virtual int_4 PixIndexSphNest(double theta,double phi) const;
    200112
    201 /* Coordonnees spheriques du milieu du pixel d'indice "NEST" k       */
    202 /*!   Return (theta,phi) coordinates of middle of  pixel with "NESTED" index k
    203  */
    204113virtual void PixThetaPhiNest(int_4 k,double& theta,double& phi) const;
    205114
    206 /* algorithme de pixelisation */
    207115void Pixelize(int_4);
    208116
    209 /* convertit index nested en ring  */
    210 /*!    translation from NESTED index  into RING index */
    211117int_4 NestToRing(int_4) const;
    212118
    213 /* convertit index ring en nested" */
    214 /*!    translation from  RING index  into NESTED index */
    215119int_4 RingToNest(int_4) const;
    216120
    217121
    218 /* retourne la valeur du parametre Gorski */
     122/*! \return value of healpix nside */
    219123inline virtual int_4 SizeIndex() const {return(nSide_);}
    220124
    221 /* impression */
    222125void print(ostream& os) const;
    223126
     
    256159
    257160NDataBlock<T> pixels_;
    258 NDataBlock<int_4> sliceBeginIndex_;             // Rationalisation Mac.         D.Y.
     161NDataBlock<int_4> sliceBeginIndex_;         // Rationalisation Mac. D.Y.
    259162NDataBlock<int_4> sliceLenght_;
    260163
Note: See TracChangeset for help on using the changeset viewer.