diff --git a/Plotting/NanoporePlots.py b/Plotting/NanoporePlots.py index 34bcc75..deae0df 100644 --- a/Plotting/NanoporePlots.py +++ b/Plotting/NanoporePlots.py @@ -1,80 +1,80 @@ import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import EngFormatter Amp = EngFormatter(unit='A', places=2) Time = EngFormatter(unit='s', places=2) Volt = EngFormatter(unit='V', places=2) def PlotI_tau(current,tau): # definitions for the axes left, width = 0.1, 0.6 bottom, height = 0.1, 0.6 bottom_h = left_h = left + width + 0.05 rect_scatter = [left, bottom, width, height] rect_histx = [left, bottom_h, width, 0.2] rect_histy = [left_h, bottom, 0.2, height] # start with a rectangular Figure plt.figure(1, figsize=(8, 8)) axScatter = plt.axes(rect_scatter) axHistx = plt.axes(rect_histx) axHisty = plt.axes(rect_histy) # the scatter plot: axScatter.scatter(tau, current) # now determine nice limits by hand: extra = 0.1 #0.1 = 10% tauRange=np.max(tau)-np.min(tau) currentClean=[x for x in current if str(x)!= 'nan'] currentRange=np.max(currentClean)-np.min(currentClean) # # tauLim = (int(tauMax/binwidth) + 1) * binwidth # currentLim = (int(currentMax/binwidth) + 1) * binwidth axScatter.set_xlim((np.min(tau)-extra*tauRange, np.max(tau)+extra*tauRange)) axScatter.set_ylim((np.min(currentClean)-extra*currentRange, np.max(currentClean)+extra*currentRange)) #tauBins = np.arange(-tauLim, tauLim + binwidth, binwidth) #currentBins = np.arange(-currentLim, currentLim + binwidth, binwidth) axHistx.hist(tau, bins=10) axHisty.hist(currentClean, bins=10, orientation='horizontal') axHistx.set_xlim(axScatter.get_xlim()) axHisty.set_ylim(axScatter.get_ylim()) axScatter.set_xlabel('Event length (s)') - axScatter.set_ylabel('current drop (A + axScatter.set_ylabel('current drop (A)') axScatter.xaxis.set_major_formatter(Time) axScatter.yaxis.set_major_formatter(Amp) plt.show() def PlotCurrentTrace(currentTrace,samplerate): timeVals=np.linspace(0, len(currentTrace)/samplerate, num=len(currentTrace)) plt.figure(figsize=(10, 6)) plt.plot(timeVals,currentTrace) plt.xlabel('time (s)') plt.ylabel('current (A)') plt.show() def PlotCurrentTraceBaseline(before,currentTrace,after,samplerate): timeVals1=np.linspace(0, len(before)/samplerate, num=len(before)) timeVals2=np.linspace(0+max(timeVals1), len(currentTrace)/samplerate+max(timeVals1), num=len(currentTrace)) timeVals3=np.linspace(0+max(timeVals2), len(after)/samplerate+max(timeVals2), num=len(after)) plt.figure(figsize=(10, 6)) plt.plot(timeVals1,before,color='red') plt.plot(timeVals2,currentTrace) plt.plot(timeVals3,after,color='red') plt.xlabel('time (s)') plt.ylabel('current (A)') plt.show() diff --git a/TraceAnalysis.py b/TraceAnalysis.py index 0f1dc1a..63e2efb 100644 --- a/TraceAnalysis.py +++ b/TraceAnalysis.py @@ -1,30 +1,36 @@ import numpy as np from pprint import pprint import EventDetectionJD as ED import matplotlib.pyplot as plt from Plotting.NanoporePlots import PlotI_tau from tkinter.filedialog import askopenfilenames,askdirectory +import os #Parameters coefficients = {} -coefficients = {'a': 0.999, 'E': 0, 'S': 4, 'eventlengthLimit': 0.5,'minEventLength': 0} +coefficients = {'a': 0.99, 'E': 0, 'S': 4, 'eventlengthLimit': 0.5,'minEventLength': 0} #folder = '/mnt/lben-archive/2018 - CURRENT/Jochem/Chimera/2018-07-02/30nmPDMA-MTase' #file='30nmPDMA_20180702_152228.log' -#folder='Z:\lben-commun\2018 User Data\Mike\Raw data\7.August\20180809\P23_1MKClboth_Pyrene_TL_200mV' -folder = askdirectory() +folder='//mnt/lben/lben-commun/2018 User Data/Mike/Raw data/7.August/20180809/P23_1MKClboth_Pyrene_TL_200mV' +file='P23_1MKClboth_Pyrene_TL_20180809_005537.log' +#file='P23_1MKClboth_Pyrene_TL_20180809_012433.log' +#folder = askdirectory() -TranslocationEvents=ED.batcheventdetection(folder,'*.log',coefficients) -TranslocationEvents.SaveEvents(folder) +#TranslocationEvents=ED.batcheventdetection(folder,'*.log',coefficients) +#TranslocationEvents.SaveEvents(folder) + +test=ED.eventdetection(os.path.join(folder, file), coefficients) +test.PlotAllEvents() #TranslocationEvents=ED.LoadEvents(folder) -LengthList=TranslocationEvents.GetAllLengths() -meanIDrop=TranslocationEvents.GetAllIdrops() -PlotI_tau(meanIDrop,LengthList) +#LengthList=TranslocationEvents.GetAllLengths() +#meanIDrop=TranslocationEvents.GetAllIdrops() +#PlotI_tau(meanIDrop,LengthList) #Newevents=TranslocationEvents.GetEventsMinCondition(-1,1.5e-11,0.01,[]) #Newevents.PlotAllEvents()