Skip to content

Commit 8398dc5

Browse files
Merge pull request #1373 from AFM-SPM/tobyallwood/num-crossing-nans
Replace empty num_crossings values with 0
2 parents ed487ca + 1cd830d commit 8398dc5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

topostats/tracing/nodestats.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,8 @@ def compile_metrics(self) -> None:
17001700
"""Add number of crossings, mean and minimum crossing confidence to the ``grain_crops.stats`` dictionary."""
17011701
# Add Node Statistics to GrainCrop.stats for each class and subgrain
17021702
num_crossings = (self.node_centre_mask == 3).sum()
1703+
# Avoid NaN values
1704+
num_crossings = 0 if num_crossings is None else num_crossings
17031705
mean_conf, min_conf = self.crossing_confidence_statistics()
17041706
for class_number, stats in self.grain_crop.stats.items():
17051707
for subgrain_index, _ in stats.items():

0 commit comments

Comments
 (0)