generated from dopt-python/py311
add Cython profiling option for later use (currently not working)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -74,7 +74,7 @@ def measure_length(
|
||||
|
||||
cnts = cv2.findContours(edged.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
||||
cnts = imutils.grab_contours(cnts)
|
||||
if cnts is None:
|
||||
if cnts is None: # pragma: no cover
|
||||
raise errors.ContourCalculationError(
|
||||
"No contours were found in the provided image. Can not continue analysis."
|
||||
)
|
||||
@@ -82,7 +82,7 @@ def measure_length(
|
||||
cnts, _ = contours.sort_contours(cnts)
|
||||
x_coords = [cv2.boundingRect(c)[0] for c in cnts]
|
||||
is_sorted = np.all(x1 <= x2 for x1, x2 in zip(x_coords, x_coords[1:])) # type: ignore
|
||||
if not is_sorted:
|
||||
if not is_sorted: # pragma: no cover
|
||||
raise errors.ContourCalculationError(
|
||||
"Contour detection not valid: contours are not "
|
||||
"properly sorted from left to right."
|
||||
@@ -128,13 +128,13 @@ def measure_length(
|
||||
]
|
||||
)
|
||||
|
||||
if not filtered_cnts:
|
||||
if not filtered_cnts: # pragma: no cover
|
||||
raise errors.ContourCalculationError(
|
||||
"Contour detection not valid: no contours recognized"
|
||||
)
|
||||
|
||||
num_contours = len(filtered_cnts)
|
||||
if num_contours != const.NUM_VALID_ELECTRODES:
|
||||
if num_contours != const.NUM_VALID_ELECTRODES: # pragma: no cover
|
||||
raise errors.InvalidElectrodeCount(
|
||||
f"Number of counted electrodes does not match the "
|
||||
f"expected value: count = {num_contours}, expected = {const.NUM_VALID_ELECTRODES}"
|
||||
|
||||
Reference in New Issue
Block a user