コード例 #1
0
def rawintensityplot(pklrep):
    #pklrep = '/home/james/files4CSFPA/qbdataioOUTFILES/' + plotfname
    MagXarr, PhaXarr, ReXarr, ImXarr, MagYarr, PhaYarr, ReYarr, ImYarr, vtxcntarr, PixCenX, PixCenY, IntX, IntY, IntT, Ix, Iy, IT, xycoords, filename, freq = RetrieveVars(
        pklrep)
    ######################Total Intensity plot - Normalised
    print("filename : ", filename)
    GPow = GridPowerCalc(pklrep)
    print("max GPow from plot function ", max(GPow))
    plt.figure()
    plt.suptitle('Frequency - {} GHz'.format(freq))
    plt.scatter(xycoords[:, 1],
                xycoords[:, 0],
                c=GPow,
                cmap='jet',
                marker='.',
                s=1)
    plt.axis([-60, 60, -60, 60])
    plt.axis('equal')
    plt.title("Model Power Data", fontsize=10)
    plt.subplots_adjust(bottom=0.1, right=0.8, top=0.9)
    cax = plt.axes([0.85, 0.1, 0.05, 0.8])
    plt.colorbar(cax=cax, label="Intensity (1 W Source)")
    plt.show()
    os.system('spd-say "BING! BING! BING!"')
    return float(max(GPow))
コード例 #2
0
ファイル: CSFPA_plots.py プロジェクト: seamusomurchu/CSFPA
def TotalIntensityPlot(plotfname):
    pklrep = '/home/james/files4CSFPA/qbdataioOUTFILES/' + plotfname
    MagXarr, PhaXarr, ReXarr, ImXarr, MagYarr, PhaYarr, ReYarr, ImYarr, vtxcntarr, PixCenX, PixCenY, IntX, IntY, IntT, Ix, Iy, IT, xycoords, filename = RetrieveVars(
        pklrep)
    ######################Total Intensity plot - Normalised

    TESPower = TESPowerCalc(plotfname)
    GPow = GridPowerCalc(plotfname)

    plt.figure()
    plt.subplot(121)
    plt.scatter(PixCenX * 1000,
                PixCenY * 1000,
                c=TESPower,
                cmap='jet',
                marker='s')
    plt.axis([-60, 60, -60, 60])
    plt.axis('equal')
    plt.title("Bolometers Total Intensity", fontsize=10)
    plt.subplot(122)
    plt.scatter(xycoords[:, 1],
                xycoords[:, 0],
                c=GPow,
                cmap='jet',
                marker='.',
                s=1)
    plt.axis([-60, 60, -60, 60])
    plt.axis('equal')
    plt.title("Model Power Data", fontsize=10)
    plt.subplots_adjust(bottom=0.1, right=0.8, top=0.9)
    cax = plt.axes([0.85, 0.1, 0.05, 0.8])
    plt.colorbar(cax=cax, label="Intensity (1 W Source)")
    plt.show()
    os.system('spd-say "BING! BING! BING!"')
    return
