Пример #1
0
	def plotImageFigure(self, row):
		"""
		derived from self.plotLcrHist()
		"""

		print('myDualTable.plotImageFigure() row:', row)
		# params from selected row
		dfRow = self.masterDf.iloc[row]
		region = dfRow['region']

		tifPath, abfPath = self._getPathFromRow(row)

		dr = dualAnalysis.dualRecord(tifPath, abfPath)

		# need vm analysis to get peak seconds
		dr._loadAnalyzeAbf_from_df(self.masterDf, row)

		fig, axImg, axLcr = dr.plotFigure9(region=region)

		# fig9 sup/inf
		if region == 'superior':
			print('!!!!********* myDualTable.plotSpikeClip() setting superior xlim() !!!!!!!!!!!')
			axImg.set_xlim(7, 8)
			axLcr.set_ylim(0, 12)
		elif region == 'inferior':
			print('!!!!********* myDualTable.plotSpikeClip() setting superior xlim() !!!!!!!!!!!')
			axImg.set_xlim(5.1, 6.1)
			axLcr.set_ylim(0, 12)

		if fig is not None:
			fig.show()
Пример #2
0
	def plotSpikeClip(self, row, forFig9=False):
		print('myDualTable.plotSpikeClip() row:', row)

		tifPath, abfPath = self._getPathFromRow(row)
		dr = dualAnalysis.dualRecord(tifPath, abfPath)
		# masterDf is backend model loaded from .csv and displayed in table
		fig = dr.plotSpikeClip_df(self.masterDf, row, forFig9=forFig9, myParent=self)

		if fig is not None:
			fig.show()
Пример #3
0
	def myRightClick_LCR(self):
		selectedRow = self.getSelectedRow()
		print('myRightClick_LCR selectedRow:', selectedRow)
		tifFile = self.model.df['tifPath'].loc[selectedRow]
		abfFile = self.model.df['abfPath'].loc[selectedRow]
		print('  plotting tifFile:', tifFile)
		df = self.model.df
		dr = dualAnalysis.dualRecord(tifFile, abfFile)
		dr.new_plotSparkMaster()
		plt.show()
Пример #4
0
	def myPlotPhase(self, rowNumber):
		tifFile = self.model.df['tifPath'].loc[rowNumber]
		abfFile = self.model.df['abfPath'].loc[rowNumber]
		print('  plotting tifFile:', tifFile)
		df = self.model.df
		dr = dualAnalysis.dualRecord(tifFile, abfFile)
		fig = dr.plotSpikeClip_df(df, rowNumber, myParent=self)
		#dr = dualAnalysis.dualRecord(tifFile, abfFile)
		#fig = dr.plotSpikeClip(doPhasePlot=True, fileNumber=rowNumber, myParent=self)
		fig.show()
		return fig
Пример #5
0
	def myRightClickDetection(self):
		rowNumber = self.getSelectedRow()
		tifFile = self.model.df['tifPath'].loc[rowNumber]
		abfFile = self.model.df['abfPath'].loc[rowNumber]
		print('  myRightClickDetection plotting tifFile:', tifFile)
		df = self.model.df
		dr = dualAnalysis.dualRecord(tifFile, abfFile)
		figTif, figAbf = dr.plotSpikeDetection_df(df, rowNumber, myParent=self)
		figTif.show()
		figAbf.show()
		return figTif # todo: fix this
Пример #6
0
	def plotDualDetection(self, row):
		print('myDualTable.plotDualDetection() row:', row)

		# params from selected row
		dfRow = self.masterDf.iloc[row]
		region = dfRow['region']

		tifPath, abfPath = self._getPathFromRow(row)

		dr = dualAnalysis.dualRecord(tifPath, abfPath)
		figTif, figAbf = dr.plotSpikeDetection_df(self.masterDf, row, myParent=self)
		figTif.show()
		figAbf.show()
Пример #7
0
	def plotLcrHist(self, row):
		# params from selected row
		dfRow = self.masterDf.iloc[row]
		region = dfRow['region']

		tifPath, abfPath = self._getPathFromRow(row)
		dr = dualAnalysis.dualRecord(tifPath, abfPath)

		# need vm analysis to get peak seconds
		dr._loadAnalyzeAbf_from_df(self.masterDf, row)

		fig = dr.new_plotSparkMaster(region=region)

		if fig is not None:
			fig.show()
