Skip to content

Commit 3e34237

Browse files
author
Katelyn Begany
committed
NF: added check for NaNs to check_integrity GraphPartition method
1 parent e6f3590 commit 3e34237

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

brainx/modularity.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,9 @@ def check_integrity(self, partition):
668668
# Raise error if any partition is empty
669669
if [partition[key] == set([]) for key in partition.keys()]:
670670
raise ValueError("Partition index %s is empty" % (key))
671+
672+
if [np.isnan(value) for sets in partition.values() for value in sets]:
673+
raise ValueError("Partition contains NaN(s)")
671674

672675
#-----------------------------------------------------------------------------
673676
# Functions

0 commit comments

Comments
 (0)