简易安装Astropysics在转换坐标时会出现错误,coordsys

时间:2016-04-01 01:31:14

标签: python astropy

我有一些我编写并导入到新计算机的代码,我尝试在astropysics和networkx上进行easy_install,但似乎我以前的(工作)代码在astropysics的easy_install版本中遇到了问题。我以前没见过这个,所以我想也许有人会有这个想法。我的相关代码是:

import os, sys
import numpy as np
import matplotlib.pyplot as plt
import asciitable
from scipy import stats
import astropysics
import astropysics.obstools
import astropysics.coords
import math
import pylab as P
import random
from random import randint
from pylab import *
from astropysics.coords import ICRSCoordinates,GalacticCoordinates
from scipy.optimize import curve_fit

f=open(sys.argv[1])
y= asciitable.read(f,Reader=asciitable.CommentedHeader,delimiter=' ')
f.close()

vhc = y['Vhelavg'] 
verr = y['Verravg']
Radeg=y['Radeg']
Decdeg=y['Decdeg']
Rcoeff=y['Rcoeffavg']
logg=y['loggavg']

vhcgood= (vhc != -99.9) & (vhc >= -400) & (vhc <= 400) & (logg<=2.3)
vhcg=vhc[vhcgood]

l=[]
b=[]
Radg=Radeg[vhcgood]
Decdg=Decdeg[vhcgood]
for i in xrange(len(Radg)):
gcoords=ICRSCoordinates(Radg[i],Decdg[i]).convert(GalacticCoordinates)
l.append(gcoords.l.radians)
b.append(gcoords.b.radians)

错误是:

Traceback (most recent call last):
File "gauss01_15.py", line 46, in <module>
gcoords=ICRSCoordinates(Radg[i],Decdg[i]).convert(GalacticCoordinates)
File "/Library/Python/2.7/site-packages/Astropysics-1.0-py2.7.egg/astropysics/coords/coordsys.py", line 1895, in convert
res = EpochalLatLongCoordinates.convert(self,tosys,optimize)
File "/Library/Python/2.7/site-packages/Astropysics-1.0-py2.7.egg/astropysics/coords/coordsys.py", line 1781, in convert
res = LatLongCoordinates.convert(self,tosys,optimize)
File "/Library/Python/2.7/site-packages/Astropysics-1.0-py2.7.egg/astropysics/coords/coordsys.py", line 1728, in convert
return CoordinateSystem.convert(self,tosys)
File "/Library/Python/2.7/site-packages/Astropysics-1.0-py2.7.egg/astropysics/coords/coordsys.py", line 1098, in convert
convpath = CoordinateSystem.getTransformPath(self.__class__,tosys)
File "/Library/Python/2.7/site-packages/Astropysics-1.0-py2.7.egg/astropysics/coords/coordsys.py", line 1038, in getTransformPath
path = nx.shortest_path(g,fromsys,tosys,weighted=True)
TypeError: shortest_path() got an unexpected keyword argument 'weighted'

我以前从来没有得过这个,并且从未在astropysics中遇到过简单的python坐标转换问题。任何想法都表示赞赏。

1 个答案:

答案 0 :(得分:0)

您可能需要升级astropysics版本。 networkx的{​​{1}}(nx)依赖关系发生了变化,已在astropysics的更新版本中进行了处理。 (关键字参数astropysics已更改为weighted,显然您有weightastropysics的不兼容版本来处理此更改。) 相关修复程序显示在astropysics中的these lines中。

如果您不自动升级networkx软件包,则可能需要升级。

networkx

希望能帮到你。