Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abalijepalli committed Aug 7, 2013
1 parent d97a31d commit ad86527
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
1 change: 1 addition & 0 deletions eventSegment.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ def __checkdrift(self, curr):
self.windowOpenCurrentSD=sd
self.windowOpenCurrentSlope=sl

#@profile
def __eventsegment(self):
"""
Cut up a trajectory into individual events. This algorithm uses
Expand Down
14 changes: 10 additions & 4 deletions stepResponseAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import metaEventProcessor
import util
import sys
import math

import numpy as np
import scipy.optimize
Expand Down Expand Up @@ -131,7 +132,8 @@ def formatsettings(self):
fmtstr+='Algorithm = {0}\n\n'.format(self.__class__.__name__)

fmtstr+='\t\tMax. iterations = {0}\n'.format(self.FitIters)
fmtstr+='\t\tFit tolerance (rel. err in leastsq) = {0}\n\n'.format(self.FitTol)
fmtstr+='\t\tFit tolerance (rel. err in leastsq) = {0}\n'.format(self.FitTol)
fmtstr+='\t\tBlockade Depth Rejection = {0}\n\n'.format(self.BlockRejectRatio)


return fmtstr
Expand Down Expand Up @@ -186,9 +188,13 @@ def __FitEvent(self):

self.mdRedChiSq = optfit.chisqr/( np.var(optfit.residual) * (len(self.eventData) - optfit.nvarys -1) )

if self.mdBlockDepth > self.BlockRejectRatio:
# print 'eBlockDepthHigh', optfit.params['b'].value, optfit.params['b'].value - optfit.params['a'].value, optfit.params['mu1'].value, optfit.params['mu2'].value
self.rejectEvent('eBlockDepthHigh')
# if self.mdBlockDepth > self.BlockRejectRatio:
# # print 'eBlockDepthHigh', optfit.params['b'].value, optfit.params['b'].value - optfit.params['a'].value, optfit.params['mu1'].value, optfit.params['mu2'].value
# self.rejectEvent('eBlockDepthHigh')

if math.isnan(self.mdRedChiSq):
self.rejectEvent('eInvalidFitParams')

#print i0, i0sig, [optfit.params['a'].value, optfit.params['b'].value, optfit.params['mu1'].value, optfit.params['mu2'].value, optfit.params['tau'].value]
else:
#print optfit.message, optfit.lmdif_message
Expand Down
27 changes: 14 additions & 13 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@


# raw_input("Enter to continue")

# SingleChannelAnalysis.SingleChannelAnalysis(
# abfTrajIO(fnames=['/Volumes/DATA/tetheredPEG/13712018_peg2k.abf']),
# es.eventSegment,
# sra.stepResponseAnalysis
# ).Run()
# dirname='/Volumes/DATA/tetheredPEG/20130716/',filter='*abf'
SingleChannelAnalysis.SingleChannelAnalysis(
abfTrajIO(fnames=['/Users/balijepalliak/Desktop/peg2k/first hour/13730039_001.abf', '/Users/balijepalliak/Desktop/peg2k/first hour/13730039_002.abf']),
es.eventSegment,
sra.stepResponseAnalysis
).Run()

#'set3','set4','set5',
# [ SingleChannelAnalysis.SingleChannelAnalysis(
Expand All @@ -66,21 +66,22 @@ def analysisiter(dir, filt, i):
).Run()

os.rename(dir+'/eventMD.tsv', dir+'/eventMD_'+str(i).zfill(2)+'.tsv')
#os.rename(dir+'/eventTS.csv', dir+'/eventTS_'+str(i).zfill(2)+'.csv')
os.rename(dir+'/eventTS.csv', dir+'/eventTS_'+str(i).zfill(2)+'.csv')
os.rename(dir+'/eventProcessing.log', dir+'/eventProcessing'+str(i).zfill(2)+'.log')
except MemoryError, e:
print "memory exceeded: ", e
pass



#[ analysisiter('/Volumes/DATA/PRL Data/EBSPEG600/20130627/m40mV2/', '*-'+str(i).zfill(2)+'??.qdf', i) for i in range(10, 11) ]
#[ analysisiter('/Volumes/DATA/PRL Data/EBSPEG600/20130722/m40mV8/', '*-'+str(i).zfill(2)+'??.qdf', i) for i in range(100, 101) ]
# [ analysisiter('/Volumes/DATA/PRL Data/EBSPEG600/20130723/m40mV2/', '*-'+str(i).zfill(2)+'??.qdf', i) for i in range(10, 11) ]

SingleChannelAnalysis.SingleChannelAnalysis(
qdfTrajIO(dirname='/Volumes/DATA/PRL Data/EBSPEG600/20130715/m40mV/', filter='*qdf', nfiles=150, Rfb=9.1E+9, Cfb=1.07E-12),
es.eventSegment,
sra.stepResponseAnalysis
).Run()
# SingleChannelAnalysis.SingleChannelAnalysis(
# qdfTrajIO(dirname='/Volumes/DATA/PRL Data/EBSPEG600/20130717/m40mV2/', filter='*qdf', nfiles=325, Rfb=9.1E+9, Cfb=1.07E-12),
# es.eventSegment,
# sra.stepResponseAnalysis
# ).Run()

# print ['*-'+str(i).zfill(2)+'??.qdf' for i in range(1,15)]

Expand Down

0 comments on commit ad86527

Please sign in to comment.