Skip to content

Commit

Permalink
[pre-commit.ci] Fixing issues with pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2024
1 parent fc938fb commit ba08b36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 2 additions & 7 deletions topostats/grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def __post_init__(self):
"""
Validate the data makes sense.
"""

# If image is not square
if self.image.shape[0] != self.image.shape[1]:
raise ValueError(f"Image is not square: {self.image.shape}")
Expand Down Expand Up @@ -963,9 +962,7 @@ def vet_class_sizes_single_grain(
continue

lower_threshold, upper_threshold = [
vetting_criteria[1:]
for vetting_criteria in class_size_thresholds
if vetting_criteria[0] == class_index
vetting_criteria[1:] for vetting_criteria in class_size_thresholds if vetting_criteria[0] == class_index
][0]

if lower_threshold is not None:
Expand Down Expand Up @@ -1692,9 +1689,7 @@ def extract_grains_from_full_image_tensor(

# Crop the tensor
# Get the bounding box for the region
flat_bounding_box: tuple[int, int, int, int] = tuple(
flat_region.bbox
) # min_row, min_col, max_row, max_col
flat_bounding_box: tuple[int, int, int, int] = tuple(flat_region.bbox) # min_row, min_col, max_row, max_col

# Pad the mask
padded_flat_bounding_box = pad_bounding_box(
Expand Down
4 changes: 1 addition & 3 deletions topostats/tracing/nodestats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,9 +1578,7 @@ def average_height_trace( # noqa: C901
trace = order_branch(trace_img, branch_coords[0])
height_trace = img[trace[:, 0], trace[:, 1]]
dist = nodeStats.coord_dist_rad(trace, centre) # self.coord_dist(trace)
dist, height_trace = nodeStats.average_uniques(
dist, height_trace
) # needs to be paired with coord_dist_rad
dist, height_trace = nodeStats.average_uniques(dist, height_trace) # needs to be paired with coord_dist_rad
heights.append(height_trace)
distances.append(
dist - dist_zero_point # - 0
Expand Down

0 comments on commit ba08b36

Please sign in to comment.