@@ -4796,6 +4796,8 @@ def checkConnectionAction_clicked(self):
47964796 stimChanID = stimChanLabels [
47974797 dat_file_idx
47984798 ] # self.searchForStimchan(bundle.getSeriesLabel(sel)) #, seriesIdx0)
4799+ if stimChanID == None :
4800+ stimChanID = 1
47994801 time_stim , stimData , stimInfo = bundle .getStim (
48004802 sel + [0 ]
48014803 ) ## assume only 1 channel is stimulating
@@ -4819,7 +4821,7 @@ def checkConnectionAction_clicked(self):
48194821 gs = self .splitViewTab_connection .matplotViews [
48204822 "Average traces"
48214823 ].figure .add_gridspec (nRow + 1 , nCol )
4822-
4824+ print ( 'grid spec' , nRow + 1 , nCol )
48234825 axes = []
48244826 nodeColor = []
48254827 arrowStyl = []
@@ -4842,6 +4844,8 @@ def checkConnectionAction_clicked(self):
48424844 stimChanID = stimChanLabels [
48434845 dat_file_idx
48444846 ] # self.searchForStimchan(bundle.getSeriesLabel(sel)) #, seriesIdx0)
4847+ if stimChanID == None :
4848+ stimChanID = 1
48454849 _ , _ , stimInfo = bundle .getStim (
48464850 sel + [0 ]
48474851 ) ## assume only 1 channel is stimulating
@@ -4859,12 +4863,12 @@ def checkConnectionAction_clicked(self):
48594863 meanCorrelation ,
48604864 ) = allDats [dat_file_idx ]
48614865 for idx , j in enumerate (significantTest ):
4862- nSig_count += 1
48634866 if idx == stimChanID - 1 :
48644867 stimData = avg2 [:, idx ] * 1000.0
48654868 if (
48664869 j == 1 and idx != stimChanID - 1
4867- ): ## do not iinclude stimulation channel itself
4870+ ): ## do not include stimulation channel itself
4871+ nSig_count += 1
48684872 df ["Dat file" ].append (bundle .fileName )
48694873 df ["SerieIdx" ].append (sel )
48704874 df ["Target Chan" ].append (idx + 1 )
@@ -4935,31 +4939,44 @@ def checkConnectionAction_clicked(self):
49354939 axes [pltCount ].tick_params (labelbottom = False )
49364940 pltCount = pltCount + 1
49374941 rowIdx = pltCount // nCol
4938- plt0 = self .splitViewTab_connection .matplotViews [
4939- "Average traces"
4940- ].figure .add_subplot (gs [rowIdx , colIdx ], sharex = axes [0 ])
4941- axes .append (plt0 )
4942- axes [- 1 ].plot (time , stimData , color = "k" )
4943- axes [- 1 ].spines ["right" ].set_visible (False )
4944- axes [- 1 ].spines ["top" ].set_visible (False )
4945- axes [- 1 ].set_xlabel ("Time (S)" )
4942+ self .splitViewTab_connection .tables ["Detected connections" ].clear ()
4943+ print ('Total number of significant connections detected: ' ,nSig_count )
49464944 edgeStyles = []
4947- for e in list (G .edges ):
4948- if edges [e ] < 0 :
4949- edgeStyles .append ("dashed" )
4950- else :
4951- edgeStyles .append ("solid" )
4945+ if len (axes ) >= 1 :
4946+ plt0 = self .splitViewTab_connection .matplotViews [
4947+ "Average traces"
4948+ ].figure .add_subplot (gs [rowIdx , colIdx ], sharex = axes [0 ])
4949+ axes .append (plt0 )
4950+ axes [- 1 ].plot (time , stimData , color = "k" )
4951+ axes [- 1 ].spines ["right" ].set_visible (False )
4952+ axes [- 1 ].spines ["top" ].set_visible (False )
4953+ axes [- 1 ].set_xlabel ("Time (S)" )
4954+
4955+ for e in list (G .edges ):
4956+ if edges [e ] < 0 :
4957+ edgeStyles .append ("dashed" )
4958+ else :
4959+ edgeStyles .append ("solid" )
49524960
4953- self .splitViewTab_connection .matplotViews ["Average traces" ].draw ()
4954- self .splitViewTab_connection .matplotViews [
4955- "Average traces"
4956- ].figure .tight_layout ()
4957- self .splitViewTab_connection .tables ["Detected connections" ].clear ()
4961+ self .splitViewTab_connection .matplotViews ["Average traces" ].draw ()
4962+ self .splitViewTab_connection .matplotViews [
4963+ "Average traces"
4964+ ].figure .tight_layout ()
4965+ self .visualizingConnectionsGraph (G , colorMap , edgeStyles )
4966+ else :
4967+ df ["Dat file" ].append ('No significant connection detected' )
4968+ df ["SerieIdx" ].append ([])
4969+ df ["Source Chan" ].append ([])
4970+ df ["Target Chan" ].append ([])
4971+ df ["Baseline(mV)" ].append ([])
4972+ df ["Peak value(mV)" ].append ([])
4973+ df ["Delta(mV)" ].append ([])
4974+ df ["Delay(mS)" ].append ([])
4975+ df ["Trial consistency" ].append ([])
49584976 df = pd .DataFrame (df )
49594977 self .updateConnectionTable (
49604978 df
49614979 ) ## update connection table for significant connections
4962- self .visualizingConnectionsGraph (G , colorMap , edgeStyles )
49634980 return G , colorMap , edgeStyles
49644981
49654982 def getNodePositions (self ):
0 commit comments