Commit 45bcd2e89c4dc39de3e917d95abe58febe582e78

Authored by Jürgen Knödlseder
1 parent 6ab0ca9e

Rename omega() methods to solidangle().

All methods returning a solid angle are now named solidangle().
... ... @@ -248,18 +248,21 @@ GWcs => GSkyProjection
248 248 been added that returns the dimension of the projection (1D or
249 249 2D). The integer index methods have been removed as GSkyPixel
250 250 now supports 1D and 2D pixels. The read() and write() methods
251   - now take a reference instead of a pointer.
  251 + now take a reference instead of a pointer. The omega() method
  252 + has been renamed to solidangle().
252 253  
253 254 GWcslib => GWcs
254 255 The GWcslib class has been renamed to GWcs. The class now conforms
255 256 to the GSkyProjection base class interface. The read() and write()
256   - methods now take a reference instead of a pointer.
  257 + methods now take a reference instead of a pointer. The omega()
  258 + method has been renamed to solidangle().
257 259  
258 260 GWcsHPX => GHealpix
259 261 The GWcsHPX class has been renamed to GHealpix as the Healpix
260 262 projection is not a World Coordinate System. GHealpix is no
261 263 longer registered in GWcsRegistry. The read() and write()
262   - methods now take a reference instead of a pointer.
  264 + methods now take a reference instead of a pointer. The
  265 + omega() method has been renamed to solidangle().
263 266  
264 267 GWcsRegistry
265 268 Now holds objects of renamed type GWcs (see GHealpix).
... ...
include/GHealpix.hpp
... ... @@ -66,7 +66,7 @@ public:
66 66 virtual std::string name(void) const;
67 67 virtual void read(const GFitsHDU& hdu);
68 68 virtual void write(GFitsHDU& hdu) const;
69   - virtual double omega(const GSkyPixel& pixel) const;
  69 + virtual double solidangle(const GSkyPixel& pixel) const;
70 70 virtual GSkyDir pix2dir(const GSkyPixel& pixel) const;
71 71 virtual GSkyPixel dir2pix(const GSkyDir& dir) const;
72 72 virtual std::string print(const GChatter& chatter = NORMAL) const;
... ... @@ -167,4 +167,21 @@ const int& GHealpix::nside(void) const
167 167 return m_nside;
168 168 }
169 169  
  170 +
  171 +/***********************************************************************//**
  172 + * @brief Returns solid angle of pixel
  173 + *
  174 + * @param[in] pixel Sky pixel.
  175 + * @return Solid angle of pixel.
  176 + *
  177 + * Returns the solid angle of the specified @p pixel. Note that HEALPix
  178 + * pixels have all the same solid angle, hence the @p pixel argument is in
  179 + * fact not used by the method.
  180 + ***************************************************************************/
  181 +inline
  182 +double GHealpix::solidangle(const GSkyPixel& pixel) const
  183 +{
  184 + return m_omega;
  185 +}
  186 +
170 187 #endif /* GHEALPIX_HPP */
... ...
include/GSkyProjection.hpp
... ... @@ -67,7 +67,7 @@ public:
67 67 virtual std::string name(void) const = 0;
68 68 virtual void read(const GFitsHDU& hdu) = 0;
69 69 virtual void write(GFitsHDU& hdu) const = 0;
70   - virtual double omega(const GSkyPixel& pixel) const = 0;
  70 + virtual double solidangle(const GSkyPixel& pixel) const = 0;
71 71 virtual GSkyDir pix2dir(const GSkyPixel& pixel) const = 0;
72 72 virtual GSkyPixel dir2pix(const GSkyDir& dir) const = 0;
73 73 virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
... ...
include/GSkymap.hpp
... ... @@ -119,8 +119,8 @@ public:
119 119 int pix2inx(const GSkyPixel& pixel) const;
120 120 int dir2inx(const GSkyDir& dir) const;
121 121 GSkyPixel dir2pix(const GSkyDir& dir) const;
122   - double omega(const int& index) const;
123   - double omega(const GSkyPixel& pixel) const;
  122 + double solidangle(const int& index) const;
  123 + double solidangle(const GSkyPixel& pixel) const;
