Python 2.7中的Astropy get_gcrs_posvel

时间:2018-03-06 17:31:21

标签: python astropy

在Python 2.7中,我试图通过

来计算天文台的位置和速度
>>> from astropy.time import Time
>>> from astropy.coordinates import SkyCoord, EarthLocation, ICRS
>>> from astropy import units as u
>>> from astropy import coordinates
>>> time=Time(58121.93, format='mjd')
>>> location=EarthLocation(53.2367, 2.3085, 100, ellipsoid = None)
>>> op, ov = location.get_gcrs_posvel(time)

但我收到错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\p\lib\site-packages\astropy\coordinates\earth.py", line 653, in get_gcrs_posvel
    gcrs_data = self._get_gcrs(obstime).data
  File "C:\p\lib\site-packages\astropy\coordinates\earth.py", line 633, in _get_gcrs
    return itrs.transform_to(GCRS(obstime=obstime))
  File "C:\p\lib\site-packages\astropy\coordinates\baseframe.py", line 934, in transform_to
    return trans(self, new_frame)
  File "C:\p\lib\site-packages\astropy\coordinates\transformations.py", line 1314, in __call__
    curr_coord = t(curr_coord, curr_toframe)
  File "C:\p\lib\site-packages\astropy\coordinates\transformations.py", line 847, in __call__
    reprwithoutdiff = supcall(from_diffless, toframe)
  File "C:\p\lib\site-packages\astropy\coordinates\builtin_frames\intermediate_rotation_transforms.py", line 72, in cirs_to_gcrs
    return gcrs.transform_to(gcrs_frame)
  File "C:\p\lib\site-packages\astropy\coordinates\baseframe.py", line 934, in transform_to
    return trans(self, new_frame)
  File "C:\p\lib\site-packages\astropy\coordinates\transformations.py", line 1314, in __call__
    curr_coord = t(curr_coord, curr_toframe)
  File "C:\p\lib\site-packages\astropy\coordinates\transformations.py", line 914, in __call__
    return supcall(fromcoord, toframe)
  File "C:\p\lib\site-packages\astropy\coordinates\builtin_frames\icrs_cirs_transforms.py", line 221, in gcrs_to_gcrs
    return from_coo.transform_to(ICRS).transform_to(to_frame)
  File "C:\p\lib\site-packages\astropy\coordinates\baseframe.py", line 934, in transform_to
    return trans(self, new_frame)
  File "C:\p\lib\site-packages\astropy\coordinates\transformations.py", line 1314, in __call__
    curr_coord = t(curr_coord, curr_toframe)
  File "C:\p\lib\site-packages\astropy\coordinates\transformations.py", line 914, in __call__
    return supcall(fromcoord, toframe)
  File "C:\p\lib\site-packages\astropy\coordinates\builtin_frames\icrs_cirs_transforms.py", line 188, in gcrs_to_icrs
    i_ra, i_dec = aticq(gcrs_ra, gcrs_dec, astrom)
  File "C:\p\lib\site-packages\astropy\coordinates\builtin_frames\utils.py", line 196, in aticq
    before = norm(ppr-d)
  File "C:\p\lib\site-packages\astropy\coordinates\builtin_frames\utils.py", line 125, in norm
    return p/np.sqrt(np.einsum('...i,...i', p, p))[..., np.newaxis]
  File "C:\p\lib\site-packages\numpy\core\einsumfunc.py", line 1087, in einsum
    einsum_call=True)
  File "C:\p\lib\site-packages\numpy\core\einsumfunc.py", line 688, in einsum_path
    input_subscripts, output_subscript, operands = _parse_einsum_input(operands)
  File "C:\p\lib\site-packages\numpy\core\einsumfunc.py", line 432, in _parse_einsum_input
    raise TypeError("For this input type lists must contain "
TypeError: For this input type lists must contain either int or Ellipsis

1 个答案:

答案 0 :(得分:0)

我在Astropy的问题跟踪器上搜索了这个问题并遇到了这个问题:

numpy TypeError on coordinate transform (TypeError: For this input type lists must contain either int or Ellipsis)

从Astropy v2.0.4开始修复,所以,最近。你应该可以升级你的Astropy。