Пример #8
0
	def plotDualRecording(self, row):
		print('myDualTable.plotDualRecording() row:', row)

		# params from selected row
		dfRow = self.masterDf.iloc[row]
		region = dfRow['region']

		tifPath, abfPath = self._getPathFromRow(row)

		print('doAction1()')
		print('   tifPath:', tifPath)
		print('   abfPath:', abfPath)

		dr = dualAnalysis.dualRecord(tifPath, abfPath)

		# works
		fig = dr.myPlot(fileNumber=row, region=region, myParent=self)

		# works
		# masterDf is backend model loaded from .csv and displayed in table
		#fig = dr.plotSpikeClip_df(self.masterDf, row, myParent=self)

		if fig is not None:
			fig.show()
Пример #9
0
	def myPlotRow(self, rowNumber):
		tifFile = self.model.df['tifPath'].loc[rowNumber]
		abfFile = self.model.df['abfPath'].loc[rowNumber]
		region = self.model.df['region'].loc[rowNumber]
		print('  plotting tifFile:', tifFile)
		dr = dualAnalysis.dualRecord(tifFile, abfFile)

		'''
		print('matplotlib.rcsetup.interactive_bk:', matplotlib.rcsetup.interactive_bk)
		print('matplotlib.get_backend()', matplotlib.get_backend())
		matplotlib.use('Qt4Agg',force=True)
		from matplotlib import pyplot as plt
		print('matplotlib.get_backend()', matplotlib.get_backend())
		'''

		fig = dr.myPlot(fileNumber=rowNumber, region=region, myParent=self)
		fig.show()

		'''
		matplotlib.use('TkAgg',force=True)
		from matplotlib import pyplot as plt
		'''

		return fig
Пример #10
0
    def __init__(self, row, df, doVmDetect=True):
        """
		doVmDetect: False to not detect spikes in Vm,
					just step through trace in 500 ms chunks
		"""
        self.row = row
        self.df = df
        self.doVmDetect = doVmDetect

        # used with (not doVmDetect)
        self.endOfCurrentWindow = None
        self.noDetectWindowWidth_sec = 1

        # ms to bin lcr to make hist CRITICAL PARAMETER
        self.tifBins_ms = 50  #10
        self.vmBinSeconds = 0.01  # to get avg vm for (lcr, preMv, postMv)

        self.region = self.df['region'].loc[row]
        self.cellNumber = self.df['cell number'].loc[row]
        self.trial = self.df['trial'].loc[row]

        self.spikeNumber = None  # zoom to spike with (left, right)
        self.lcrNum = None  # to step through existing lcr
        # and then set corresponding Vm (pre lcr)

        self.fig = None
        self.axRight2 = None
        self.tPos_offset = None  #has x-axis of lcr(s) shifted wrt delay to start of imaging
        self.lcrAmp = None
        self.lcrBins = None
        self.lastKey = None
        self.selectedLcr = None

        # df to hold results
        self.colList = [
            'idx', 'spikeNum', 'spikeSec', 'lcrSec', 'lcrSum', 'lcrNum',
            'lcrVm', 'preVmSec', 'preVmInt', 'preVmMean', 'postVmSec',
            'postVmInt', 'postVmMean', 'lcrPreDepol', 'lcrPostDepol', 'region',
            'cell number', 'trial', 'tifBins_ms', 'vmBinSeconds', 'tifFile',
            'tifPath'
        ]
        self.printCols = [
            'idx',
            'spikeNum',
            'spikeSec',
            'lcrSec',
            'lcrSum',
            'lcrVm',
            'preVmSec',
            'preVmMean',
            'postVmSec',
            'postVmMean',
            'lcrPreDepol',
            'lcrPostDepol',
            'region',
        ]

        self.dfAnalysis = pd.DataFrame(columns=self.colList)

        tifPath, abfPath = dualAnalysis.getPathFromRow(df, row)

        print('lcrPicker()')
        print('  tifPath:', tifPath)
        print('  abfPath:', abfPath)

        # load dualAnalysis from df(row)
        self.dr = dualAnalysis.dualRecord(tifPath, abfPath)

        # need vm analysis to get peak seconds
        if doVmDetect:
            self.dr._loadAnalyzeAbf_from_df(self.df, self.row)

        # analyze spike

        # plot
        self.fig, self.axs, self.tPos_offset, self.lcrAmp, self.lcrBins, \
         self.axsLcrAnalysisLeft, \
         self.axsLcrAnalysisRight = self.plot()

        self.tifPath = self.dr.abfTif.tifHeader['tif']
        self.tifFile = os.path.split(self.dr.abfTif.tifHeader['tif'])[1]

        self.fig.show()