2013-07-13 3 views
0

이 오류 메시지 및/또는 그것이 발생한 곳을 이해하는 데 도움이 필요합니다. 나는 철저히 혼란 스럽다. 내게있어, 오류가 무엇인지 정확히 지적 할 수 없다.파이썬 오류 메시지에 대한 이해?

는 여기에 내가 실행하는 데 노력하고있어 코드입니다 :

def objmask(inimgs, inwhts, thresh1='20.0', thresh2='2.0', tfdel=True, 
      xceng=3001., yceng=3001., outdir='.', tmpdir='tmp'): 
# initial detection of main galaxy with SExtractor for re-centering purposes 
    if outdir!='.': 
     if not os.path.exists(outdir): 
      os.makedirs(outdir) 

    if not os.path.exists(tmpdir): 
     os.makedirs(tmpdir) 
    for c in range(np.size(inimgs)): 
     print 'Creating Aperture Run:', c 
     subprocess.call(['sex',inimgs[c],'-c','./se_files/gccg.sex', 
         '-CATALOG_NAME','./se_files/_tmp_seobj'+str(c)+'.cat', 
         '-PARAMETERS_NAME','./se_files/gccg_ell.param', 
         '-FILTER_NAME','./se_files/gccg.conv', 
         '-STARNNW_NAME','./se_files/gccg.nnw', 
         '-CHECKIMAGE_TYPE','APERTURES', 
         '-VERBOSE_TYPE','QUIET', 
         '-DETECT_THRESH',thresh1, 
         '-ANALYSIS_THRESH',thresh2, 
         '-WEIGHT_IMAGE',inwhts[c]], 
         ) 

# extract catalog and identify central galaxy 
     secat=asciitable.read('./se_files/_tmp_seobj'+str(c)+'.cat', 
           names=['flux','ferr','xmin','ymin','xmax','ymax', 
            'xc','yc','cxx','cyy','cxy']) 
     robj = np.sqrt((secat['xc']-xceng)**2.0+(secat['yc']-yceng)**2.0) 
     rmin = (robj==np.min(robj)) 
     wrmin = np.where(robj==np.min(robj)) 
     xc_min,yc_min = secat['xc'][rmin],secat['yc'][rmin] 
     print 'extract catalog complete' 

# shift images and masks to a common center 
     hdu=pf.open(inimgs[c]) 
     img=hdu[0].data 

     xdel=xceng-xc_min 
     ydel=yceng-yc_min 
     img_sh=shift(img,[ydel,xdel]) 

     hdu2=pf.open(inwhts[c]) 
     mask=hdu2[0].data 
     mask_sh=shift(mask,[yceng-yc_min,xceng-xc_min]) 

     xmin=np.delete(secat['xmin']+xdel,wrmin) 
     xmax=np.delete(secat['xmax']+xdel,wrmin) 
     xcen=np.delete(secat['xc']+xdel,wrmin) 
     ymin=np.delete(secat['ymin']+ydel,wrmin) 
     ymax=np.delete(secat['ymax']+ydel,wrmin) 
     ycen=np.delete(secat['yc']+ydel,wrmin) 
    print 'shift complete' 

# mask detected objects and write mask file 
     #retgen.pbar ((float(c)*ncols+1.0)/18.0) 
     omask=tgen.semask(img.shape,xmin,xmax,ymin,ymax,xcen,ycen, 
          np.delete(secat['cxx'],wrmin), 
          np.delete(secat['cyy'],wrmin), 
          np.delete(secat['cxy'],wrmin),2.0) 

     hdimsh=pf.PrimaryHDU(img_sh) 
     hdmsh=pf.PrimaryHDU(omask) 
     with warnings.catch_warnings(): 
      warnings.simplefilter('ignore') 
      hdimsh.writeto(outdir+'/sh_img_'+str(c)+'.fits', 
          clobber=True) 
      hdmsh.writeto(tmpdir+'/_omask.fits',clobber=True) 
    print 'mask file complete' 

여기에 내가 터미널을 통해 그것을 실행할 때 내가 오류 메시지입니다 :

>>> fetch_swarp2.objmask(['sciPHOTOf105w0.fits'],['whtPHOTOf105w0.fits']) 
Creating Aperture Run: 0 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "fetch_swarp2.py", line 110, in objmask 
    '-WEIGHT_IMAGE',inwhts[c]], 
    File "/usr/lib/python2.7/subprocess.py", line 493, in call 
    return Popen(*popenargs, **kwargs).wait() 
    File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ 
    errread, errwrite) 
    File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child 
    raise child_exception 
OSError: [Errno 2] No such file or directory 

을 따라서. . . 문제는 어디에 있으며 문제를 해결하려면 어떻게해야합니까?

답변

0

키워드 인수로 subprocess.call을 호출하십시오.

subprocess.call([...], shell=True) 

또는 sex의 전체 경로를 지정은 :

subprocess.call(['/path/to/sex', ...], shell=True) 
+0

터미널에서 어디에서 수정을해야합니까? – vdogsandman

0

그 코드는 일부 인수 sex라는 명령을 실행합니다. 파이썬은 그 명령을 찾을 수 없다. 설치했는지 확인하십시오. 의견은 명령이 SExtractor에 의해 제공되었음을 나타내는 것 같습니다.