コード例 #3
0
def PoynICompPlot(mpath, gpath):
    #prep MODAL data
    df = pd.read_csv(mpath, sep='\t', header=0)
    garea, parea = GetMODALGridPixArea(mpath)
    #prep GRASP
    MagXarr, PhaXarr, ReXarr, ImXarr, MagYarr, PhaYarr, ReYarr, ImYarr, vtxcntarr, PixCenX, PixCenY, IntX, IntY, IntT, Ix, Iy, IT, xycoords, filename = RetrieveVars(
        gpath)
    gfile = os.path.basename(gpath)
    GPow = GridPowerCalc(gfile)
    #calculate %diff
    comp = ((abs(df.PoynZ * parea) - abs(GPow)) / abs(GPow)) * 100
    #comp = np.isclose(GPow, df.PoynZ*parea, atol=1e-6)
    fourpi = 4 * np.pi
    #do multi plots
    fig = plt.figure(facecolor='xkcd:pale green')
    fig.suptitle("FP Comparison")

    ax1 = fig.add_subplot(221, facecolor='#d8dcd6', aspect='equal')
    ax1.set_title("MODAL FP from Poynting Z")
    sc = ax1.scatter(df.X, df.Y, c=df.PoynZ * parea, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="MODAL Poynting (W)")

    ax2 = fig.add_subplot(222, facecolor='#d8dcd6', aspect='equal')
    ax2.set_title("GRASP FP from Total Intensity")
    sc = ax2.scatter(xycoords[:, 1] * 1000,
                     xycoords[:, 0] * 1000,
                     c=GPow,
                     cmap='jet',
                     marker='.')
    cbar = fig.colorbar(sc, label="GRASP Total Intensity (W)")
    #plot %diff between models
    ax3 = fig.add_subplot(223, facecolor='#d8dcd6', aspect='equal')
    ax3.set_title("Difference between Softwares")
    sc = ax3.scatter(xycoords[:, 1] * 1000,
                     xycoords[:, 0] * 1000,
                     c=comp,
                     cmap='RdPu',
                     marker='.')  #Both useful PiYG & RdPu
    cbar = fig.colorbar(sc, label="Difference")
    #plot histogram of %diff per pixel
    ax4 = fig.add_subplot(224, facecolor='#d8dcd6')
    ax4.set_title("% Difference Histogram")
    n, bins, patches = ax4.hist(comp)
    print "hist data", n, bins, patches
    #calcualte sum of power
    print "Poynting Sum W = ", sum(
        df.PoynZ *
        parea), "% Diff from 1 W = ", ((sum(df.PoynZ * parea) - 1) / 1) * 100
    print "modal values: max, mean ", max(df.PoynZ * parea), np.mean(df.PoynZ *
                                                                     parea)
    print "grasp values: max, mean ", max(GPow), np.mean(GPow)
    return
