def __init__(self, trajDataObj, eventProcHnd, eventPartitionSettings, eventProcSettings, settingsString):
		"""
			Initialize a new event segment object
		"""
		# Required arguments
		self.trajDataObj=trajDataObj
		self.eventProcHnd=eventProcHnd

		# Reset function timer since esTimer is a class variable
		partitionTimer.Reset()	

		self.settingsDict = eventPartitionSettings 
		self.eventProcSettingsDict = eventProcSettings

		self.procTime=0.0
		self.FsHz=self.trajDataObj.FsHz
		self.DataLengthSec=self.trajDataObj.DataLengthSec

		try:
			self.writeEventTS=int(self.settingsDict.pop("writeEventTS",1))
			self.parallelProc=int(self.settingsDict.pop("parallelProc",1))
			self.reserveNCPU=int(self.settingsDict.pop("reserveNCPU",2))
		except ValueError as err:
			raise mosaic.commonExceptions.SettingsTypeError( err )

		sys.stdout.flush()

		self.tEventProcObj=self.eventProcHnd([], self.FsHz, eventstart=0,eventend=0, baselinestats=[ 0,0,0 ], algosettingsdict=self.eventProcSettingsDict.copy(), savets=False, absdatidx=0, datafileHnd=None )

		self.mdioDBHnd=sqlite3MDIO.sqlite3MDIO()
		self.mdioDBHnd.initDB(
								dbPath=self.trajDataObj.datPath, 
								tableName='metadata',
								colNames=(self.tEventProcObj.mdHeadings()),
								colNames_t=(self.tEventProcObj.mdHeadingDataType())
							)
		self.mdioDBHnd.writeSettings(settingsString)

		self.logger=mlog.mosaicLogging().getLogger(name=__name__, dbHnd=self.mdioDBHnd)
		self.logger.debug(_d("Event Segment Initialization"))
		self.logger.debug(_d("{0}", settingsString))

		if self.trajDataObj.dataFilter:
			self.fstring=type(self.trajDataObj.dataFilterObj).__name__
		else:
			self.fstring='None'

		self._writeanalysisinfo()

		if self.parallelProc:
			self._setupparallel()

		# Setup function timing
		self.timingObj=mosaicTiming.mosaicTiming()

		self._init(trajDataObj, eventProcHnd, eventPartitionSettings, eventProcSettings)
