def mkMsg(self): """create and write module level message for this class. Most of this is just compiling the info. meta in a dictionary of lists where each list is a list of tuples describing the tag lines for the particular section of the message. This tuple format conforms to that used by the xmlMessage class which is modeled on basic python argument passing, i.e. (key,*value,**attr). """ self.meta = {} self.meta['module'] = [] self.meta['meta'] = [] self.meta['input'] = [] self.meta['output'] = [] self.meta['errorlist'] = [] self.meta['module'].append( ('module', 'name=' + self.modName, 'version=' + __version__, 'dataset=' + self.obsName)) self.meta['module'].append(('root', self.root)) self.meta['meta'].append(('meta', )) self.meta['meta'].append(('depend', )) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'python')) self.meta['meta'].append(('version', pyversion.split()[0])) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'numpy.oldnumeric')) self.meta['meta'].append(('version', numver)) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'tableio.py')) self.meta['meta'].append(('version', tableio.__version__)) if self.errorList: self.meta['errorlist'].append(('errorlist', )) for pkg, err in self.errorList: self.meta['errorlist'].append( ('erroritem', err, 'frompkg=' + pkg)) # input section self.meta['input'].append(('input', )) for f in self.inputList: self.meta['input'].append(('file', 'type=text/ascii')) self.meta['input'].append(('name', os.path.join("Catalogs", f))) # output section if self.outputList: self.meta['output'].append(('output', )) for f in self.outputList.keys(): if string.find(f, ".xml") != -1: self.meta['output'].append(('file', 'type=text/xml')) self.meta['output'].append( ('name', os.path.join("Catalogs", f))) for pred in self.outputList[f]: self.meta['output'].append( ('predecessor', os.path.join("Catalogs", pred))) else: self.meta['output'].append(('file', 'type=text/ascii')) self.meta['output'].append( ('name', os.path.join("Catalogs", f))) for pred in self.outputList[f]: self.meta['output'].append( ('predecessor', os.path.join("Catalogs", pred))) # pass this dictionary to the class pMessage... msgFile = os.path.join(self.messagedir, self.modName + "_module.xml") mmsg = pMessage(self.meta) mmsg.writeMsg(msgFile) return
def mkMsg(self): """Create and write module level message for this class. Most of this is just compiling the info. meta is a dictionary of lists where each list is a list of tuples describing the tag lines for the particular section of the message. This tuple format conforms to that used by the xmlMessage class which is modeled on basic python argument passing, i.e. (key,*value,**attr). """ # getting the version of project_coords project_coords_cmd = 'project_coords --version' outp = popen2.Popen4(project_coords_cmd) outpline = outp.fromchild.readlines() pcoorVer = outpline[0].split()[-1] self.meta = {} self.meta['module'] = [] self.meta['meta'] = [] self.meta['input'] = [] self.meta['output'] = [] self.meta['errorlist'] = [] self.meta['module'].append( ('module', 'name=' + self.modName, 'version=' + __version__, 'dataset=' + self.obsName)) self.meta['module'].append(('root', self.root)) self.meta['meta'].append(('meta', )) self.meta['meta'].append(('depend', )) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'python')) self.meta['meta'].append(('version', pyversion.split()[0])) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'pyfits')) self.meta['meta'].append(('version', pyfits.__version__.split()[0])) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'project_coords')) self.meta['meta'].append(('version', pcoorVer)) self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', 'Guide Star Catalog')) self.meta['meta'].append( ('version', _URL_.split("/")[-1].split("q")[0])) # SExtractor info sub = subprocess.Popen(['sex', '--version'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) outp = sub.stdout.readlines() name = outp[0].split()[0] ver = outp[0].split()[2] self.meta['meta'].append(('pkg', )) self.meta['meta'].append(('name', name)) self.meta['meta'].append(('version', ver)) cmdline1 = 'sex fitsfile -c self.InParFileName' self.meta['meta'].append(('commandline', cmdline1)) del outp, sub, name, ver if self.errorList: self.meta['errorlist'].append(('errorlist', )) for pkg, err in self.errorList: self.meta['errorlist'].append( ('erroritem', err, 'frompkg=' + pkg)) # input section self.meta['input'].append(('input', )) for f in self.inputList: if string.find(f, "_asn") == -1: self.meta['input'].append(('file', 'type=image/x-fits')) self.meta['input'].append(('name', os.path.join("Images", f))) else: self.meta['input'].append(('file', 'type=image/x-fits')) self.meta['input'].append(('name', os.path.join("Images", f))) # output section if self.outputList: self.meta['output'].append(('output', )) for f in self.outputList.keys(): if string.find(f, ".xml") == -1: self.meta['output'].append(('file', 'type=image/x-fits')) self.meta['output'].append(('name', os.path.join("Images", f))) for pred in self.outputList[f]: self.meta['output'].append( ('predecessor', os.path.join("Images", pred))) else: self.meta['output'].append(('file', 'type=text/xml')) self.meta['output'].append(('name', os.path.join("Images", f))) for pred in self.outputList[f]: self.meta['output'].append( ('predecessor', os.path.join("Images", pred))) # pass this dictionary to the class pMessage... msgFile = os.path.join(self.messagedir, self.modName + "_module.xml") mmsg = pMessage(self.meta) mmsg.writeMsg(msgFile) return
def mkMsg(self): """create and write module level message for this class. Most of this is just compiling the info. meta is a dictionary of lists where each list is a list of tuples describing the tag lines for the particular section of the message. This tuple format conforms to that used by the xmlMessage class which is modeled on basic python argument passing, i.e. (key,*value,**attr). """ self.meta = {} self.meta['module'] = [] self.meta['meta'] = [] self.meta['input'] = [] self.meta['output'] = [] self.meta['errorlist'] = [] self.meta['module'].append(('module','name='+self.modName,'version='+__version__,'dataset='+self.obsName)) self.meta['module'].append(('root',self.root)) self.meta['meta'].append(('meta',)) self.meta['meta'].append(('depend',)) self.meta['meta'].append(('pkg',)) self.meta['meta'].append(('name','python')) self.meta['meta'].append(('version',pyversion.split()[0])) self.meta['meta'].append(('pkg',)) self.meta['meta'].append(('name','pyfits')) self.meta['meta'].append(('version',pyfits.__version__.split()[0])) # SExtractor info sub = subprocess.Popen(['sex', '--version'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) outp = sub.stdout.readlines() name = outp[0].split()[0] ver = outp[0].split()[2] self.meta['meta'].append(('pkg',)) self.meta['meta'].append(('name',name)) self.meta['meta'].append(('version',ver)) cmdline1 = 'sex fitsfile -c self.defaultInParFile' self.meta['meta'].append(('commandline',cmdline1)) del outp,sub,name,ver # match info sub = subprocess.Popen(['match', '--version'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) outp = sub.stdout.readlines() name = outp[0].split()[0][:-1] ver = outp[0].split()[2] self.meta['meta'].append(('pkg',)) self.meta['meta'].append(('name',name)) self.meta['meta'].append(('version',ver)) # ok, here's the new, post version 0.5 command, where the part in brackets # [identity xsh=dx ysh=dy] is only included if the angle is expected to be small cmdline2 = "match file_matchin 1 2 3 self.refMatchFile 1 2 3 max_iter=10 scale=1.00 nobj=60 matchrad=str(tolmatch) trirad=0.00033 recalc medtf medsigclip=2.7 outfile=outfile [identity xsh=+str(hdr_dx)+ ysh=+str(hdr_dy)]" self.meta['meta'].append(('commandline',cmdline2)) del outp,sub,name,ver if self.GlobalBlock.errorList: self.meta['errorlist'].append(('errorlist',)) for pkg,err in self.GlobalBlock.errorList: self.meta['errorlist'].append(('erroritem',err,'frompkg='+pkg)) # input section self.meta['input'].append(('input',)) # 25/Jan/02 - updating meta['input'] to reflect changes in MatchDict for im in self.imfiles: if not im.extref: self.meta['input'].append(('file','type=image/x-fits')) self.meta['input'].append(('name',os.path.join("Images",im.PathName))) self.meta['input'].append(('attr',im.MatchDict['Nraw'] ,'name=Nraw')) self.meta['input'].append(('attr',im.MatchDict['Ngood'] ,'name=Ngood')) self.meta['input'].append(('attr',im.MatchDict['Nmatch'] ,'name=Nmatch')) self.meta['input'].append(('attr',im.MatchDict['xpix_shift'] ,'name=xpix_shift')) self.meta['input'].append(('attr',im.MatchDict['xpix_shift_err'],'name=xpix_shift_err')) self.meta['input'].append(('attr',im.MatchDict['ypix_shift'] ,'name=ypix_shift')) self.meta['input'].append(('attr',im.MatchDict['ypix_shift_err'],'name=ypix_shift_err')) self.meta['input'].append(('attr',im.MatchDict['xarc_shift'] ,'name=xarc_shift')) self.meta['input'].append(('attr',im.MatchDict['yarc_shift'] ,'name=yarc_shift')) self.meta['input'].append(('attr',im.MatchDict['angle'] ,'name=angle')) self.meta['input'].append(('attr',im.MatchDict['angle_err'] ,'name=angle_err')) self.meta['input'].append(('attr',im.MatchDict['skyval'] ,'name=skyval')) self.meta['input'].append(('attr',im.MatchDict['skyrms'] ,'name=skyrms')) # output section if self.GlobalBlock.outputList: self.meta['output'].append(('output',)) for f in self.GlobalBlock.outputList.keys(): if string.find(f,".fits") != -1: self.meta['output'].append(('file','type=image/x-fits')) self.meta['output'].append(('name',os.path.join("Images",f))) for pred in self.GlobalBlock.outputList[f]: self.meta['output'].append(('predecessor',os.path.join("Images",pred))) else: self.meta['output'].append(('file','type=text/ascii')) self.meta['output'].append(('name',os.path.join("align",f))) for pred in self.GlobalBlock.outputList[f]: self.meta['output'].append(('predecessor',os.path.join("Images",pred))) # pass this dictionary to the class pMessage... msgFile = os.path.join(self.messagedir,self.modName+"_module.xml") mmsg = pMessage(self.meta) mmsg.writeMsg(msgFile) return