Skip to content

Commit

Permalink
Added no coverage comments
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunUllanat committed Mar 4, 2024
1 parent e96a80f commit a3b998c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pathml/inference/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def __init__(

print(self.model_card["model_input_notes"])

if not (self.image_resolution == 0.5):
if not (self.image_resolution == 0.5): # pragma: no cover
print("The model only works with images of resolution 0.5.")

def __repr__(self):
Expand Down
14 changes: 7 additions & 7 deletions pathml/inference/mesmer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def erode_edges(mask, erosion_width):
ValueError: mask.ndim is not 2 or 3
"""

if mask.ndim not in {2, 3}:
if mask.ndim not in {2, 3}: # pragma: no cover
raise ValueError(
"erode_edges expects arrays of ndim 2 or 3."
"Got ndim: {}".format(mask.ndim)
Expand Down Expand Up @@ -184,7 +184,7 @@ def mesmer_preprocess(image, **kwargs):
np.array: processed image array
"""

if len(image.shape) != 4:
if len(image.shape) != 4: # pragma: no cover
raise ValueError(f"Image data must be 4D, got image of shape {image.shape}")

output = np.copy(image)
Expand Down Expand Up @@ -216,7 +216,7 @@ def format_output_mesmer(output_list):
ValueError: if model output list is not len(4)
"""
expected_length = 4
if len(output_list) != expected_length:
if len(output_list) != expected_length: # pragma: no cover
raise ValueError(
"output_list was length {}, expecting length {}".format(
len(output_list), expected_length
Expand Down Expand Up @@ -286,13 +286,13 @@ def deep_watershed(
try:
maximas = outputs[maxima_index]
interiors = outputs[interior_index]
except (TypeError, KeyError, IndexError):
except (TypeError, KeyError, IndexError): # pragma: no cover
raise ValueError(
"`outputs` should be a list of at least two " "NumPy arryas of equal shape."
)

valid_algos = {"h_maxima", "peak_local_max"}
if maxima_algorithm not in valid_algos:
if maxima_algorithm not in valid_algos: # pragma: no cover
raise ValueError(
"Invalid value for maxima_algorithm: {}. "
"Must be one of {}".format(maxima_algorithm, valid_algos)
Expand All @@ -306,13 +306,13 @@ def deep_watershed(
"This will lead to slow prediction performance."
)

if maximas.shape[:-1] != interiors.shape[:-1]:
if maximas.shape[:-1] != interiors.shape[:-1]: # pragma: no cover
raise ValueError(
"All input arrays must have the same shape. "
"Got {} and {}".format(maximas.shape, interiors.shape)
)

if maximas.ndim not in {4, 5}:
if maximas.ndim not in {4, 5}: # pragma: no cover
raise ValueError(
"maxima and interior tensors must be rank 4 or 5. "
"Rank 4 is 2D data of shape (batch, x, y, c). "
Expand Down

0 comments on commit a3b998c

Please sign in to comment.