Exemple #2
0
	def __init__(self, parent = None):
		self.v=[]

		super(BlockDepthWindow, self).__init__(parent)

		uic.loadUi(resource_path("blockdepthview.ui"), self)

		self._positionWindow()

		self.time=mosaicTiming.mosaicTiming()

		self.queryInterval=5
		self.lastQueryTime=round(self.time.time())

		self.idleTimer=QtCore.QTimer()
		self.idleTimer.start(3000)

		self.queryString="select BlockDepth from metadata where ProcessingStatus='normal'and ResTime > 0.025"
		self.queryData=[]
		self.queryError=False
		self.lastGoodQueryString=""
		self.queryRunning=False

		self.qWorker=None
		self.qThread=QtCore.QThread()

		self.queryCompleter=None

		self.updateDataOnIdle=True

		self.nBins=500
		self.binsSpinBox.setValue(self.nBins)

		# Set the default text in the Filter LineEdit
		self.sqlQueryLineEdit.setCompleterValues([])
		self.sqlQueryLineEdit.setText("ResTime > 0.025")

		self.maxLevel=5
		self.levelHorizontalSlider.setValue(self.maxLevel)

		# add a status bar
		sb=QtGui.QStatusBar()
		self.statusBarHorizontalLayout.addWidget(sb)
		self.statusBarHorizontalLayout.setMargin(0)
		self.statusBarHorizontalLayout.setSpacing(0)

		self.statusbarLine.hide()

		QtCore.QObject.connect(self.updateButton, QtCore.SIGNAL('clicked()'), self.OnUpdateButton)
		QtCore.QObject.connect(self.sqlQueryLineEdit, QtCore.SIGNAL('textChanged ( const QString & )'), self.OnQueryTextChange)
		QtCore.QObject.connect(self.binsSpinBox, QtCore.SIGNAL('valueChanged ( int )'), self.OnBinsChange)
		QtCore.QObject.connect(self.levelHorizontalSlider, QtCore.SIGNAL('valueChanged ( int )'), self.OnlevelSliderChange)
		QtCore.QObject.connect(self.peakDetectCheckBox, QtCore.SIGNAL('clicked(bool)'), self.OnPeakDetect)
	def __init__(self, icurr, icurrU, Fs, **kwargs):
		"""
			Store a ref to the raw event data.
			
		"""
		self.eventData=icurr
		self.eventDataU=icurrU
		self.Fs=Fs

		self.logger=mlog.mosaicLogging().getLogger(name=__name__)

		# Will throw a key error if not passed
		self.eStartEstimate=kwargs['eventstart']
		self.eEndEstimate=kwargs['eventend']

		self.settingsDict=kwargs['algosettingsdict']

		self.absDataStartIndex=kwargs['absdatidx']

		[ self.baseMean, self.baseSD, self.baseSlope ]=kwargs['baselinestats']

		self.saveTS=kwargs['savets']
		
		# Optional args. If dataFileHnd is not passed at init, it must be set later
		# If not set before WriteEvent is called, it will result in a MissingMDIOError
		self.dataFileHnd=kwargs.pop("datafilehnd", None)
		# self.dataFileHnd=kwargs['datafileHnd']

		# meta-data attrs that are common to all event processing
		self.mdProcessingStatus='normal'

		# Setup function timing
		self.timingObj=mosaicTiming.mosaicTiming()

		self.mdEventProcessTime=0.0
		# print self.settingsDict
		# Call sub-class initialization
		self._init(**kwargs)
    def __init__(self, icurr, icurrU, Fs, **kwargs):
        """
			Store a ref to the raw event data.
			
		"""
        self.eventData = icurr
        self.eventDataU = icurrU
        self.Fs = Fs

        self.logger = mlog.mosaicLogging().getLogger(name=__name__)

        # Will throw a key error if not passed
        self.eStartEstimate = kwargs['eventstart']
        self.eEndEstimate = kwargs['eventend']

        self.settingsDict = kwargs['algosettingsdict']

        self.absDataStartIndex = kwargs['absdatidx']

        [self.baseMean, self.baseSD, self.baseSlope] = kwargs['baselinestats']

        self.saveTS = kwargs['savets']

        # Optional args. If dataFileHnd is not passed at init, it must be set later
        # If not set before WriteEvent is called, it will result in a MissingMDIOError
        self.dataFileHnd = kwargs.pop("datafilehnd", None)
        # self.dataFileHnd=kwargs['datafileHnd']

        # meta-data attrs that are common to all event processing
        self.mdProcessingStatus = 'normal'

        # Setup function timing
        self.timingObj = mosaicTiming.mosaicTiming()

        self.mdEventProcessTime = 0.0
        # print self.settingsDict
        # Call sub-class initialization
        self._init(**kwargs)
