@@ -214,7 +214,7 @@ def n_emp_mat_sum_trial(mat, N, pattern_hash):
214214
215215 Parameters:
216216 -----------
217- mat: 3d numpy array or elephant BinndedSpikeTrain object
217+ mat: 3d numpy array or elephant BinnedSpikeTrain object
218218 Binned spike trains represented as a binary matrix (i.e., matrix of 0's and 1's),
219219 segmented into trials. Trials should contain an identical number of neurons and
220220 an identical number of time bins.
@@ -299,7 +299,7 @@ def _n_exp_mat_analytic(mat, N, pattern_hash):
299299 # multipyling the marginal probability of neurons with regard to the
300300 # pattern
301301 pmat = np .multiply (m , np .tile (marg_prob , (1 , nrep ))) + \
302- np .multiply (1 - m , np .tile (1 - marg_prob , (1 , nrep )))
302+ np .multiply (1 - m , np .tile (1 - marg_prob , (1 , nrep )))
303303 return np .prod (pmat , axis = 0 ) * float (np .shape (mat )[1 ])
304304
305305
@@ -392,14 +392,15 @@ def n_exp_mat(mat, N, pattern_hash, method='analytic', n_surr=1):
392392 return _n_exp_mat_surrogate (mat , N , pattern_hash , n_surr )
393393
394394
395- def n_exp_mat_sum_trial (mat , N , pattern_hash , method = 'analytic_TrialByTrial' , ** kwargs ):
395+ def n_exp_mat_sum_trial (
396+ mat , N , pattern_hash , method = 'analytic_TrialByTrial' , ** kwargs ):
396397 """
397398 Calculates the expected joint probability
398399 for each spike pattern sum over trials
399400
400401 Parameters:
401402 -----------
402- mat: 3d numpy array or elephant BinndedSpikeTrain object
403+ mat: 3d numpy array or elephant BinnedSpikeTrain object
403404 Binned spike trains represented as a binary matrix (i.e., matrix of 0's and 1's),
404405 segmented into trials. Trials should contain an identical number of neurons and
405406 an identical number of time bins.
@@ -478,7 +479,8 @@ def n_exp_mat_sum_trial(mat, N, pattern_hash, method='analytic_TrialByTrial', **
478479 return n_exp
479480
480481
481- def gen_pval_anal (mat , N , pattern_hash , method = 'analytic_TrialByTrial' , ** kwargs ):
482+ def gen_pval_anal (
483+ mat , N , pattern_hash , method = 'analytic_TrialByTrial' , ** kwargs ):
482484 """
483485 computes the expected coincidences and a function to calculate
484486 p-value for given empirical coincidences
@@ -490,7 +492,7 @@ def gen_pval_anal(mat, N, pattern_hash, method='analytic_TrialByTrial', **kwargs
490492
491493 Parameters:
492494 -----------
493- mat: 3d numpy array or elephant BinndedSpikeTrain object
495+ mat: 3d numpy array or elephant BinnedSpikeTrain object
494496 Binned spike trains represented as a binary matrix (i.e., matrix of 0's and 1's),
495497 segmented into trials. Trials should contain an identical number of neurons and
496498 an identical number of time bins.
@@ -562,7 +564,7 @@ def pval(n_emp):
562564 if len (n_emp ) > 1 :
563565 raise ValueError (
564566 'in surrogate method the p_value can be calculated only for one pattern!' )
565- return np .sum (exp_dist [int ( n_emp [0 ]) :])
567+ return np .sum (exp_dist [n_emp [0 ]:])
566568
567569 return pval , n_exp
568570
@@ -653,6 +655,7 @@ def _UE(mat, N, pattern_hash, method='analytic_TrialByTrial', **kwargs):
653655 n_surr = 1
654656 dist_exp , n_exp = gen_pval_anal (
655657 mat , N , pattern_hash , method , n_surr = n_surr )
658+ n_exp = np .mean (n_exp )
656659 elif method == 'analytic_TrialByTrial' or method == 'analytic_TrialAverage' :
657660 dist_exp , n_exp = gen_pval_anal (mat , N , pattern_hash , method )
658661 pval = dist_exp (n_emp )
@@ -674,11 +677,11 @@ def jointJ_window_analysis(
674677 0-axis --> Trials
675678 1-axis --> Neurons
676679 2-axis --> Spike times
677- binsize: Qunatity scalar with dimension time
680+ binsize: Quantity scalar with dimension time
678681 size of bins for descritizing spike trains
679- winsize: Qunatity scalar with dimension time
682+ winsize: Quantity scalar with dimension time
680683 size of the window of analysis
681- winstep: Qunatity scalar with dimension time
684+ winstep: Quantity scalar with dimension time
682685 size of the window step
683686 pattern_hash: list of integers
684687 list of interested patterns in hash values
@@ -718,7 +721,7 @@ def jointJ_window_analysis(
718721 shape: different pattern hash --> 0-axis
719722 different window --> 1-axis
720723 indices: list of list of integers
721- list of indices of pattern whithin each window
724+ list of indices of pattern within each window
722725 shape: different pattern hash --> 0-axis
723726 different window --> 1-axis
724727 n_emp: list of integers
0 commit comments