Skip to content

Commit 39f4ec0

Browse files
committed
properly print tracebacks to debug test issue
1 parent 6b4e64c commit 39f4ec0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

suite2p/detection/chan2detect.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from scipy.ndimage import gaussian_filter
66
from ..extraction import masks
77
from . import utils
8+
import traceback
89
"""
910
identify cells with channel 2 brightness (aka red cells)
1011
@@ -90,7 +91,10 @@ def cellpose_overlap(stats, mimg2):
9091
ypix0, xpix0 = stats[i]["ypix"], stats[i]["xpix"]
9192
smask[ypix0, xpix0] = 1
9293
ious = utils.mask_ious(masks, smask)[0]
93-
iou = ious.max()
94+
if ious.size > 0:
95+
iou = ious.max()
96+
else:
97+
iou = 0.0
9498
redstats[
9599
i,
96100
] = np.array([iou > 0.25, iou]) #this had the wrong dimension
@@ -112,10 +116,11 @@ def detect(ops, stats):
112116
try:
113117
print(">>>> CELLPOSE estimating masks in anatomical channel")
114118
redstats, masks = cellpose_overlap(stats, mimg2)
115-
except:
119+
except Exception as e:
116120
print(
117121
"ERROR importing or running cellpose, continuing without anatomical estimates"
118122
)
123+
traceback.print_exc()
119124

120125
if redstats is None:
121126
redstats = intensity_ratio(ops, stats)

0 commit comments

Comments
 (0)