def runTestCase(self, datfile, prmfile, eventPartHnd, parallel): prm=testutil.readparams(prmfile) dat=tsvTrajIO(fnames=[datfile], Fs=prm['Fs'], separator=',') # sett=json.loads( "".join((open('../../.settings', 'r').readlines())) ) sett = (settings.settings('.', defaultwarn=False).settingsDict) epartsettings = sett[eventPartHnd.__name__] epartsettings['blockSizeSec'] = 0.006 epartsettings['meanOpenCurr'] = 1 epartsettings['sdOpenCurr'] = 0.03 epartsettings['slopeOpenCurr'] = 0 epartsettings['driftThreshold'] = 1000 epartsettings['maxDriftRate'] = 9999.0 epartsettings['eventThreshold'] = 5.0 if parallel: epartsettings['parallelProc'] = 1 testobj=eventPartHnd( dat, sra.stepResponseAnalysis, epartsettings, sett["stepResponseAnalysis"], json.dumps(sett, indent=4) ) testobj.PartitionEvents() self.assertEqual( testobj.eventcount, prm['nevents'] ) testobj.Stop() for f in glob.glob('testdata/*.sqlite'): os.remove(f)
def _setupTestCase(self, datfile, prmfile, algoHnd): [self.Fs, self.dat]=testutil.readcsv(datfile) self.prm=testutil.readparams(prmfile) self.sett = (settings.settings('.', defaultwarn=False).settingsDict)[algoHnd.__name__] self.dt=int(1e6/self.dat[0])
def run_eventpartition(dataPath, trajDataHnd, dataFilterHnd, eventPartHnd, eventProcHnd, dbFilename): # Read and parse the settings file settingsdict = settings.settings(dataPath) # Pull out trajectory settings to construct an IO object trajSettings = settingsdict.getSettings(trajDataHnd.__name__) if dataFilterHnd: trajDataObj = trajDataHnd(datafilter=dataFilterHnd, dirname=dataPath, **trajSettings) else: trajDataObj = trajDataHnd(dirname=dataPath, **trajSettings) if dbFilename == '': kwargs = {} else: kwargs = {'dbFilename': dataPath + '/' + dbFilename} try: with eventPartHnd(trajDataObj, eventProcHnd, settingsdict.getSettings(eventPartHnd.__name__), settingsdict.getSettings(eventProcHnd.__name__), json.dumps(settingsdict.settingsDict, indent=4), **kwargs) as EventPartition: EventPartition.PartitionEvents() except KeyboardInterrupt: raise
def runTestCase(self, datfile, prmfile, eventPartHnd, parallel): prm=testutil.readparams(prmfile) dat=tsvTrajIO(fnames=[datfile], Fs=prm['Fs'], separator=',') sett = (settings.settings('.', defaultwarn=False).settingsDict) epartsettings = sett[eventPartHnd.__name__] epartsettings['blockSizeSec'] = 0.006 epartsettings['meanOpenCurr'] = 1 epartsettings['sdOpenCurr'] = 0.03 epartsettings['slopeOpenCurr'] = 0 epartsettings['driftThreshold'] = 1000 epartsettings['maxDriftRate'] = 9999.0 epartsettings['eventThreshold'] = 5.0 if parallel: epartsettings['parallelProc'] = 1 testobj=eventPartHnd( dat, a2s.adept2State, epartsettings, sett["adept2State"], json.dumps(sett, indent=4) ) testobj.PartitionEvents() assert testobj.eventcount == prm['nevents'] testobj.Stop() for f in glob.glob('testdata/*.sqlite'): os.remove(f)
def run_eventpartition( dataPath, trajDataHnd, dataFilterHnd, eventPartHnd, eventProcHnd, dbFilename): # Read and parse the settings file settingsdict=settings.settings( dataPath ) # Pull out trajectory settings to construct an IO object trajSettings=settingsdict.getSettings(trajDataHnd.__name__) if dataFilterHnd: trajDataObj=trajDataHnd( datafilter=dataFilterHnd, dirname=dataPath, **trajSettings ) else: trajDataObj=trajDataHnd( dirname=dataPath, **trajSettings ) if dbFilename=='': kwargs={} else: kwargs={'dbFilename': dataPath+'/'+dbFilename} try: with eventPartHnd( trajDataObj, eventProcHnd, settingsdict.getSettings(eventPartHnd.__name__), settingsdict.getSettings(eventProcHnd.__name__), json.dumps(settingsdict.settingsDict, indent=4), **kwargs ) as EventPartition: EventPartition.PartitionEvents() except KeyboardInterrupt: raise
def _setupDataFilter(self): filtsettings=settings.settings( self.datPath ).getSettings(self.datafilter.__name__) if filtsettings=={}: self.logger.warning("WARNING: No settings found for '{0}'. Data filtering is disabled".format(str(self.datafilter.__name__))) self.dataFilter=False return return self.datafilter(**filtsettings)
def _loadSettings(self, **kwargs): try: self.analysisSettingsDict = json.loads(kwargs['settingsString']) self.defaultSettings = False except KeyError: sObj = settings.settings(self.dataPath) self.analysisSettingsDict = sObj.settingsDict self.defaultSettings = sObj.defaultSettingsLoaded
def _loadSettings(self, **kwargs): try: self.analysisSettingsDict=json.loads(kwargs['settingsString']) self.defaultSettings=False except KeyError: sObj=settings.settings(self.dataPath) self.analysisSettingsDict=sObj.settingsDict self.defaultSettings=sObj.defaultSettingsLoaded
def _setupTestCase(self, datfile, prmfile, algoHnd): self.dat=testutil.readDataRAW(datfile) self.prm=testutil.readParametersJSON(prmfile) self.Fs=int(self.prm['FsKHz']*1000) self.dt=1./self.prm['FsKHz'] self.noiseRMS=self.prm['noisefArtHz']*np.sqrt(self.prm['BkHz']*1000.)/1000. self.sett = (settings.settings('.', defaultwarn=False).settingsDict)[algoHnd.__name__]
def runTestCase(self, datfile, prmfile, algoHnd): self.dat=testutil.readcsv(datfile) self.prm=testutil.readparams(prmfile) sett = (settings.settings('.', defaultwarn=False).settingsDict)[algoHnd.__name__] dt=int(1e6/self.dat[0]) self.testobj=algoHnd( self.dat[1], self.dat[0], eventstart=int(self.prm['tau1']/dt), # event start point eventend=int(self.prm['tau2']/dt), # event end point baselinestats=[ 1.0, 0.01, 0.0 ], algosettingsdict=sett, savets=0, absdatidx=0.0, datafileHnd=None ) self.testobj.processEvent()