def buildtmc(tmcname):
from pyraf import iraf
from iraf import stsdas,hst_calib,synphot
out=open('buildtmc.log','w')
f=pyfits.open(tmcname)
flist=f[1].data.field('filename')
iraf.set(crrefer='./') #work locally
for k in range(len(flist)):
oldname=iraf.osfn(flist[k]).split('[')[0]
newname=fincre(oldname)
if os.path.exists(newname):
flist[k]=fincre(flist[k])
else:
out.write("%s: no change necessary\n"%oldname)
f.writeto(tmcname.replace(".fits","_new.fits"))
out.close()
评论列表
文章目录