コード例 #4
0
def GraspFull(gqbfile, gpath):
    #load file
    df = pd.read_csv(gqbfile, sep='\t', header=0)
    #load pkl, and calculate normalised power from total intensity
    gfile = os.path.basename(gpath)
    GPow = GridPowerCalc(gfile)
    #make figure
    fig = plt.figure(facecolor='xkcd:pale green')
    fig.suptitle("Full View of Data")
    #MagX plot
    ax1 = fig.add_subplot(241, facecolor='#d8dcd6', aspect='equal')
    ax1.set_title("Magnitude X")
    sc = ax1.scatter(df.Xpos, df.Ypos, c=df.Xamp, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Mag X")
    #MagY plot
    ax2 = fig.add_subplot(242, facecolor='#d8dcd6', aspect='equal')
    ax2.set_title("Magnitude Y")
    sc = ax2.scatter(df.Xpos, df.Ypos, c=df.Yamp, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Mag Y")
    #Xphase
    ax3 = fig.add_subplot(243, facecolor='#d8dcd6', aspect='equal')
    ax3.set_title("Phase X")
    sc = ax3.scatter(df.Xpos, df.Ypos, c=df.Xpha, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Phase X")
    #yphase
    ax4 = fig.add_subplot(244, facecolor='#d8dcd6', aspect='equal')
    ax4.set_title("Phase Y")
    sc = ax4.scatter(df.Xpos, df.Ypos, c=df.Ypha, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Phase Y")
    #Zamp
    ax5 = fig.add_subplot(245, facecolor='#d8dcd6', aspect='equal')
    ax5.set_title("Magnitude Z")
    sc = ax5.scatter(df.Xpos, df.Ypos, c=df.Zamp, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Mag Z")
    #zphase
    ax6 = fig.add_subplot(246, facecolor='#d8dcd6', aspect='equal')
    ax6.set_title("Phase Z")
    sc = ax6.scatter(df.Xpos, df.Ypos, c=df.Zpha, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Phase Z")
    #normalised total intensity
    ax7 = fig.add_subplot(247, facecolor='#d8dcd6', aspect='equal')
    ax7.set_title("Total Intensity")
    sc = ax7.scatter(df.Xpos, df.Ypos, c=GPow, cmap='jet', marker='.')
    cbar = fig.colorbar(sc, label="Watts")
    return
コード例 #5
0
def TESPowPlot(plotfname):
    rep = '/home/james/files4CSFPA/qbdataioOUTFILES/'
    repfile = rep + plotfname
    #load pickle data
    MagXarr, PhaXarr, ReXarr, ImXarr, MagYarr, PhaYarr, ReYarr, ImYarr, vtxcntarr, PixCenX, PixCenY, IntX, IntY, IntT, Ix, Iy, IT, xycoords, filename = RetrieveVars(
        repfile)
    #load qbdata for TES and Save function
    qbrep = '/home/james/files4CSFPA/Fromqbdataio/'
    qbrepfile = qbrep + filename
    #load TES power array
    TESPower = TESPowerCalc(plotfname)
    GPow = GridPowerCalc(plotfname)
    #plot tes power

    fig = plt.figure(facecolor='xkcd:pale green')
    fig.suptitle("File Analysis: '{}'".format(plotfname), fontsize=12)

    ax1 = fig.add_subplot(221, facecolor='#d8dcd6', aspect='equal')
    ax1.set_title("Bolometers Total Instensity", fontsize=10)
    sc = ax1.scatter(PixCenX, PixCenY, c=TESPower, cmap='jet', marker='s', s=4)
    cbar = fig.colorbar(sc, label="Intensity per Bolometer (W)")

    ax2 = fig.add_subplot(222, facecolor='#d8dcd6', aspect='equal')
    sc = ax2.scatter(xycoords[:, 0],
                     xycoords[:, 1],
                     c=GPow,
                     cmap='jet',
                     marker='.')
    ax2.set_title("RAW Grasp Total Instensity", fontsize=10)
    cbar = fig.colorbar(sc, label="Intensity per GRASP data point (W)")

    ax3 = fig.add_subplot(212, facecolor='#d8dcd6')
    tp = ax3.plot(TESPower, marker='_', linestyle="", markersize=0.75)
    ax3.set_title("TES Detector Power Plot")
    ax3.set_ylabel("Intensity per Bolometer (W)")
    ax3.set_xlabel("TES Bolometer Number (qubicsoft order)")
    ax3.set_xlim(1, 992)

    plt.show()

    #output TES Power to file + use filename for file naming system
    OutputTESPower(TESPower, filename)

    return
コード例 #6
0
def TESPowAnalysis(plotfname):
    pklrep = '/home/james/files4CSFPA/qbdataioOUTFILES/' + plotfname
    MagXarr, PhaXarr, ReXarr, ImXarr, MagYarr, PhaYarr, ReYarr, ImYarr, vtxcntarr, PixCenX, PixCenY, IntX, IntY, IntT, Ix, Iy, IT, xycoords, filename = RetrieveVars(
        pklrep)
    ######################Total Intensity plot - Normalised

    TESPower = TESPowerCalc(plotfname)
    GPow = GridPowerCalc(plotfname)

    plt.figure(facecolor='xkcd:pale green')
    plt.subplot(221, facecolor='#d8dcd6')
    plt.scatter(PixCenX * 1000,
                PixCenY * 1000,
                c=TESPower,
                cmap='jet',
                marker='s',
                s=4)
    plt.axis([-60, 60, -60, 60])
    plt.axis('equal')
    plt.title("{} Bolometers Total Instensity".format(plotfname), fontsize=10)

    plt.subplot(222, facecolor='#d8dcd6')
    plt.scatter(xycoords[:, 0], xycoords[:, 1], c=GPow, cmap='jet', marker='.')
    plt.axis([-60, 60, -60, 60])
    plt.axis('equal')
    plt.title("RAW - {}".format(filename), fontsize=10)

    plt.subplot(212, facecolor='#d8dcd6')
    plt.plot(TESPower, marker='_', linestyle="", markersize=0.75)

    #output TES Power to file
    OutputTESPower(TESPower, filename)

    plt.subplots_adjust(bottom=0.1, right=0.8, top=0.9)
    cax = plt.axes([0.85, 0.1, 0.05, 0.8])
    plt.colorbar(cax=cax, label="Intensity")
    plt.show()
    os.system('spd-say "BING! BING! BING!"')

    return