def createOutputs(clip): """ Read in a clip and create outputs. and appends results to a table (logTableFile) """ #Some of this needs to not be hardwired here. This is ugly. clip['config']['exportLoc'] = '/soc/nfs/so-nfs/dave/c7-pdc/' clip['config']['onepageBasename'] = clip['config']['exportLoc'] clip['config']['dataStorePath'] = '/home/smullall/Science/datastore' epic = str(int(clip.value)) #print clip.serve try: clip.serve.time except AttributeError: clip = dpp.serveLocalTask(clip) print 'hi serve' print clip.serve try: print clip.exception except AttributeError: pass #dpp.plotTask(clip) cmd = "" try: if clip.disposition.isSignificantEvent: clip['config']['stellarPar'] = [ 'Mass', 'Rad', 'Teff', 'dis', 'rho', 'prov', 'logg' ] #clip['config']['stellarFile']='/home/smullall/Science/DAVE/dave/etc/k2EpicCatalogStellarTable5.txt' clip = stel.addStellarToClip(clip) clip = stel.estimatePlanetProp(clip) outfile = "%s/%s/epic%s-mp.pdf" % (clip.config['exportLoc'], epic, epic) mpp.plot_multipages(outfile, clip, outfile) #fig = plt.figure(1, figsize=figuresize, dpi=dotperinch) #pp.summaryPlot1(clip) #file2="%s/%s/%s-modshift.pdf" % (clip.config.exportLoc,epic,epic) #file3="%s/%s/%s-onepage.pdf" % (clip.config.onepageBasename,epic,epic) cmd = '' #cmd="gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=%s/%s/%s-all.pdf %s %s" % (clip.config.exportLoc,epic,epic, outfile,file2) #cmd="pdftk %s %s %s output %s/%s/%s-all.pdf" % (outfile,file2,file3,clip.config['exportLoc'],epic,epic) print cmd os.system(cmd) except (KeyError, AttributeError, TypeError), e: cmd = "None" print epic, e print "No Exports"
def createOutputs(clip): """ Read in a clip and create outputs. and appends results to a table (logTableFile) """ #Some of this needs to not be hardwired here. This is ugly. clip['config']['exportLoc']='/soc/nfs/so-nfs/dave/c7-pdc/' clip['config']['onepageBasename']=clip['config']['exportLoc'] clip['config']['dataStorePath']='/home/smullall/Science/datastore' epic=str(int(clip.value)) #print clip.serve try: clip.serve.time except AttributeError: clip=dpp.serveLocalTask(clip) print 'hi serve' print clip.serve try: print clip.exception except AttributeError: pass #dpp.plotTask(clip) cmd="" try: if clip.disposition.isSignificantEvent: clip['config']['stellarPar']=['Mass','Rad','Teff','dis','rho','prov','logg'] #clip['config']['stellarFile']='/home/smullall/Science/DAVE/dave/etc/k2EpicCatalogStellarTable5.txt' clip=stel.addStellarToClip(clip) clip=stel.estimatePlanetProp(clip) outfile="%s/%s/epic%s-mp.pdf" % (clip.config['exportLoc'],epic,epic) mpp.plot_multipages(outfile, clip, outfile) #fig = plt.figure(1, figsize=figuresize, dpi=dotperinch) #pp.summaryPlot1(clip) #file2="%s/%s/%s-modshift.pdf" % (clip.config.exportLoc,epic,epic) #file3="%s/%s/%s-onepage.pdf" % (clip.config.onepageBasename,epic,epic) cmd='' #cmd="gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=%s/%s/%s-all.pdf %s %s" % (clip.config.exportLoc,epic,epic, outfile,file2) #cmd="pdftk %s %s %s output %s/%s/%s-all.pdf" % (outfile,file2,file3,clip.config['exportLoc'],epic,epic) print cmd os.system(cmd) except (KeyError,AttributeError,TypeError),e: cmd="None" print epic, e print "No Exports"
def writeCandidates(clip): clip['config']['stellarPar']=['Mass','Rad','Teff','dis','rho','prov','logg'] clip['config']['stellarFile']='/home/smullall/Science/DAVE/dave/etc/k2EpicCatalogStellarTable5.txt' try: if clip.disposition.isCandidate: clip=stel.addStellarToClip(clip) clip=stel.estimatePlanetProp(clip) outtxt,hdr = createExportString(clip, delimiter=" ", badValue="nan") else: outtxt="none" except (KeyError,AttributeError),e: outtxt=e print clip.value,e
def writeTableLine(clip): clip['config']['stellarPar']=['Mass','Rad','Teff','dis','rho','prov','logg'] clip['config']['stellarFile']='/home/smullall/Science/DAVE/dave/etc/k2EpicCatalogStellarTable5.txt' try: if clip.disposition.isSignificantEvent: clip=stel.addStellarToClip(clip) clip=stel.estimatePlanetProp(clip) except (KeyError,AttributeError): pass outtxt,hdr = createExportString(clip, delimiter=" ", badValue="nan") return outtxt
def writeTableLine(clip): clip['config']['stellarPar'] = [ 'Mass', 'Rad', 'Teff', 'dis', 'rho', 'prov', 'logg' ] clip['config'][ 'stellarFile'] = '/home/smullall/Science/DAVE/dave/etc/k2EpicCatalogStellarTable5.txt' try: if clip.disposition.isSignificantEvent: clip = stel.addStellarToClip(clip) clip = stel.estimatePlanetProp(clip) except (KeyError, AttributeError): pass outtxt, hdr = createExportString(clip, delimiter=" ", badValue="nan") return outtxt
def runExport(clip,output): """ run the exporters based on the input clip. Append the important information to the output File. """ per=np.round(clip['serve.param.orbitalPeriod_days']*10) epoch=np.round(clip['serve.param.epoch_btjd']) basedir=clip.config['onepageBasename'] try: clip['config']['stellarPar']=['Mass','Rad','Teff','dis','rho','prov','logg'] clip=stel.addStellarToClip(clip) clip=stel.estimatePlanetProp(clip) except: print 'No Stellar Values' outstr,header=ex.createExportString(clip, delimiter=" ", badValue="nan") fid=open(output,'a') #fid.write("%s\n" % header) fid.write("%s\n" % outstr) fid.close() tag="%i-%02i-%04i-%s" % (clip.config.value,per,epoch,clip.config.detrendType) outfile="%s/%i/jvet%s" % (basedir,int(clip.config.value),tag) thedir=basedir + str(int(clip.config.value)) try: os.mkdir(thedir) except OSError: donothing = -999. # print "Cannot create directory " + thedir date=datetime.datetime.now() if ('disposition' not in clip.keys()): clip['disposition'] = 'No Disposition Determined' clip.disposition.isCandidate = 0 clip.disposition.isSignificantEvent = 0 clip['value'] = clip.config.value mpp.plot_multipages(outfile, clip, date) return outfile
def writeCandidates(clip): clip['config']['stellarPar'] = [ 'Mass', 'Rad', 'Teff', 'dis', 'rho', 'prov', 'logg' ] clip['config'][ 'stellarFile'] = '/home/smullall/Science/DAVE/dave/etc/k2EpicCatalogStellarTable5.txt' try: if clip.disposition.isCandidate: clip = stel.addStellarToClip(clip) clip = stel.estimatePlanetProp(clip) outtxt, hdr = createExportString(clip, delimiter=" ", badValue="nan") else: outtxt = "none" except (KeyError, AttributeError), e: outtxt = e print clip.value, e
def runExport(clip, output): """ run the exporters based on the input clip. Append the important information to the output File. """ per = np.round(clip.bls.period * 10) epoch = np.round(clip.bls.epoch) basedir = clip.config["onepageBasename"] try: clip["config"]["stellarPar"] = ["Mass", "Rad", "Teff", "dis", "rho", "prov", "logg"] clip = stel.addStellarToClip(clip) clip = stel.estimatePlanetProp(clip) except: print "No Stellar Values" outstr, header = ex.createExportString(clip, delimiter=" ", badValue="nan") fid = open(output, "a") # fid.write("%s\n" % header) fid.write("%s\n" % outstr) fid.close() tag = "%i-%02i-%04i-%s" % (clip.value, per, epoch, clip.config.detrendType) outfile = "%s/%09i/jvet%s" % (basedir, int(clip.value), tag) thedir = basedir + str(int(clip.value)) try: os.mkdir(thedir) except OSError: print "Cannot create directory " + thedir # print thedir date = datetime.datetime.now() if "disposition" not in clip.keys(): clip["disposition"] = "No Disposition Determined" clip.disposition.isCandidate = 0 clip.disposition.isSignificantEvent = 0 mpp.plot_multipages(outfile, clip, date) return outfile