Skip to content

Commit 133a467

Browse files
committed
[ENH] Allow single hemisphere spinsamples
1 parent 4fb4f78 commit 133a467

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

netneurotools/stats.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def gen_spinsamples(coords, hemiid, n_rotate=1000, check_duplicates=True,
691691
raise ValueError('Provided `coords` and `hemiid` must have the same '
692692
'length. Provided lengths: coords = {}, hemiid = {}'
693693
.format(len(coords), len(hemiid)))
694-
if np.max(hemiid) != 1 or np.min(hemiid) != 0:
694+
if np.max(hemiid) > 1 or np.min(hemiid) < 0:
695695
raise ValueError('Hemiid must have values in {0, 1} denoting left and '
696696
'right hemisphere coordinates, respectively. '
697697
+ 'Provided array contains values: {}'
@@ -719,6 +719,8 @@ def gen_spinsamples(coords, hemiid, n_rotate=1000, check_duplicates=True,
719719
for h, rot in enumerate(_gen_rotation(seed=seed)):
720720
hinds = (hemiid == h)
721721
coor = coords[hinds]
722+
if len(coor) == 0:
723+
continue
722724

723725
# if we need an "exact" mapping (i.e., each node needs to be
724726
# assigned EXACTLY once) then we have to calculate the full

0 commit comments

Comments
 (0)