Exemple #5
0
	def __init__(self, trajDataObj, eventProcHnd, eventPartitionSettings, eventProcSettings, settingsString, **kwargs):
		"""
			Initialize a new event segment object
		"""
		# Required arguments
		self.trajDataObj=trajDataObj
		self.eventProcHnd=eventProcHnd

		# Reset function timer since esTimer is a class variable
		partitionTimer.Reset()	

		self.settingsDict = eventPartitionSettings 
		self.eventProcSettingsDict = eventProcSettings

		self.procTime=0.0
		self.FsHz=self.trajDataObj.FsHz
		self.DataLengthSec=self.trajDataObj.DataLengthSec

		try:
			self.writeEventTS=int(self.settingsDict.pop("writeEventTS",1))
			self.parallelProc=int(self.settingsDict.pop("parallelProc",1))
			self.reserveNCPU=int(self.settingsDict.pop("reserveNCPU",2))
			self.driftThreshold=float(self.settingsDict.pop("driftThreshold",2.0))
			self.maxDriftRate=float(self.settingsDict.pop("maxDriftRate",2.0))
			self.minBaseline=float(self.settingsDict.pop("minBaseline",-1.))
			self.maxBaseline=float(self.settingsDict.pop("maxBaseline",-1.))
		except ValueError as err:
			raise mosaic.commonExceptions.SettingsTypeError( err )

		sys.stdout.flush()

		self.tEventProcObj=self.eventProcHnd([], [], self.FsHz, eventstart=0,eventend=0, baselinestats=[ 0,0,0 ], algosettingsdict=self.eventProcSettingsDict.copy(), savets=False, absdatidx=0, datafileHnd=None )

		self.mdioDBHnd=sqlite3MDIO.sqlite3MDIO()
		self.mdioDBHnd.initDB(
								dbPath=self.trajDataObj.datPath, 
								tableName='metadata',
								colNames=(self.tEventProcObj.mdHeadings()),
								colNames_t=(self.tEventProcObj.mdHeadingDataType()),
								dbFilename=kwargs.get('dbFilename', '')
							)
		self.mdioDBHnd.writeSettings(settingsString)

		self.logger=mlog.mosaicLogging().getLogger(name=__name__, dbHnd=self.mdioDBHnd)
		self.logger.debug(_d("Event Segment Initialization"))
		self.logger.debug(_d("{0}", settingsString))

		if self.trajDataObj.dataFilter:
			self.fstring=type(self.trajDataObj.dataFilterObj).__name__
		else:
			self.fstring='None'

		self._writeanalysisinfo()

		if self.parallelProc:
			self._setupparallel()

		# Setup function timing
		self.timingObj=mosaicTiming.mosaicTiming()

		self._init(trajDataObj, eventProcHnd, eventPartitionSettings, eventProcSettings)
Exemple #6
0
import scipy.stats
import uncertainties
from  collections import deque

import mosaic.commonExceptions
import mosaic.trajio.metaTrajIO as metaTrajIO
import mosaic.mdio.sqlite3MDIO as sqlite3MDIO
from mosaic.utilities.resource_path import format_path
from mosaic.utilities.ionic_current_stats import OpenCurrentDist
import mosaic.utilities.mosaicTiming as mosaicTiming
import mosaic.utilities.mosaicLogging as mlog
from mosaic.utilities.mosaicLogFormat import _d

__all__ = ["metaEventPartition", "ExcessiveDriftError", "DriftRateError"]

partitionTimer=mosaicTiming.mosaicTiming()

# custom errors
class ExcessiveDriftError(Exception):
	pass

class DriftRateError(Exception):
	pass

class metaEventPartition(object):
	"""
		.. warning:: |metaclass|

		A class to abstract partitioning individual events. Once a single 
		molecule event is identified, it is handed off to to an event processor.
		If parallel processing is requested, detailed event processing will commence
Exemple #7
0
    pass


class SamplingRateChangedError(Exception):
    pass


class EmptyDataPipeError(Exception):
    pass


class FileNotFoundError(Exception):
    pass


trajTimer = mtime.mosaicTiming()

ignorelist = ["eventProcessing*.log", "*.sqlite"]


class metaTrajIO(object):
    """
			.. warning:: |metaclass|

			Initialize a TrajIO object. The object can load all the data in a directory,
			N files from a directory or from an explicit list of filenames. In addition 
			to the arguments defined below, implementations of this meta class may require 
			the definition of additional arguments. See the documentation of those classes
			for what those may be. For example, the qdfTrajIO implementation of metaTrajIO also requires
			the feedback resistance (Rfb) and feedback capacitance (Cfb) to be passed at initialization.
import scipy.stats
import uncertainties
from  collections import deque

import mosaic.commonExceptions
import mosaic.trajio.metaTrajIO as metaTrajIO
import mosaic.mdio.sqlite3MDIO as sqlite3MDIO
from mosaic.utilities.resource_path import format_path
from mosaic.utilities.ionic_current_stats import OpenCurrentDist
import mosaic.utilities.mosaicTiming as mosaicTiming
import mosaic.utilities.mosaicLogging as mlog
from mosaic.utilities.mosaicLogFormat import _d

