예제 #1
0
def loadClipAndCompFits(data, row):
    epic = data[row, 0]

    clip = dpc.loadClipboard("clips/c%09i-05.clip" %(epic))
    clip = pl.serveTask(clip)


    mp.figure(2)
    mp.clf()
    dpp.plotData(clip)
    mp.title('Epic %.0f' %(epic))

    mp.figure(3)
    mp.clf()
    compareFits(clip)
    mp.title('Epic %.0f' %(epic))

    mp.figure(1)

    print "**************"
    print row, epic
    print clip.bls
    flux = clip.detrend.flux_frac
    flags = clip.detrend.flags
    noi = noise.computeSgCdpp_ppm(flux[~flags]) * 1e-6
    print "BLS SNR= %.2f" %(clip.bls.depth/noi)
예제 #2
0
def loadClipAndCompFits(data, row):
    epic = data[row, 0]

    clip = dpc.loadClipboard("clips/c%09i-05.clip" % (epic))
    clip = pl.serveTask(clip)

    mp.figure(2)
    mp.clf()
    dpp.plotData(clip)
    mp.title('Epic %.0f' % (epic))

    mp.figure(3)
    mp.clf()
    compareFits(clip)
    mp.title('Epic %.0f' % (epic))

    mp.figure(1)

    print "**************"
    print row, epic
    print clip.bls
    flux = clip.detrend.flux_frac
    flags = clip.detrend.flags
    noi = noise.computeSgCdpp_ppm(flux[~flags]) * 1e-6
    print "BLS SNR= %.2f" % (clip.bls.depth / noi)
예제 #3
0
파일: keesC5.py 프로젝트: barentsen/dave
def displayOne(clip):
    mp.figure(1)
    mp.clf()
    dpp.plotData(clip)

    mp.figure(2)
    mp.clf()
    cb.compareFits(clip)
예제 #4
0
def displayOne(clip):
    mp.figure(1)
    mp.clf()
    dpp.plotData(clip)

    mp.figure(2)
    mp.clf()
    cb.compareFits(clip)
예제 #5
0
def summaryPlot1(output):
    """
    Plot the data and some info from the clipboard
    output is a clipboard.
    """
    epicid=str(output['value'])
    blsper=output['bls.period']
    trapsnr=output['trapFit.snr']
    trapper=output['trapFit.period_days']
    trapdur=output['trapFit.period_days']
    logTlpp = np.log10(output['lpp.TLpp'])
    
    plt.clf()
    plt.subplot(2,2,(1,2))
    pp.plotData(output)
    titlewords="%s P=%.2f"  %(epicid,blsper)
    plt.title(titlewords)
    plt.subplot(223)
    pp.plotFolded(output)
    titlewords="P=%.2f d dur=%.2f h SNR=%.1f " % (trapper, trapdur,trapsnr)
    plt.title(titlewords)
    plt.xlim((0,trapper))
    
    plt.subplot(224)
    plt.cla()
    try:
        plt.plot(np.arange(1,142),output['lpp.binnedFlux'],'bo')
        lab="logLPP=%.2f" % (logTlpp)
        plt.xlim((-.9,141.9))
        plt.title(lab)
    except:
        pass
    
    try:
        plt.figtext(.15,.96,output['disposition.fluxVet.disp'],color='r',fontsize=14)
        plt.figtext(.12,.93,output['disposition.reasonForFail'],color='r',fontsize=10)
    except:
        pass
예제 #6
0
def plot_multipages(outfile, clip, intext, figtype="png"):
    """Create a line of text for the exporter
    
    Inputs:
    ------------
    outfile
        A name for the pdf file to be written to
    clip
        A clipboard object
    intext
        A string containing information to be put on the first page.
        
    
    Takes a clipboard, clip, and create plots
    put these plots all into one multi paged document
    specifieed by outfile
    """

    plt.ioff()
    dotperinch = 120
    figuresize = (11, 8)
    # The PDF document
    pdfout = outfile + '.pdf'
    pdf_pages = PdfPages(pdfout)
    # Create a figure instance (ie. a new page)
    #pdf_pages.attach_note(('KIC %u   [%u]' % (clip.value, clip.disposition.isCandidate)),positionRect=[100,200,10,400])

    fig = plt.figure(1, figsize=figuresize, dpi=dotperinch)

    plt.figtext(0.2, 0.85, intext, color='r', fontsize=15)
    plt.figtext(0.15, 0.2, clip.disposition, color='b', fontsize=14)
    plt.title('Disposition Information for EPIC %u' % clip['value'])

    if clip.disposition.isSignificantEvent:
        steltxt = clip.get('stellar', defaultValue='No Stellar Available')
        plt.figtext(0.7, 0.3, steltxt)
        plantxt = clip.get('planet', defaultValue='No Planet Param. Avail.')
        plt.figtext(0.7, 0.2, plantxt)

    fig.patch.set_visible(False)
    plt.gca().axis('off')
    plt.savefig(pdf_pages, format='pdf')
    outname = "%s-%s.%s" % (outfile, "info", figtype)

    plt.savefig(outname)
    plt.close()

    fig = plt.figure(1, figsize=figuresize, dpi=dotperinch)
    # Plot whatever you wish to plot
    pp.summaryPlot1(clip)
    # Done with the page
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "summary", figtype)
    fig.savefig(outname)
    plt.close()

    fig = plt.figure(figsize=figuresize, dpi=dotperinch)
    # Plot whatever you wish to plot
    pp.plotData(clip, nPanel=3)
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "data", figtype)
    fig.savefig(outname)
    plt.close()

    fig = plt.figure(figsize=figuresize, dpi=dotperinch)
    pp.indivTransitPlot(clip, 6)
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "indiv", figtype)
    plt.savefig(outname)
    plt.close()

    try:
        fig = plt.figure(figsize=figuresize, dpi=dotperinch)
        pp.blsPlot(clip)
        pdf_pages.savefig()
        outname = "%s-%s.%s" % (outfile, "bls", figtype)
        plt.savefig(outname)
        plt.close()
    except AttributeError:
        pass

    try:
        #Plot centroid plots
        (fig2, fig1) = dip.plotWrapper(clip)
    except ValueError:
        fig1 = plt.figure()
        fig2 = plt.figure()

    fig1.set_size_inches(figuresize)
    pdf_pages.savefig(fig1, dpi=dotperinch)
    outname = "%s-%s.%s" % (outfile, "cent1", figtype)
    fig1.savefig(outname)
    fig2.set_size_inches(figuresize)
    pdf_pages.savefig(fig2, dpi=dotperinch)
    outname = "%s-%s.%s" % (outfile, "cent2", figtype)
    fig2.savefig(outname)
    plt.close()

    fig = plt.figure(figsize=figuresize, dpi=dotperinch)
    pp.lppDiagnostic(clip)
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "lpp", figtype)
    plt.savefig(outname)
    plt.close()

    # Write the PDF document to the disk
    pdf_pages.close()

    plt.close()
