def testWsf(self): fileName = 'ucsb_100mK_24db_1.txt' wsf = WideSweepFile(fileName) wsf.fitSpline() wsf.findPeaks() fig,ax = plt.subplots(2) ax[0].plot(wsf.x,wsf.mag,label='mag') ax[0].set_xlabel("frequency") ax[0].set_ylabel("magnitude") ax[0].legend() ax[1].plot(wsf.x,wsf.mag,label='mag') ax[1].set_xlabel("frequency") ax[1].set_ylabel("magnitude") ax[1].legend().get_frame().set_alpha(0.5) xmin = 5.0 xmax = 5.012 ax[1].set_xlim(xmin, xmax) for peak in wsf.peaks: x = wsf.x[peak] if x > xmin and x < xmax: ax[1].axvline(x=x,color='r') plt.savefig("testWsf.png")
def testFitSpline(self): fileName = 'ucsb_100mK_24db_1.txt' wsf = WideSweepFile(fileName) plt.plot(wsf.x,wsf.mag,label='mag') for splineS in [1,0.9,0.5,0.3]: wsf.fitSpline(splineS=splineS) plt.plot(wsf.x,wsf.baseline,label='s=%f'%splineS) xmin = 3.25 xmax = 3.27 plt.xlim(xmin,xmax) plt.legend().get_frame().set_alpha(0.5) plt.savefig("testFitSpline.png")
def testFilter2(self): fileName = 'ucsb_100mK_24db_1.txt' wsf = WideSweepFile(fileName) fig,ax = plt.subplots() ax.plot(wsf.x,wsf.mag,label='mag') wsf.fitFilter(wn=0.1) ax.plot(wsf.x,wsf.baseline,label='filtered baseline wn=0.1') wsf.fitFilter(wn=0.5) ax.plot(wsf.x,wsf.baseline,label='filtered baseline wn=0.5') wsf.fitSpline() ax.plot(wsf.x,wsf.baseline,label='spline baseline') xmin = 3.293 xmax = 3.294 ax.set_xlim(xmin,xmax) ax.legend().get_frame().set_alpha(0.5) plt.savefig("testFilter2.png")
def testFits(self): fileName = 'ucsb_100mK_24db_1.txt' wsf = WideSweepFile(fileName) fig,ax = plt.subplots() ax.plot(wsf.x,wsf.mag,label='mag') for wn in [0.001, 0.01, 0.1]: wsf.fitFilter(wn=wn) ax.plot(wsf.x,wsf.baseline,label='filtered baseline wn=%0.3f'%wn) wsf.fitSpline() ax.plot(wsf.x,wsf.baseline,label='spline baseline') #xmin = 3.356 #xmax = 3.357 xmin = 3.25 xmax = 3.27 ax.set_xlim(xmin,xmax) ax.legend().get_frame().set_alpha(0.5) plt.savefig("testFits.png")