Skip to content

Commit bb92727

Browse files
committed
Updated sampling method for cross-projection metric
1 parent ea2dada commit bb92727

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

erdetect/core/metrics/metric_cross_proj.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,17 @@ def metric_cross_proj(sampling_rate, data, baseline):
5858
# calculate internal projections
5959
proj = np.matmul(norm_metric_data, np.transpose(metric_data))
6060

61-
# perform a one-sample t-test on the values in the upper triangle of the matrix (above the diagonal)
62-
test_values = proj[np.triu_indices(proj.shape[0], 1)]
63-
test_result = stats.ttest_1samp(test_values, 0)
61+
# For the t-test each trial is represented half of the time as the normalized projected and half as un-normalized projected
62+
# Ref: Miller, K. J., Müller, K. R., & Hermes, D. (2021). Basis profile curve identification to understand electrical stimulation effects in human brain networks. PLoS computational biology, 17(9)
63+
test_values = np.array([])
64+
for diag_index in range(2, proj.shape[0], 2):
65+
test_values = np.append(test_values, np.diag(proj, diag_index))
66+
67+
for diag_index in range(1, proj.shape[0], 2):
68+
test_values = np.append(test_values, np.diag(proj, -diag_index))
69+
70+
# perform a one-sample t-test
71+
test_result = stats.ttest_1samp(test_values, 0, alternative='greater')
6472

6573
# return the t-statistic as the metric
6674
return test_result.statistic

0 commit comments

Comments
 (0)