class workfile(Analysis.AnalyseFile,SP.PlotFile): """A class that combines AnalyseFile and PlotFile together""" pass def func(x): return numpy.mean(x) def quad(x,a,b,c,d): return (a*x**4)+(b*x**2)+(c*x)+d Seperation = {1:'325 nm',2:'425 nm',3:'525 nm',4:'625 nm', 5:'725 nm', 6:'925 nm',7:'1125 nm', 8:'1325 nm', 9:'1525 nm',} ### Read in Data ### pattern = '*DeltaRsvsT.txt' folder = DataFolder('/Volumes/stonerlab.leeds.ac.uk - -storage/data/Projects/Spincurrents/Joe Batley/Measurements/SC004/Transport/DeltaRvsT',pattern = pattern,type=workfile) folder.sort('Sample ID') plot = [2,4,6,7] for Rs in folder: if int(Rs['Sample ID'].split('_')[1]) in plot: print Rs.column_headers Rs.template=SPF.JTBPlotStyle Rs.figure(1) # Creating new figures like this means we don;t reuse windows from run to run f=plt.gcf() f.set_size_inches((5.5,3.75),forward=True) # Set for A4 - will make wrapper for this someday #Rs.title = '' label = Seperation[int(Rs['Sample ID'].split('_')[1])] Rs.plot_xy("T","Voff",label =label ,linestyle='',marker='o',linewidth=2,markersize=5) #Rs.ylabel = r"$\Delta R_s$ (mV/A)" Rs.ylabel=r"$\frac{R_{s}^P + R_{s}^{AP}}{2}\ $ (mV/A)" Rs.xlabel=r"T (K)"
9:'1525 nm',} Marker = {1:'325 nm', 2:'o', 3:'x', 4:'s', 5:'v', 6:'^', 7:'>', 8:'D', 9:'<',} pattern = '*_DeltaRvsT.txt' folder = DataFolder('/Volumes/data/Projects/Spincurrents/Joe Batley/Measurements/SC004/Transport/DeltaR_vs_Sep/Plot',pattern = pattern) folder.sort() for f in folder: f=Analysis.AnalyseFile(f) print f.column_headers f.rename('DeltaR err','Error') f.rename('Sample Temp','Temperature (K)') f.mulitply('DeltaR',1e3,replace=True,header=r'$\Delta \alpha$ (mV/A)') pattern = re.compile('_') label = pattern.split(f['Sample ID']) p=SP.PlotFile(f) p.setas="y.x" p.template=SPF.JTBPlotStyle
import Stoner.Plot as SP def quad(x,a,b,c): return (a*x**2)+(b*x)+c folder = DataFolder('/Volumes/data/Projects/Spincurrents/Joe Batley/Measurements/SC004/Transport/SC004_2_T/NLIVvsHat5K', pattern = '*.txt') ############ Calculate Delta R with error ############ Rs = [] F = [] folder.sort('iterator') for f in folder: a = Analysis.AnalyseFile(f) fit = a.curve_fit(quad,'Current','Voltage',p0=[20.0,1e-7,0.0], result=True, replace=False, header="fit",asrow=True) Rs.append(fit[2]) F.append(a['Magnet Output']*1e-12) Mean = (max(Rs)+min(Rs))/2 offset = (max(Rs)+min(Rs))/2 RS = Analysis.AnalyseFile() RS.add_column(F,r'$\mu_o$H (mT)') RS.add_column(Rs,'R$_s$ (V/A)') RS.subtract('R$_s$ (V/A)',offset,replace=True,header=r'$\alpha$ (V/A)') RS.mulitply(r'$\alpha$ (V/A)',1e3,replace=True,header=r'$\alpha$ (mV/A)')