Commit 46f161f25b9d918e2027e1a07d50f314245b255d
1 parent
810e8ce5
Fix computation of Earth vector and get time difference in TT timesystem
Showing
3 changed files
with
26 additions
and
13 deletions
NEWS
| 1 | 1 | New Features and Important Changes in GammaLib 2.0.0 |
| 2 | 2 | |
| 3 | -14 January 2022 | |
| 3 | +17 January 2022 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | 1. Introduction |
| ... | ... | @@ -53,6 +53,8 @@ The following methods have been added: |
| 53 | 53 | - GObservation::model_grad(GModel&, GModelPar&) |
| 54 | 54 | - GObservation::grad_step_size() |
| 55 | 55 | - GGti::reduce(GGti&) |
| 56 | +- GTime::leap_seconds() | |
| 57 | +- GTime::utc2tt() | |
| 56 | 58 | - GPhases::length() |
| 57 | 59 | - GMatrixBase::is_empty() |
| 58 | 60 | - angle(GVector&, GVector&) |
| ... | ... | @@ -280,7 +282,9 @@ of functions (#3328). |
| 280 | 282 | ---------------------- |
| 281 | 283 | Add GEphemerides class to deal with JPL ephemerides and specifically the |
| 282 | 284 | DE200 ephemerides. A JPL DE200 ephemerides file was added to a refdata |
| 283 | -direction, the file is installed in $GAMMALIB/share/refdata (#3973). | |
| 285 | +direction, the file is installed in $GAMMALIB/share/refdata. Add further- | |
| 286 | +more GTime::leap_seconds() and GTime::utc2tt() methods to support time | |
| 287 | +system conversions in GEphemerides and GPulsar classes (#3973). | |
| 284 | 288 | |
| 285 | 289 | Add GPhases::length() method that returns the total length of the phase |
| 286 | 290 | intervals (#3973). | ... | ... |
src/obs/GEphemerides.cpp
| ... | ... | @@ -266,6 +266,9 @@ void GEphemerides::load(const GFilename& filename) |
| 266 | 266 | * |
| 267 | 267 | * Get ephemeris vector and TBD-TT value for a given time. Information is |
| 268 | 268 | * only returned for pointers that are not NULL. |
| 269 | + * | |
| 270 | + * The code was inspired from the ftools routine xtereadeph.f and the COMPASS | |
| 271 | + * routine bvceph.f. | |
| 269 | 272 | ***************************************************************************/ |
| 270 | 273 | void GEphemerides::ephemeris(const GTime& time, |
| 271 | 274 | GVector* rce, |
| ... | ... | @@ -276,10 +279,16 @@ void GEphemerides::ephemeris(const GTime& time, |
| 276 | 279 | // Fetch ephemerides |
| 277 | 280 | const_cast<GEphemerides*>(this)->fetch_data(); |
| 278 | 281 | |
| 279 | - // Compute jd_utc as int and dt as day fraction, between -0.5 and 0.5 | |
| 282 | + // Compute jd_utc as int | |
| 280 | 283 | double jd = time.jd("UTC"); |
| 281 | 284 | int jd_utc = int(jd); |
| 282 | - double dt = jd - double(jd_utc); | |
| 285 | + | |
| 286 | + // Compute dt in TT as day fraction, between -0.5 and 0.5. While the | |
| 287 | + // time system in the xtereadeph.f routine is not specified, the | |
| 288 | + // bvceph.f routine explicitly adds the UTC->TT conversion coefficient | |
| 289 | + // to the delta | |
| 290 | + //double dt = jd - double(jd_utc); | |
| 291 | + double dt = time.jd("TT") - double(int(time.jd("TT"))); | |
| 283 | 292 | if (dt > 0.5) { |
| 284 | 293 | jd_utc += 1; |
| 285 | 294 | dt -= 1.0; |
| ... | ... | @@ -326,8 +335,8 @@ void GEphemerides::ephemeris(const GTime& time, |
| 326 | 335 | } |
| 327 | 336 | |
| 328 | 337 | // Get Sun vector |
| 329 | - if (rce != NULL) { | |
| 330 | - *rce = m_sun[index]; | |
| 338 | + if (rcs != NULL) { | |
| 339 | + *rcs = m_sun[index]; | |
| 331 | 340 | } |
| 332 | 341 | |
| 333 | 342 | // Get TBD-TT (seconds) |
| ... | ... | @@ -380,7 +389,7 @@ double GEphemerides::geo2ssb(const GTime& time, const GSkyDir& srcdir) const |
| 380 | 389 | // Special handling if sky direction is inside the Sun |
| 381 | 390 | /* |
| 382 | 391 | if (cth + 1.0 < 0.5 * sunsiz * sunsiz) { |
| 383 | - | |
| 392 | + | |
| 384 | 393 | } |
| 385 | 394 | */ |
| 386 | 395 | ... | ... |
src/obs/GPulsar.cpp
| ... | ... | @@ -435,7 +435,7 @@ void GPulsar::init_members(void) |
| 435 | 435 | // Initialise members |
| 436 | 436 | m_name.clear(); |
| 437 | 437 | m_ephemerides.clear(); |
| 438 | - | |
| 438 | + | |
| 439 | 439 | // Return |
| 440 | 440 | return; |
| 441 | 441 | } |
| ... | ... | @@ -785,7 +785,7 @@ void GPulsar::load_psrtime(const GFilename& filename, const std::string& name) |
| 785 | 785 | throw GException::invalid_argument(G_LOAD_PSRTIME, msg); |
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | - | |
| 788 | + | |
| 789 | 789 | // Save the pulsar name |
| 790 | 790 | psrname = psrb; |
| 791 | 791 | m_name = "PSR B" + psrb; |
| ... | ... | @@ -808,7 +808,7 @@ void GPulsar::load_psrtime(const GFilename& filename, const std::string& name) |
| 808 | 808 | double ra = (ra_h + ra_m/60.0 + ra_s/3600.0) * 15.0; |
| 809 | 809 | double dec = (dec_d < 0.0) ? -(-dec_d + dec_m/60.0 + dec_s/3600.0) |
| 810 | 810 | : (dec_d + dec_m/60.0 + dec_s/3600.0); |
| 811 | - | |
| 811 | + | |
| 812 | 812 | // Set sky direction |
| 813 | 813 | GSkyDir dir; |
| 814 | 814 | dir.radec_deg(ra, dec); |
| ... | ... | @@ -831,14 +831,14 @@ void GPulsar::load_psrtime(const GFilename& filename, const std::string& name) |
| 831 | 831 | toa.mjd(t0geo, "UTC"); |
| 832 | 832 | |
| 833 | 833 | // Compute phase of first pulse according to formulae given in |
| 834 | - // COM-RP-DOL-DRG-065.Note that the phase is negative, see for | |
| 834 | + // COM-RP-DOL-DRG-065. Note that the phase is negative, see for | |
| 835 | 835 | // example Eq. (3) in Yan et al. (2017), ApJ, 845, 119 |
| 836 | 836 | double geo2ssb = ephemerides.geo2ssb(toa, dir); |
| 837 | 837 | double utc2tt = toa.utc2tt(); |
| 838 | 838 | double dt = (t0geo - t0nom) * gammalib::sec_in_day + geo2ssb + utc2tt; |
| 839 | 839 | const double c1 = 1.0/2.0; |
| 840 | 840 | const double c2 = 1.0/6.0; |
| 841 | - double phase = -((f0 + (f1 * c1 + f2 * dt * c2) * dt) * dt); | |
| 841 | + double phase = ((f0 + (f1 * c1 + f2 * dt * c2) * dt) * dt); | |
| 842 | 842 | phase -= floor(phase); |
| 843 | 843 | |
| 844 | 844 | // Allocate ephemeris |
| ... | ... | @@ -851,7 +851,7 @@ void GPulsar::load_psrtime(const GFilename& filename, const std::string& name) |
| 851 | 851 | ephemeris.tstop(tstop); |
| 852 | 852 | ephemeris.timesys("UTC"); // psrtime ephemerides are in UTC |
| 853 | 853 | ephemeris.t0(t0); |
| 854 | - ephemeris.phase(phase); | |
| 854 | + ephemeris.phase(-phase); | |
| 855 | 855 | ephemeris.f0(f0); |
| 856 | 856 | ephemeris.f1(f1); |
| 857 | 857 | ephemeris.f2(f2); | ... | ... |