由于更新为Astropy 4.0,因此尝试访问dtype
对象的Time
导致错误
'Time'对象没有属性'dtype'
我已经阅读了文档,但是找不到有关此更改或如何复制其提供的功能的说明。在更新之前,此类访问将返回Time
或object
之类的值。
如何检索Astropy 4.0 float64
实例的dtype
?
您要从哪个版本的Astropy升级?我找不到[(已记录)] Time
属性的任何最新版本。在以前的版本中:
Time.dtype
但是,有:
>>> import astropy
>>> astropy.__version__
'3.2.3'
>>> from astropy.time import Time
>>> t = Time([1, 2, 3], format='unix')
>>> t.dtype
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/embray/.virtualenvs/astropy/lib/python3.6/site-packages/astropy/time/core.py", line 1558, in __getattr__
return self.__getattribute__(attr)
AttributeError: 'Time' object has no attribute 'dtype'
其中>>> t.value.dtype
dtype('float64')
给出值的基础numpy数组(也许可以更好地记录)。
我不确定是否有Time.value
,或者如果确实存在,则必须是较旧的版本。