124 124 bool contains(const GSkyDir& dir) const;
125 125 bool contains(const GSkyPixel& pixel) const;
126 126 const GSkyProjection* projection(void) const;
... ...
include/GWcs.hpp
... ... @@ -70,7 +70,7 @@ public:
70 70 virtual int size(void) const;
71 71 virtual void read(const GFitsHDU& hdu);
72 72 virtual void write(GFitsHDU& hdu) const;
73   - virtual double omega(const GSkyPixel& pixel) const;
  73 + virtual double solidangle(const GSkyPixel& pixel) const;
74 74 virtual GSkyDir pix2dir(const GSkyPixel& pixel) const;
75 75 virtual GSkyPixel dir2pix(const GSkyDir& dir) const;
76 76  
... ...
inst/com/src/GCOMEventCube.cpp
... ... @@ -709,7 +709,7 @@ void GCOMEventCube::set_scatter_directions(void)
709 709 for (int ix = 0; ix < nchi(); ++ix) {
710 710 GSkyPixel pixel = GSkyPixel(double(ix), double(iy));
711 711 m_dirs.push_back(m_map.pix2dir(pixel));
712   - m_omega.push_back(m_map.omega(pixel));
  712 + m_omega.push_back(m_map.solidangle(pixel));
713 713 }
714 714 }
715 715  
... ...
inst/cta/include/GCTAEventBin.hpp
... ... @@ -76,7 +76,7 @@ public:
76 76 virtual std::string print(const GChatter& chatter = NORMAL) const;
77 77  
78 78 // Other methods
79   - const double& omega(void) const;
  79 + const double& solidangle(void) const;
80 80 const GEnergy& ewidth(void) const;
81 81 const double& ontime(void) const;
82 82  
... ...
inst/cta/pyext/GCTAEventBin.i
1 1 /***************************************************************************
2   - * GCTAEventBin.i - CTA event bin class *
  2 + * GCTAEventBin.i - CTA event bin class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011-2012 by Juergen Knoedlseder *
  4 + * copyright (C) 2011-2013 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -20,7 +20,7 @@
20 20 ***************************************************************************/
21 21 /**
22 22 * @file GCTAEventBin.i
23   - * @brief CTA event bin class Python interface definition
  23 + * @brief CTA event bin class definition
24 24 * @author Juergen Knoedlseder
25 25 */
26 26 %{
... ... @@ -57,7 +57,7 @@ public:
57 57 virtual void counts(const double& counts);
58 58  
59 59 // Other methods
60   - const double& omega(void) const;
  60 + const double& solidangle(void) const;
61 61 const GEnergy& ewidth(void) const;
62 62 const double& ontime(void) const;
63 63 };
... ...
inst/cta/src/GCTAEventBin.cpp
... ... @@ -40,7 +40,7 @@
40 40 #define G_TIME "GCTAEventBin::time()"
41 41 #define G_COUNTS_GET "GCTAEventBin::counts()"
42 42 #define G_COUNTS_SET "GCTAEventBin::counts(double&)"
43   -#define G_OMEGA "GCTAEventBin::omega()"
  43 +#define G_SOLIDANGLE "GCTAEventBin::solidangle()"