예제 #7
0
def plot_multipages(outfile, clip, intext, figtype="png"):
    """Create a line of text for the exporter
    
    Inputs:
    ------------
    outfile
        A name for the pdf file to be written to
    clip
        A clipboard object
    intext
        A string containing information to be put on the first page.
        
    
    Takes a clipboard, clip, and create plots
    put these plots all into one multi paged document
    specifieed by outfile
    """

    plt.ioff()
    dotperinch = 120
    figuresize = (11, 8)
    # The PDF document
    pdfout = outfile + ".pdf"
    pdf_pages = PdfPages(pdfout)
    # Create a figure instance (ie. a new page)
    # pdf_pages.attach_note(('KIC %u   [%u]' % (clip.value, clip.disposition.isCandidate)),positionRect=[100,200,10,400])

    fig = plt.figure(1, figsize=figuresize, dpi=dotperinch)

    plt.figtext(0.2, 0.85, intext, color="r", fontsize=15)
    plt.figtext(0.15, 0.2, clip.disposition, color="b", fontsize=14)
    plt.title("Disposition Information for EPIC %u" % clip["value"])

    if clip.disposition.isSignificantEvent:
        steltxt = clip.get("stellar", defaultValue="No Stellar Available")
        plt.figtext(0.7, 0.3, steltxt)
        plantxt = clip.get("planet", defaultValue="No Planet Param. Avail.")
        plt.figtext(0.7, 0.2, plantxt)

    fig.patch.set_visible(False)
    plt.gca().axis("off")
    plt.savefig(pdf_pages, format="pdf")
    outname = "%s-%s.%s" % (outfile, "info", figtype)

    plt.savefig(outname)
    plt.close()

    fig = plt.figure(1, figsize=figuresize, dpi=dotperinch)
    # Plot whatever you wish to plot
    pp.summaryPlot1(clip)
    # Done with the page
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "summary", figtype)
    fig.savefig(outname)
    plt.close()

    fig = plt.figure(figsize=figuresize, dpi=dotperinch)
    # Plot whatever you wish to plot
    pp.plotData(clip, nPanel=3)
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "data", figtype)
    fig.savefig(outname)
    plt.close()

    fig = plt.figure(figsize=figuresize, dpi=dotperinch)
    pp.indivTransitPlot(clip, 6)
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "indiv", figtype)
    plt.savefig(outname)
    plt.close()

    try:
        fig = plt.figure(figsize=figuresize, dpi=dotperinch)
        pp.blsPlot(clip)
        pdf_pages.savefig()
        outname = "%s-%s.%s" % (outfile, "bls", figtype)
        plt.savefig(outname)
        plt.close()
    except AttributeError:
        pass

    try:
        # Plot centroid plots
        (fig2, fig1) = dip.plotWrapper(clip)
    except:
        fig1 = plt.plot()
        fig2 = plt.plot()

    fig1.set_size_inches(figuresize)
    pdf_pages.savefig(fig1, dpi=dotperinch)
    outname = "%s-%s.%s" % (outfile, "cent1", figtype)
    fig1.savefig(outname)
    fig2.set_size_inches(figuresize)
    pdf_pages.savefig(fig2, dpi=dotperinch)
    outname = "%s-%s.%s" % (outfile, "cent2", figtype)
    fig2.savefig(outname)
    plt.close()

    fig = plt.figure(figsize=figuresize, dpi=dotperinch)
    pp.lppDiagnostic(clip)
    pdf_pages.savefig()
    outname = "%s-%s.%s" % (outfile, "lpp", figtype)
    plt.savefig(outname)
    plt.close()

    # Write the PDF document to the disk
    pdf_pages.close()

    plt.close()