再见,Python

2024-04-20 07:02:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试将Chandra分析工具(ciao)合并到pythonhttp://cxc.harvard.edu/ciao4.4/scripting/runtool.html,其中wavdetect是我在ciao中使用的有问题的命令。当我指定输入/输出文件的确切名称时,“wavedetect”工作得很好,但当我为这些文件使用连接名称时,它似乎没有提供任何输出。(我验证了连接的文件在wavedetect中读取良好,但.wait()状态为1)。关于可能原因(解决方案)的任何指示纠正这个错误会有帮助。我将程序的一部分粘贴到这里:

from subprocess import *
p=Popen(["wavdetect","image1.img",
"deep_source_list.fits","deep_scell.fits",
"deep_img.img", "deep_bkg.bkg",     
"psffile=xrt_psf.fits",
"scales=1,1.41421,2.0,2.8284,4.0","regfile=region.reg",
"sigthresh=1e-6","clobber=yes"], stdout=PIPE, stderr=PIPE)
p.wait()

(效果很好)


from subprocess import *
for k in (3,4):
innfile="9" + str(k) + ".img"
listfile="9" + str(k) + "_source_list.fits"
scell="9" + str(k) + "_scell.fits"
image="9" + str(k) + "_img.img"
bkg="9" + str(k) + "_bkg.bkg"
regionfile="9" + str(k) + "region.reg"
print(regionfile)
q=Popen(["wavdetect",innfile,listfile,scell,image,bkg,
"psffile=xrt_psf.fits", "scales= 1,1.41421,2.0,2.8284,4.0", regionfile,
"sigthresh=1e-6", "clobber=yes"], stdout=PIPE, stderr=PIPE)
q.wait()

(给我q.wait()=1,没有输出)

有什么建议吗?你知道吗


Tags: 文件from名称imgdeepwaitpipefits
1条回答
网友
1楼 · 发布于 2024-04-20 07:02:10

为了结案,我要回答我自己的问题:

我写信给ciao服务台,他建议我做以下更改:

 innfile="infile=9{}.img".format(k) listfile="outfile=9{}_source_list.fits".format(k) scell="scellfile=9{}_scell.fits".format(k) image="imagefile=9{}_img.img".format(k) bkg="defnbkgfile=9{}_bkg.bkg".format(k) regionfile="regfile=9{}region.reg".format(k)

维奥拉成功了!你知道吗

相关问题 更多 >