def starfinderClean(self): try: print 'CLEAN starfinder' os.chdir(self.dirCleanStf) # Write an IDL batch file fileIDLbatch = 'idlbatch_clean_' + self.filt fileIDLlog = fileIDLbatch + '.log' util.rmall([fileIDLlog, fileIDLbatch]) _batch = open(fileIDLbatch, 'w') _batch.write("find_stf_clean, ") _batch.write("'" + self.epoch + "', ") _batch.write("'" + self.filt + "', ") _batch.write("corr='" + str(self.corrClean) + "', ") _batch.write("cooStar='" + self.cooStar + "', ") _batch.write("suffixEpoch='" + self.suffix + "', ") _batch.write("starlist='" + self.starlist + "', ") _batch.write("fileList='" + self.cleanList + "', ") _batch.write("rootDir='" + self.rootDir + "'") _batch.write("\n") _batch.write("exit\n") _batch.close() cmd = 'idl < ' + fileIDLbatch + ' >& ' + fileIDLlog #os.system(cmd) subp = subprocess.Popen(cmd, shell=True, executable="/bin/tcsh") tmp = subp.communicate() # Copy over the PSF starlist that was used (for posterity). outPsfs = 'c_%s_%s_psf_list.txt' % (self.epoch, self.filt) shutil.copyfile(self.starlist, outPsfs) os.chdir(self.dirStart) except: os.chdir(self.dirStart) raise
def starfinderCombo(self, oldPsf=False): try: print 'COMBO starfinder' print 'Coo Star: ' + self.cooStar os.chdir(self.dirComboStf) if self.type == 'ao': # Write an IDL batch file fileIDLbatch = 'idlbatch_combo_' + self.filt fileIDLlog = fileIDLbatch + '.log' util.rmall([fileIDLlog, fileIDLbatch]) _batch = open(fileIDLbatch, 'w') _batch.write("find_stf_new, ") _batch.write("'" + self.epoch + "', ") _batch.write("'" + self.filt + "', ") _batch.write("corr_main='%3.1f', " % self.corrMain) _batch.write("corr_subs='%3.1f', " % self.corrSub) # Only send in the deblend flag if using it! if self.deblend != None: _batch.write("deblend='" + str(self.deblend) + "', ") _batch.write("cooStar='" + self.cooStar + "', ") _batch.write("suffixEpoch='" + self.suffix + "', ") _batch.write("imgSuffix='" + self.imgSuffix + "', ") _batch.write("starlist='" + self.starlist + "', ") if oldPsf: _batch.write("/oldPsf, ") _batch.write("rootDir='" + self.rootDir + "'") _batch.write("\n") _batch.write("exit\n") _batch.close() elif self.type == 'speckle': fileIDLbatch = 'idlbatch_combo' fileIDLlog = fileIDLbatch + '.log' util.rmall([fileIDLlog, fileIDLbatch]) _batch = open(fileIDLbatch, 'w') _batch.write("find_new_speck, ") _batch.write("'" + self.epoch + "', ") _batch.write("corr_main='%3.1f', " % self.corrMain) _batch.write("corr_subs='%3.1f', " % self.corrSub) _batch.write("starlist='" + self.starlist + "', ") if oldPsf: _batch.write("/oldPsf, ") _batch.write("rootDir='" + self.rootDir + "'") _batch.write("\n") _batch.write("exit\n") _batch.close() cmd = 'idl < ' + fileIDLbatch + ' >& ' + fileIDLlog #os.system(cmd) subp = subprocess.Popen(cmd, shell=True, executable="/bin/tcsh") tmp = subp.communicate() # Copy over the PSF starlist that was used (for posterity). outPsfs = 'mag%s%s_%s_psf_list.txt' % (self.epoch, self.imgSuffix, self.filt) shutil.copyfile(self.starlist, outPsfs) os.chdir(self.dirStart) except: os.chdir(self.dirStart) raise