44 44 #define G_EWIDTH "GCTAEventBin::ewidth()"
45 45 #define G_ONTIME "GCTAEventBin::ontime()"
46 46  
... ... @@ -186,7 +186,7 @@ GCTAEventBin* GCTAEventBin::clone(void) const
186 186 double GCTAEventBin::size(void) const
187 187 {
188 188 // Compute bin size
189   - double size = omega() * ewidth().MeV() * ontime();
  189 + double size = solidangle() * ewidth().MeV() * ontime();
190 190  
191 191 // Return bin size
192 192 return size;
... ... @@ -344,11 +344,11 @@ double GCTAEventBin::error(void) const
344 344 *
345 345 * Returns reference to the solid angle of the event bin.
346 346 ***************************************************************************/
347   -const double& GCTAEventBin::omega(void) const
  347 +const double& GCTAEventBin::solidangle(void) const
348 348 {
349 349 // Throw an exception if solid angle pointer is not valid
350 350 if (m_omega == NULL) {
351   - throw GCTAException::no_member(G_OMEGA,
  351 + throw GCTAException::no_member(G_SOLIDANGLE,
352 352 "Invalid solid angle pointer.");
353 353 }
354 354  
... ...
inst/cta/src/GCTAEventCube.cpp
... ... @@ -680,7 +680,7 @@ void GCTAEventCube::set_directions(void)
680 680 try {
681 681 GSkyPixel pixel = GSkyPixel(double(ix), double(iy));
682 682 m_dirs.push_back(GCTAInstDir(m_map.pix2dir(pixel)));
683   - m_omega.push_back(m_map.omega(pixel));
  683 + m_omega.push_back(m_map.solidangle(pixel));
684 684 }
685 685 catch (GException::wcs_invalid_x_y& e) {
686 686 m_dirs.push_back(GCTAInstDir());
... ...
inst/lat/src/GLATEventCube.cpp
... ... @@ -843,7 +843,7 @@ void GLATEventCube::set_directions(void)
843 843 for (int ix = 0; ix < nx(); ++ix) {
844 844 GSkyPixel pixel = GSkyPixel(double(ix), double(iy));
845 845 m_dirs.push_back(GLATInstDir(m_map.pix2dir(pixel)));
846   - m_omega.push_back(m_map.omega(pixel));
  846 + m_omega.push_back(m_map.solidangle(pixel));
847 847 }
848 848 }
849 849  
... ...
inst/lat/src/GLATMeanPsf.cpp
... ... @@ -735,16 +735,16 @@ void GLATMeanPsf::set_map_corrections(const GLATObservation&amp; obs)
735 735 for (int ix = 0; ix < cube->nx(); ++ix) {
736 736  
737 737 // Compute offset angle in degrees
738   - GSkyPixel pixel = GSkyPixel(double(ix), double(iy));
739   - double offset = cube->map().pix2dir(pixel).dist_deg(m_dir);
740   - double omega = cube->map().omega(pixel);
  738 + GSkyPixel pixel = GSkyPixel(double(ix), double(iy));
  739 + double offset = cube->map().pix2dir(pixel).dist_deg(m_dir);
  740 + double solidangle = cube->map().solidangle(pixel);
741 741  
742 742 // Use only pixels within maximum PSF radius
743 743 if (offset <= radius) {
744 744  
745 745 // Accumulate energy dependent pixel sum
746 746 for (int ieng = 0; ieng < m_energy.size(); ++ieng)
747   - sum[ieng] += psf(offset, m_energy[ieng]) * omega;
  747 + sum[ieng] += psf(offset, m_energy[ieng]) * solidangle;
748 748  
749 749 } // endif: pixel was within maximum PSF radius
750 750  
... ...
pyext/GHealpix.i
... ... @@ -52,7 +52,7 @@ public:
52 52 virtual std::string name(void) const;
53 53 virtual void read(const GFitsHDU& hdu);
54 54 virtual void write(GFitsHDU& hdu) const;
55   - virtual double omega(const GSkyPixel& pixel) const;
  55 + virtual double solidangle(const GSkyPixel& pixel) const;
56 56 virtual GSkyDir pix2dir(const GSkyPixel& pixel) const;
57 57 virtual GSkyPixel dir2pix(const GSkyDir& dir) const;
58 58  
... ...
pyext/GSkyProjection.i
... ... @@ -53,7 +53,7 @@ public:
53 53 virtual std::string name(void) const = 0;
54 54 virtual void read(const GFitsHDU& hdu) = 0;
55 55 virtual void write(GFitsHDU& hdu) const = 0;
56   - virtual double omega(const GSkyPixel& pixel) const = 0;
  56 + virtual double solidangle(const GSkyPixel& pixel) const = 0;
57 57 virtual GSkyDir pix2dir(const GSkyPixel& pixel) const = 0;
58 58 virtual GSkyPixel dir2pix(const GSkyDir& dir) const = 0;
59 59  
... ...
pyext/GSkymap.i
... ... @@ -140,8 +140,8 @@ public:
140 140 int pix2inx(const GSkyPixel& pixel) const;
141 141 int dir2inx(const GSkyDir& dir) const;
142 142 GSkyPixel dir2pix(const GSkyDir& dir) const;
143   - double omega(const int& index) const;
144   - double omega(const GSkyPixel& pixel) const;
  143 + double solidangle(const int& index) const;
  144 + double solidangle(const GSkyPixel& pixel) const;
145 145 bool contains(const GSkyDir& dir) const;
146 146 bool contains(const GSkyPixel& pixel) const;
147 147 const GSkyProjection* projection(void) const;
... ...
pyext/GWcs.i
... ... @@ -56,7 +56,7 @@ public:
56 56 virtual int size(void) const;
57 57 virtual void read(const GFitsHDU& hdu);
58 58 virtual void write(GFitsHDU& hdu) const;
59   - virtual double omega(const GSkyPixel& pixel) const;
  59 + virtual double solidangle(const GSkyPixel& pixel) const;
60 60 virtual GSkyDir pix2dir(const GSkyPixel& pixel) const;
61 61 virtual GSkyPixel dir2pix(const GSkyDir& dir) const;
62 62  
... ...
src/model/GModelSpatialDiffuseCube.cpp
... ... @@ -781,7 +781,7 @@ void GModelSpatialDiffuseCube::set_mc_cone(const GSkyDir&amp; centre,
781 781 // that corresponds to the pixel's solid angle. For security,
782 782 // the radius is enhanced by 50%.
783 783 double pixel_radius =
784   - std::acos(1.0 - m_cube.omega(k)/gammalib::twopi) *
  784 + std::acos(1.0 - m_cube.solidangle(k)/gammalib::twopi) *
785 785 gammalib::rad2deg * 1.5;
786 786  
787 787 // Add up flux with simulation cone radius + effective pixel
... ... @@ -793,7 +793,7 @@ void GModelSpatialDiffuseCube::set_mc_cone(const GSkyDir&amp; centre,
793 793 // simulated event is contained in the simulation cone.
794 794 double distance = centre.dist_deg(m_cube.pix2dir(k));
795 795 if (distance <= radius+pixel_radius) {
796   - double flux = m_cube(k,i) * m_cube.omega(k);
  796 + double flux = m_cube(k,i) * m_cube.solidangle(k);
797 797 if (flux > 0.0) {
798 798 total_flux += flux;
799 799 }
... ...
src/model/GModelSpatialDiffuseMap.cpp
... ... @@ -640,7 +640,7 @@ void GModelSpatialDiffuseMap::prepare_map(void)
640 640 // zero intensity in the skymap.
641 641 double sum = 0.0;
642 642 for (int i = 0; i < npix; ++i) {
643   - double flux = m_map(i) * m_map.omega(i);
  643 + double flux = m_map(i) * m_map.solidangle(i);
644 644 if (flux < 0.0) {
645 645 m_map(i) = 0.0;
646 646 flux = 0.0;
... ... @@ -665,7 +665,7 @@ void GModelSpatialDiffuseMap::prepare_map(void)
665 665 #if defined(G_DEBUG_PREPARE)
666 666 double sum_control = 0.0;
667 667 for (int i = 0; i < npix; ++i) {
668   - double flux = m_map(i) * m_map.omega(i);
  668 + double flux = m_map(i) * m_map.solidangle(i);
669 669 if (flux >= 0.0) {
670 670 sum_control += flux;
671 671 }
... ...
src/sky/GHealpix.cpp
... ... @@ -343,23 +343,6 @@ void GHealpix::write(GFitsHDU&amp; hdu) const
343 343  
344 344  
345 345 /***********************************************************************//**
346   - * @brief Returns solid angle of pixel
347   - *
348   - * @param[in] pixel Sky pixel.
349   - * @return Solid angle of pixel.
350   - *
351   - * Returns the solid angle of the specified @p pixel. Note that HEALPix
352   - * pixels have all the same solid angle, hence the @p pixel argument is in
353   - * fact not used by the method.
354   - ***************************************************************************/
355   -double GHealpix::omega(const GSkyPixel& pixel) const
356   -{
357   - // Return solid angle
358   - return m_omega;
359   -}
360   -
361   -
362   -/***********************************************************************//**
363 346 * @brief Returns sky direction of pixel
364 347 *
365 348 * @param[in] pixel Sky map pixel.
... ...
src/sky/GSkymap.cpp
... ... @@ -50,8 +50,8 @@
50 50 #define G_PIX2DIR "GSkymap::pix2dir(GSkyPixel&)"
51 51 #define G_DIR2INX "GSkymap::dir2inx(GSkyDir&)"
52 52 #define G_DIR2PIX "GSkymap::dir2pix(GSkyDir&)"
53   -#define G_OMEGA1 "GSkymap::omega(int&)"
54   -#define G_OMEGA2 "GSkymap::omega(GSkyPixel&)"
  53 +#define G_SOLIDANGLE1 "GSkymap::solidangle(int&)"
  54 +#define G_SOLIDANGLE2 "GSkymap::solidangle(GSkyPixel&)"
55 55 #define G_READ "GSkymap::read(const GFitsHDU&)"
56 56 #define G_SET_WCS "GSkymap::set_wcs(std::string&, std::string&, double&,"\
57 57 " double&, double&, double&, double&, double&,"\
... ... @@ -761,19 +761,19 @@ GSkyPixel GSkymap::dir2pix(const GSkyDir&amp; dir) const
761 761 *
762 762 * Returns the solid angle of the pixel with the specified @p index.
763 763 ***************************************************************************/
764   -double GSkymap::omega(const int& index) const
  764 +double GSkymap::solidangle(const int& index) const
765 765 {
766 766 // Throw error if WCS is not valid
767 767 if (m_proj == NULL) {
768 768 std::string msg = "Sky projection has not been defined.";
769   - throw GException::invalid_value(G_OMEGA1, msg);
  769 + throw GException::invalid_value(G_SOLIDANGLE1, msg);
770 770 }
771 771  
772 772 // Determine solid angle from pixel index.
773   - double omega = m_proj->omega(inx2pix(index));
  773 + double solidangle = m_proj->solidangle(inx2pix(index));
774 774  
775 775 // Return solid angle
776   - return omega;
  776 + return solidangle;
777 777 }
778 778  
779 779  
... ... @@ -788,27 +788,27 @@ double GSkymap::omega(const int&amp; index) const
788 788 *
789 789 * Returns the solid angle of the specified sky map @p pixel.
790 790 ***************************************************************************/
791   -double GSkymap::omega(const GSkyPixel& pixel) const
  791 +double GSkymap::solidangle(const GSkyPixel& pixel) const
792 792 {
793 793 // Throw error if WCS is not valid
794 794 if (m_proj == NULL) {
795 795 std::string msg = "Sky projection has not been defined.";
796   - throw GException::invalid_value(G_OMEGA2, msg);
  796 + throw GException::invalid_value(G_SOLIDANGLE2, msg);
797 797 }
798 798  
799 799 // Initialise solid angle
800   - double omega = 0.0;
  800 + double solidangle = 0.0;
801 801  
802 802 // If pixel size matches the projection size then perform a straight
803 803 // forward solid angle determination
804 804 if (m_proj->size() == pixel.size()) {
805   - omega = m_proj->omega(pixel);
  805 + solidangle = m_proj->solidangle(pixel);
806 806 }
807 807  
808 808 // ... otherwise, if we have a 2D projection but a 1D pixel then
809 809 // interpret the pixel as the linear index in the pixel array
810 810 else if (m_proj->size() == 2) {
811   - omega = m_proj->omega(GSkyPixel(inx2pix(int(pixel))));
  811 + solidangle = m_proj->solidangle(GSkyPixel(inx2pix(int(pixel))));
812 812 }
813 813  
814 814 // ... otherwise we have a 1D projection but a 2D pixel. There is
... ... @@ -819,11 +819,11 @@ double GSkymap::omega(const GSkyPixel&amp; pixel) const
819 819 " the 1-dimensional sky projection \""+
820 820 m_proj->name()+"\"\n"
821 821 "Please specify a 1-dimensional sky map pixel.";
822   - throw GException::invalid_argument(G_OMEGA2, msg);
  822 + throw GException::invalid_argument(G_SOLIDANGLE2, msg);
823 823 }
824 824  
825 825 // Return solid angle
826   - return omega;
  826 + return solidangle;
827 827 }
828 828  
829 829  
... ...
src/sky/GWcs.cpp
... ... @@ -37,7 +37,6 @@
37 37  
38 38 /* __ Method name definitions ____________________________________________ */
39 39 #define G_READ "GWcs::read(GFitsHDU&)"
40   -#define G_OMEGA "GWcs::omega(int&)"
41 40 #define G_PIX2DIR "GWcs::pix2dir(int&)"
42 41 #define G_DIR2PIX "GWcs::dir2pix(GSkyDir&)"
43 42 #define G_CRVAL "GWcs::crval(int&)"
... ... @@ -437,7 +436,7 @@ void GWcs::write(GFitsHDU&amp; hdu) const
437 436 * rotated sky maps. Something more intelligent should be implemented in
438 437 * the future.
439 438 ***************************************************************************/
440   -double GWcs::omega(const GSkyPixel& pixel) const
  439 +double GWcs::solidangle(const GSkyPixel& pixel) const
441 440 {
442 441 // Get the sky directions of the 6 points
443 442 GSkyDir dir1 = pix2dir(GSkyPixel(pixel.x()-0.5, pixel.y()-0.5));
... ...