使用numdisplay,“远程主机强制关闭现有连接”

时间:2013-10-03 14:14:24

标签: python python-2.7

我一直在学习在天文学中使用python,为此我正在关注this笔记。作者在一开始就做了以下例子:

>>> im = pyfits.getdata('http://das.sdss.org/www/cgi-bin/drC?RUN=3630&RERUN=40&CAMCOL=3&FIELD=83&FILTER=r')
>>> numdisplay.display(im,z1=1000,z2=1500)

我尝试复制它并得到:

>>> numdisplay.display(im,z1=1000,z2=1500)
Image displayed with Z1:  1000  Z2: 1500

Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    numdisplay.display(im,z1=1000,z2=1500)
  File "C:\Mine\Python\lib\site-packages\numdisplay\__init__.py", line 446, in display
    _d.writeImage(bpix,_wcsinfo)
  File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 513, in writeImage
    self.writeData(_lx,_ydisp,_fpix[block,:])
  File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 379, in writeData
    self._writeHeader(opcode,self._MEMORY, -nbytes, x, y, frame, 0)
  File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 542, in _writeHeader
    self._write(a.tostring())
  File "C:\Mine\Python\lib\site-packages\numdisplay\displaydev.py", line 580, in _write
    nwritten = self._socket.send(s[-n:])
error: [Errno 10054] An existing connection was forced to close by the remote host

我不明白我做错了什么。我的意思是,如果我写numdisplay.open()一切都很好......我在想它可能是我的防病毒软件或不让python与ds9通信的东西......有人能帮助我吗?

编辑:好吧它似乎不是防病毒软件。我停止了它并运行脚本,我得到了同样的错误。

1 个答案:

答案 0 :(得分:1)

我收到类似的错误消息,我只是尝试在bufname参数中添加一个非''no'参数,它可以正常工作(我的图像大约是4096.4096):

numdisplay.display(data,bufname='imt4096')