Commit c97f6e1010d6b7e9fb9ed04e09655a2b409a1211

Authored by Jürgen Knödlseder
2 parents 39a04852 b54b4645

Merge branch '1302-read-zenith-from-header' into integration

Conflicts:
	ChangeLog
	NEWS
ChangeLog
1   -2014-07-28 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2014-07-29 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Version 0.9.0 released
4 4 ========================
... ... @@ -11,6 +11,7 @@
11 11 Add GCTAExposure and GCTAMeanPsf classes
12 12 Add ts attribute to GModel and use it in GModelSky models
13 13 Add manipulation methods to GCTAResponseTable
  14 + Read/write altitude and azimuth attributes of CTA data
14 15 Refactor CTA response class, add GCTAResponseCube class
15 16 Improve CTA response computation for extended models
16 17 Implement CTA cube-style analysis
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 00-09-00
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -28 July 2014
  5 +29 July 2014
6 6  
7 7  
8 8 1. Introduction
... ... @@ -249,6 +249,11 @@ iterator depths, which leads to a uniform computation that increases log-likelih
249 249 profile smoothness. Also, known transition points have been added as internal
250 250 integration boundaries, improving the integral precision.
251 251  
  252 +The ALT_PNT and AZ_PNT attributes are now read from CTA data and used to set the
  253 +zenith and azimuth angles in the GCTAPointing structure. As well, the information
  254 +in GCTAPointing is now used to set the ALT_PNT and AZ_PNT attributes upon writing
  255 +a dataset.
  256 +
252 257  
253 258 21. COMPTEL interface
254 259 ---------------------
... ...
inst/cta/include/GCTAPointing.hpp
... ... @@ -78,6 +78,8 @@ public:
78 78 const GMatrix& rot(void) const;
79 79 const double& zenith(void) const;
80 80 const double& azimuth(void) const;
  81 + void zenith(const double& zenith);
  82 + void azimuth(const double& azimuth);
81 83 GHorizDir dir_horiz(const GTime& time) const;
82 84 void load(const std::string& filename,
83 85 const std::string& extname = "POINTING");
... ... @@ -143,4 +145,26 @@ const double&amp; GCTAPointing::azimuth(void) const
143 145 return m_azimuth;
144 146 }
145 147  
  148 +/***********************************************************************//**
  149 + * @brief assign zenith angle
  150 + *
  151 + * @param[in] zenith The zenith angle. (deg)
  152 + ***************************************************************************/
  153 +inline
  154 +void GCTAPointing::zenith(const double& zenith)
  155 +{
  156 + m_zenith = zenith;
  157 +}
  158 +
  159 +
  160 +/***********************************************************************//**
  161 + * @brief assign azimuth angle
  162 + *
  163 + * @param[in] azimuth The azimuth angle. (deg)
  164 + ***************************************************************************/
  165 +inline
  166 +void GCTAPointing::azimuth(const double& azimuth)
  167 +{
  168 + m_azimuth = azimuth;
  169 +}
146 170 #endif /* GCTAPOINTING_HPP */
... ...
inst/cta/pyext/GCTAPointing.i
... ... @@ -56,6 +56,8 @@ public:
56 56 const GMatrix& rot(void) const;
57 57 const double& zenith(void) const;
58 58 const double& azimuth(void) const;
  59 + void zenith(const double& zenith);
  60 + void azimuth(const double& azimuth);
59 61 GHorizDir dir_horiz(const GTime& time) const;
60 62 void load(const std::string& filename,
61 63 const std::string& extname = "POINTING");
... ...
inst/cta/src/GCTAObservation.cpp
... ... @@ -956,8 +956,8 @@ void GCTAObservation::read_attributes(const GFitsHDU&amp; hdu)
956 956 m_ra_obj = (hdu.has_card("RA_OBJ")) ? hdu.real("RA_OBJ") : 0.0;
957 957 m_dec_obj = (hdu.has_card("DEC_OBJ")) ? hdu.real("DEC_OBJ") : 0.0;
958 958 m_obs_id = (hdu.has_card("OBS_ID")) ? hdu.integer("OBS_ID") : 0;
959   - //double alt = (hdu.has_card("ALT_PNT")) ? hdu.real("ALT_PNT") : 0.0;
960   - //double az = (hdu.has_card("AZ_PNT")) ? hdu.real("AZ_PNT") : 0.0;
  959 + double alt = (hdu.has_card("ALT_PNT")) ? hdu.real("ALT_PNT") : 0.0;
  960 + double az = (hdu.has_card("AZ_PNT")) ? hdu.real("AZ_PNT") : 0.0;
961 961  
962 962 // Kluge: compute DEADC from livetime and ontime instead of using the
963 963 // keyword value as the original event lists had this values badly
... ... @@ -973,6 +973,8 @@ void GCTAObservation::read_attributes(const GFitsHDU&amp; hdu)
973 973 GSkyDir pnt;
974 974 pnt.radec_deg(ra_pnt, dec_pnt);
975 975 m_pointing.dir(pnt);
  976 + m_pointing.zenith(90.0-alt);
  977 + m_pointing.azimuth(az);
976 978  
977 979 // Return
978 980 return;
... ... @@ -992,6 +994,8 @@ void GCTAObservation::write_attributes(GFitsHDU&amp; hdu) const
992 994 // Compute some attributes
993 995 double ra_pnt = m_pointing.dir().ra_deg();
994 996 double dec_pnt = m_pointing.dir().dec_deg();
  997 + double alt = 90.0 - m_pointing.zenith();
  998 + double az = m_pointing.azimuth();
995 999 double tstart = events()->tstart().convert(timeref);
996 1000 double tstop = events()->tstop().convert(timeref);
997 1001 double telapse = events()->gti().telapse();
... ... @@ -1023,8 +1027,8 @@ void GCTAObservation::write_attributes(GFitsHDU&amp; hdu) const
1023 1027 hdu.card("DEC_OBJ", dec_obj(), "[deg] Target Declination");
1024 1028 hdu.card("RA_PNT", ra_pnt, "[deg] Pointing Right Ascension");
1025 1029 hdu.card("DEC_PNT", dec_pnt, "[deg] Pointing Declination");
1026   - hdu.card("ALT_PNT", 0.0, "[deg] Average altitude of pointing");
1027   - hdu.card("AZ_PNT", 0.0, "[deg] Average azimuth of pointing");
  1030 + hdu.card("ALT_PNT", alt, "[deg] Average altitude of pointing");
  1031 + hdu.card("AZ_PNT", az, "[deg] Average azimuth of pointing");
1028 1032 hdu.card("RADECSYS", "FK5", "Coordinate system");
1029 1033 hdu.card("EQUINOX", 2000.0, "Epoch");
1030 1034 hdu.card("CONV_DEP", 0.0, "Convergence depth of telescopes");
... ...