-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Hi All (especially @mhvk and @taldcroft and adding @demorest),
So I'm doing some detailed testing of the various time scales as compared to TEMPO2, for use in a new pulsar timing package and I've found an awkward behavior resulting from using TimeDeltas on Time objects to create new times. The resulting Time objects don't "remember" any of the special parameters set during instantiation.
This is perhaps a design "feature", but it makes adjusting times (which, for instance, we need to do to apply observatory clock corrections) quite difficult, as the new Time instances don't transform to, say, tt or tdb in the same way.
Here is an example (which I think also shows a bug for the property delta_ut1_utc when it is not set). I'm using numpy 1.7.1 and astropy '0.4.dev6849'
If this is the intended behavior, there should at least be some way to work around it... (and maybe that even exists already?)
Thanks,
Scott
In [1]: import astropy.time as time
In [2]: import astropy.units as u
In [3]: import astropy.utils
In [4]: from astropy.utils.iers import IERS_A, IERS_A_URL
In [5]: from astropy.utils.data import download_file
In [6]: iers_a_file = download_file(IERS_A_URL, cache=True)
In [7]: iers_a = IERS_A.open(iers_a_file)
In [8]: t = time.Time(54555.0, 0.12345, scale='utc', format='mjd',
...: lat=30*u.deg, lon=-75*u.deg)
In [9]: t.delta_ut1_utc = t.get_delta_ut1_utc(iers_a)
In [10]: print t.lat, t.lon, t.tdb.jd1, t.tdb.jd2, t.tdb.delta_tdb_tt, t.delta_ut1_utc
30d00m00s -75d00m00s 2454555.5 0.12420446937 [ 0.00215361] [-0.35934716]
In [11]: t += 0.0*u.s # Add no time at all to the time instance
In [12]: print t.lat, t.lon, t.tdb.jd1, t.tdb.jd2, t.tdb.delta_tdb_tt, t.delta_ut1_utc
None None 2454556.0 -0.375795551546 [ 0.00034644]ERROR: TypeError: unsupported operand type(s) for -: 'NoneType' and 'float' [astropy.utils.iers.iers]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-12-5b874f2327ab> in <module>()
----> 1 print t.lat, t.lon, t.tdb.jd1, t.tdb.jd2, t.tdb.delta_tdb_tt, t.delta_ut1_utc
/home/sransom/src/astropy_dev/astropy/time/core.pyc in _get_delta_ut1_utc(self, jd1, jd2)
780 from ..utils.iers import IERS
781 iers_table = IERS.open()
--> 782 self._set_delta_ut1_utc(iers_table.ut1_utc(jd1, jd2))
783
784 return self._delta_ut1_utc
/home/sransom/src/astropy_dev/astropy/utils/iers/iers.pyc in ut1_utc(self, jd1, jd2, return_status)
186 """
187
--> 188 mjd, utc = self.mjd_utc(jd1, jd2)
189 # enforce array
190 is_scalar = not hasattr(mjd, '__array__') or mjd.ndim == 0
/home/sransom/src/astropy_dev/astropy/utils/iers/iers.pyc in mjd_utc(self, jd1, jd2)
155 except:
156 pass
--> 157 mjd = np.floor(jd1 - MJD_ZERO + jd2)
158 utc = jd1 - (MJD_ZERO+mjd) + jd2
159 return mjd, utc
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'