Changeset 2290 in Sophya
- Timestamp:
- Dec 5, 2002, 4:43:18 PM (23 years ago)
- Location:
- trunk/SophyaLib/SkyMap
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/localmap.cc
r2198 r2290 12 12 /*! 13 13 \class SOPHYA::LocalMap 14 \ingroup SkyMap 14 15 A local map is a 2 dimensional matrix, with ny rows and nx columns. 15 The local map has a n origin in (theta0, phi0), mapped to pixel(x0, y0)16 default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2) 16 The local map has a spatial origin with spherical coordinates (theta0, phi0), mapped to pixel(x0, y0). Default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2). 17 17 18 Each pixel(ip, it) is defined by its "phi-like" index ip (column 18 19 index in the matrix) and its "theta-like" index it (row index in … … 20 21 system ; index it is associated with y-axis in the same map-coordinate system. 21 22 22 The map is supposed to lie on a plan tangent to the celestial sphere 23 at a point, with spherical coordinates (theta0, phi0), whose pixel 24 numbers are (x0,y0) in the local map. The aperture of the map is defined 25 by two values of angles, angleX and angleY, covered respectively by all 26 the pixels in x direction and all the pixels in y direction. 23 The map is supposed to lie in a plan tangent to the celestial sphere 24 at its origin, with spherical coordinates (theta0, phi0), whose pixel 25 numbers are (x0,y0) in the local map as indicated above. The aperture of the map is defined by two values of angles, angleX and angleY, covered respectively by all the pixels in x direction and all the pixels in y direction. 27 26 28 27 Each pixel has angleX/nx and angleY/ny, as angle extensions. So, in … … 35 34 (angles in radians) 36 35 37 The projection (method : ProjectionToSphere() ) of the map onto a36 The projection (method : ProjectionToSphere() ) of the map onto a 38 37 sphere is made by the following procedure : 39 38 40 39 the sphere is supposed to have radius=1. The map is 41 considered to be tangent to the sphere, ona point with (theta0, phi0)40 considered to be tangent to the sphere, at a point with (theta0, phi0) 42 41 spherical coodinates. A reference coordinate system (plane-coordinate 43 system) , is chosen inthe plane of the map with reference axes :44 45 x-axis : vector t engent to a parallel in(theta0, phi0) on the sphere42 system) , is chosen with respect to the plane of the map with reference axes : 43 44 x-axis : vector tangent to a parallel at (theta0, phi0) on the sphere 46 45 (components in "3-dim cartesian system : -sin(phi0) ; cos(phi0) ; 0) 47 46 … … 49 48 sin(theta0)*cos(phi0) ; sin(theta0*sin(phi0) ; cos(theta0) 50 49 51 y-axis = z-axis^x-axis : tangent to the meridian at (theta0, phi0) 50 y-axis : z-axis^x-axis : tangent to the meridian at (theta0, phi0) 51 52 52 53 53 note that the map-coordinate system may be rotated with respect to … … 58 58 his coordinates in the plane-coordinate system (computed from x,y 59 59 above, with eventual rotation), with the sphere. 60 61 In order to make an instance of this class available, the user must either use the standard constructor LocalMap() (as well as the "full" constructor LocalMap() ) or use the "partial" constructor LocalMap() followed by call to SetSize() and SetOrigin() (for fixing links between the map and the celestial sphere. 62 63 Example : 64 65 \verbatim 66 LocalMap<r_4> lcm(300, 600, 10.,20., 90.,0.); // full cstr. 67 \endverbatim 68 69 defining a local map 300X600 pixels, representing a sphere portion of angular apertures 10 degres x 20 degres, with map center located on the equator, is equivalent to : 70 71 \verbatim 72 LocalMap<r_4> lcm(300, 600); // partial cstr. 73 lcm.SetSize(10., 20.); 74 lcm.SetOrigin(90., 0.); 75 \endverbatim 76 77 as well as : 78 79 80 \verbatim 81 LocalMap<r_4> lcm(300, 600, 10.,20., 90.,0., 0, 0); // full cstr. 82 \endverbatim 83 84 (same map, but with origin of coordinates at pixel (0,0) instead of (150, 300) as it was implicit above) 85 86 is equivalent to : 87 88 \verbatim 89 LocalMap<r_4> lcm(300, 600); 90 lcm.SetSize(10., 20.); 91 lcm.SetOrigin(90., 0., 0,0); 92 \endverbatim 93 94 60 95 */ 61 96 template<class T> … … 66 101 67 102 //! partial constructor of the local map 68 /*! 103 /*! \fn void SOPHYA::LocalMap::LocalMap(int_4 nx, int_4 ny) 69 104 \param nx : number of pixels in x direction 70 105 \param ny : number of pixels in y direction 71 106 72 must be followed by call ing the methodsa setSize() and setOrigin() in order the object become usable107 must be followed by calls to the methods SetSize() and SetOrigin() in order the object become usable 73 108 74 109 */ 75 76 110 template<class T> 77 111 LocalMap<T>::LocalMap(int_4 nx, int_4 ny) … … 86 120 87 121 //! full constructor of the local map 88 /*! 122 /*! \fn void SOPHYA::LocalMap:::LocalMap(int_4 nx, int_4 ny, double angleX,double angleY, double theta0,double phi0,int_4 x0,int_4 y0,double angle) 89 123 \param nx : number of pixels in x direction 90 124 \param ny : number of pixels in y direction … … 93 127 \param theta0,phi0 : spherical coordinates of reference point at which 94 128 the map is considered to be tangent to the sphere 95 \param x0, y0 : coo dinates (in pixels) of the reference point just defined129 \param x0, y0 : coordinates (in pixels) of the reference point just defined 96 130 \param angle : angle (degrees) of the rotation between x-axis of 97 131 map-coordinate system) and the tangent to parallel on … … 111 145 } 112 146 147 // void SOPHYA::LocalMap::LocalMap(int_4 nx, int_4 ny, double angleX,double angleY, double theta0,double phi0, double angle) 113 148 114 149 //! standard constructor of the local map 115 /*! 150 /*! \fn void SOPHYA::LocalMap::LocalMap(int_4 nx, int_4 ny, double angleX,double angleY, double theta0,double phi0, double angle) 116 151 \param nx : number of pixels in x direction 117 152 \param ny : number of pixels in y direction … … 138 173 139 174 //! copy constructor 140 /*! 175 /*! \fn void SOPHYA::LocalMap::LocalMap(const LocalMap<T>& lm, bool share) 141 176 \param share : if true, share data. If false copy data 142 177 */ … … 151 186 152 187 //! copy constructor 153 /*! 188 /*! \fn void SOPHYA::LocalMap::LocalMap(const LocalMap<T>& lm) 154 189 \warning datas are \b SHARED with \b lm. 155 190 \sa TMatrix::TMatrix(const TMatrix<T>&) … … 165 200 } 166 201 202 //! destructor 203 /*! \fn void SOPHYA::LocalMap::~LocalMap() 204 205 */ 167 206 template<class T> 168 207 LocalMap<T>::~LocalMap() {;} … … 173 212 174 213 Resize storage area for pixels 214 \param nx 215 \param ny new pixel numbers 175 216 */ 176 217 template<class T> … … 385 426 \return (theta, phi) coordinates of pixel of map with indices (ip,it) corresponding to x and y directions 386 427 387 \param ip :phi-like index388 \param it :theta-like index428 \param ip phi-like index 429 \param it theta-like index 389 430 */ 390 431 … … 416 457 417 458 /*! \fn double SOPHYA::LocalMap::PixSolAngle(int_4 k) const 418 419 Pixel Solid angle (steradians) 420 421 All the pixels are considered to have the same size in (theta, phi). 459 Pixel Solid angle of pixel k (steradians). 460 For the moment, all the pixels are considered to have the same size in (theta, phi). So the parameter k is dummy. 422 461 423 462 */ … … 440 479 } 441 480 442 /*! \fn void SOPHYA::LocalMap::PixToSphereC(int_4 ip, int_4 it, double& XP, double& YP, double& ZP) 481 /*! \fn void SOPHYA::LocalMap::PixToSphereC(int_4 ip, int_4 it, double& XP, double& YP, double& ZP) const 443 482 444 483 projection of a pixel of map, onto the unity sphere ; result in cartesian coordinates. … … 469 508 470 509 /*! \fn void SOPHYA::LocalMap::SetOrigin(double theta0,double phi0,double angle) 471 472 510 set the referential of the map (angles in degrees) 473 511 474 (default x0=siz_x/2, y0=siz_y/2) 512 \param theta0 513 \param phi0 celestial coordinates attributed to center pixel: x0=siz_x/2, y0=siz_y/2 514 \param angle angle between map referential and plane-coordinate system (see class description) 475 515 */ 476 516 template<class T> … … 481 521 482 522 /*! \fn void SOPHYA::LocalMap::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle) 483 484 set the referential of the map (angles in degrees) 523 set the referential of the map (angles in degrees) 524 525 \param theta0 526 \param phi0 celestial coordinates attributed to center pixel: (x0,y0) 527 \param angle angle between map referential and plane-coordinate system (see class description) 528 485 529 */ 486 530 template<class T> … … 598 642 599 643 angle range of tthe map (angles in degrees) 644 \param angleX phi-like angle 645 \param angleX theta-like angle 600 646 */ 601 647 template<class T> … … 780 826 781 827 782 //! Fill a LocalMap with a constant value \b a 828 /*! \fn void SOPHYA::LocalMap::SetT(T a) 829 Fill a LocalMap with a constant value \b a 830 */ 783 831 template <class T> 784 832 LocalMap<T>& LocalMap<T>::SetT(T a) … … 790 838 } 791 839 792 /*! Add a constant value \b x to a LocalMap */ 840 /*! \fn void SOPHYA::LocalMap::Add(T a) 841 Add a constant value \b x to a LocalMap 842 */ 793 843 template <class T> 794 844 LocalMap<T>& LocalMap<T>::Add(T a) … … 800 850 } 801 851 802 /*! Substract a constant value \b a to a LocalMap */ 852 /*! \fn void SOPHYA::LocalMap::Sub(T a,bool fginv) 853 854 Substract a constant value \b a to a LocalMap 855 856 */ 803 857 template <class T> 804 858 LocalMap<T>& LocalMap<T>::Sub(T a,bool fginv) … … 810 864 } 811 865 812 /*! multiply a LocalMap by a constant value \b a */ 866 /*! \fn void SOPHYA::LocalMap::Mul(T a) 867 mutiply a LocalMap by a constant value \b a 868 */ 813 869 template <class T> 814 870 LocalMap<T>& LocalMap<T>::Mul(T a) … … 820 876 } 821 877 822 /*! divide a LocalMap by a constant value \b a */ 878 /*! \fn void SOPHYA::LocalMap::Div(T a) 879 divide a LocalMap by a constant value \b a 880 */ 823 881 template <class T> 824 882 LocalMap<T>& LocalMap<T>::Div(T a) … … 831 889 832 890 // >>>> Operations avec 2nd membre de type LocalMap 833 //! Add two LocalMap 834 891 /*! \fn void SOPHYA::LocalMap::AddElt(const LocalMap<T>& a) 892 Add two LocalMap 893 */ 835 894 template <class T> 836 895 LocalMap<T>& LocalMap<T>::AddElt(const LocalMap<T>& a) … … 844 903 } 845 904 846 //! Substract two LocalMap 905 /*! \fn void SOPHYA::LocalMap::SubElt(const LocalMap<T>& a) 906 Substract two LocalMap 907 */ 847 908 template <class T> 848 909 LocalMap<T>& LocalMap<T>::SubElt(const LocalMap<T>& a) … … 856 917 } 857 918 858 //! Multiply two LocalMap (elements by elements) 919 /*! \fn void SOPHYA::LocalMap::MulElt(const LocalMap<T>& a) 920 Multiply two LocalMap (elements by elements) 921 */ 859 922 template <class T> 860 923 LocalMap<T>& LocalMap<T>::MulElt(const LocalMap<T>& a) … … 869 932 } 870 933 871 //! Divide two LocalMaps (elements by elements) - No protection for divide by 0 934 /*! \fn void SOPHYA::LocalMap::DivElt(const LocalMap<T>& a) 935 Divide two LocalMaps (elements by elements) - No protection for divide by 0 936 */ 872 937 template <class T> 873 938 LocalMap<T>& LocalMap<T>::DivElt(const LocalMap<T>& a) -
trunk/SophyaLib/SkyMap/localmap.h
r2198 r2290 69 69 virtual T& PixVal(int_4 k); 70 70 virtual T const& PixVal(int_4 k) const; 71 71 //! if fg = true, will generate exceptions , when theta-phi out of range 72 72 inline void SetThrowExceptionWhenOutofMapFlag(bool fg = false) { exc_outofmap_ = fg; } 73 // true --> Genere des exceptions si theta-phi out of range , sinon, index a -1 73 74 //! true --> exceptions wil be active when theta-phi out of range 74 75 inline bool GetThrowExceptionWhenOutofMapFlag() { return exc_outofmap_; } 75 76 76 77 virtual bool ContainsSph(double theta, double phi) const; 78 //! return pixel number correspoinding to (theta,phi) 77 79 virtual int_4 PixIndexSph(double theta,double phi) const; 78 80 81 //! return (theta,phi) correspoinding to pixel number k 79 82 virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const; 80 83 84 //! set all pixel values equal to v 81 85 virtual T SetPixels(T v); 82 86 87 // return the solid angle covered by pixel k (steradians) 83 88 virtual double PixSolAngle(int_4 k) const; 84 89 … … 91 96 void SetSize(double angleX,double angleY); 92 97 93 94 inline virtual char* TypeOfMap() const {return "LOCAL";}; 98 /*! \fn TypeOfMap() 99 return the string "LOCAL" 100 */ 101 inline virtual string TypeOfMap() const {return string("LOCAL");}; 95 102 96 103 … … 152 159 inline LocalMap<T>& operator = (T a) {return SetT(a);} 153 160 154 // !Add \b x to all elements161 // Add \b x to all elements 155 162 virtual LocalMap<T>& Add(T a); 156 163 inline LocalMap<T>& operator += (T x) { return Add(x); } 157 // !Substract \b x to all elements164 // Substract \b x to all elements 158 165 virtual LocalMap<T>& Sub(T a,bool fginv=false); 159 166 inline LocalMap<T>& operator -= (T x) { return Sub(x); } 160 // !Multiply all elements by \b x167 // Multiply all elements by \b x 161 168 virtual LocalMap<T>& Mul(T a); 162 169 inline LocalMap<T>& operator *= (T x) { return Mul(x); } 163 // !Divide all elements by \b x170 // Divide all elements by \b x 164 171 virtual LocalMap<T>& Div(T a); 165 172 inline LocalMap<T>& operator /= (T x) { return Div(x); } -
trunk/SophyaLib/SkyMap/pixelmap.h
r1419 r2290 70 70 */ 71 71 virtual int_4 SizeIndex() const=0; 72 virtual char*TypeOfMap() const =0;72 virtual string TypeOfMap() const =0; 73 73 74 74 /*! Pixel (steradians) */ -
trunk/SophyaLib/SkyMap/spherehealpix.cc
r1624 r2290 576 576 SphereHEALPix<T>& SphereHEALPix<T>::Add(T a) 577 577 { 578 cout << " c'est mon Add " << endl; 578 579 if (NbPixels() < 1) 579 580 throw RangeCheckError("SphereHEALPix<T>::Add(T ) - SphereHEALPix not dimensionned ! "); 580 pixels_ += a; 581 // pixels_ += a; 582 pixels_.Add(a); 581 583 return (*this); 582 584 } -
trunk/SophyaLib/SkyMap/spherehealpix.h
r1624 r2290 103 103 at the moment, always RING 104 104 */ 105 inline virtual char* TypeOfMap() const {return "RING";};105 inline virtual string TypeOfMap() const {return string("RING");}; 106 106 107 107 … … 147 147 //! Add \b x to all elements 148 148 virtual SphereHEALPix<T>& Add(T a); 149 inline SphereHEALPix<T>& operator += (T x) { return Add(x); }149 inline SphereHEALPix<T>& operator += (T x) { pixels_ += x; return *this; } 150 150 //! Substract \b x to all elements 151 151 virtual SphereHEALPix<T>& Sub(T a,bool fginv=false); 152 inline SphereHEALPix<T>& operator -= (T x) { return Sub(x); }152 inline SphereHEALPix<T>& operator -= (T x) { pixels_ -= x; return *this; } 153 153 //! Multiply all elements by \b x 154 154 virtual SphereHEALPix<T>& Mul(T a); 155 inline SphereHEALPix<T>& operator *= (T x) { return Mul(x); }155 inline SphereHEALPix<T>& operator *= (T x) {pixels_ *= x; return *this; } 156 156 //! Divide all elements by \b x 157 157 virtual SphereHEALPix<T>& Div(T a); 158 inline SphereHEALPix<T>& operator /= (T x) { return Div(x); }158 inline SphereHEALPix<T>& operator /= (T x) {pixels_ /= x; return *this; } 159 159 160 160 // A += -= (ajoute, soustrait element par element les deux spheres ) -
trunk/SophyaLib/SkyMap/spherethetaphi.h
r2198 r2290 110 110 virtual void Resize(int_4 m); 111 111 112 inline virtual char* TypeOfMap() const {return "TETAFI";};112 inline virtual string TypeOfMap() const {return string("TETAFI");}; 113 113 114 114 /* Valeurs de theta des paralleles et phi des meridiens limitant le pixel d'indice k */
Note:
See TracChangeset
for help on using the changeset viewer.