__all__ = ["metaEventPartition", "ExcessiveDriftError", "DriftRateError"]

partitionTimer=mosaicTiming.mosaicTiming()

# custom errors
class ExcessiveDriftError(Exception):
	pass

class DriftRateError(Exception):
	pass

class metaEventPartition(object):
	"""
		.. warning:: |metaclass|

		A class to abstract partitioning individual events. Once a single 
		molecule event is identified, it is handed off to to an event processor.
		If parallel processing is requested, detailed event processing will commence
Exemple #9
0
	def __init__(self):
		self.pid=os.getpid()
		
		# Setup function timing
		self.timingObj=mosaicTiming.mosaicTiming()
Exemple #10
0
class IncompatibleArgumentsError(Exception):
	pass
class InsufficientArgumentsError(Exception):
	pass
class IncorrectDataFormat(Exception):
	pass
class EndOfFileError(Exception):
	pass
class SamplingRateChangedError(Exception):
	pass
class EmptyDataPipeError(Exception):
	pass
class FileNotFoundError(Exception):
	pass

trajTimer=mtime.mosaicTiming()

ignorelist=[
		"eventProcessing*.log", 
		"*.sqlite"
	]

class metaTrajIO(object):
	"""
			.. warning:: |metaclass|

			Initialize a TrajIO object. The object can load all the data in a directory,
			N files from a directory or from an explicit list of filenames. In addition 
			to the arguments defined below, implementations of this meta class may require 
			the definition of additional arguments. See the documentation of those classes
			for what those may be. For example, the qdfTrajIO implementation of metaTrajIO also requires
Exemple #11
0
    def __init__(self, parent=None):
        self.v = []

        super(BlockDepthWindow, self).__init__(parent)

        uic.loadUi(resource_path("blockdepthview.ui"), self)

        self._positionWindow()

        self.time = mosaicTiming.mosaicTiming()

        self.queryInterval = 5
        self.lastQueryTime = round(self.time.time())

        self.idleTimer = QtCore.QTimer()
        self.idleTimer.start(3000)

        self.queryString = "select BlockDepth from metadata where ProcessingStatus='normal'and ResTime > 0.025"
        self.queryData = []
        self.queryError = False
        self.lastGoodQueryString = ""
        self.queryRunning = False

        self.qWorker = None
        self.qThread = QtCore.QThread()

        self.queryCompleter = None

        self.updateDataOnIdle = True

        self.nBins = 500
        self.binsSpinBox.setValue(self.nBins)

        # Set the default text in the Filter LineEdit
        self.sqlQueryLineEdit.setCompleterValues([])
        self.sqlQueryLineEdit.setText("ResTime > 0.025")

        self.maxLevel = 5
        self.levelHorizontalSlider.setValue(self.maxLevel)

        # add a status bar
        sb = QtGui.QStatusBar()
        self.statusBarHorizontalLayout.addWidget(sb)
        self.statusBarHorizontalLayout.setMargin(0)
        self.statusBarHorizontalLayout.setSpacing(0)

        self.statusbarLine.hide()

        QtCore.QObject.connect(self.updateButton, QtCore.SIGNAL('clicked()'),
                               self.OnUpdateButton)
        QtCore.QObject.connect(
            self.sqlQueryLineEdit,
            QtCore.SIGNAL('textChanged ( const QString & )'),
            self.OnQueryTextChange)
        QtCore.QObject.connect(self.binsSpinBox,
                               QtCore.SIGNAL('valueChanged ( int )'),
                               self.OnBinsChange)
        QtCore.QObject.connect(self.levelHorizontalSlider,
                               QtCore.SIGNAL('valueChanged ( int )'),
                               self.OnlevelSliderChange)
        QtCore.QObject.connect(self.peakDetectCheckBox,
                               QtCore.SIGNAL('clicked(bool)'),
                               self.OnPeakDetect)
Exemple #12
0
    def __init__(self):
        self.pid = os.getpid()

        # Setup function timing
        self.timingObj = mosaicTiming.mosaicTiming()