Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandro Felder <[email protected]>
  • Loading branch information
matham and alessandrofelder authored Aug 13, 2024
1 parent fb1a9b7 commit 04beb22
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cellfinder/core/detect/filters/plane/classical_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def normalize(
) -> None:
"""
Normalizes the 3d tensor so each z-plane is independently scaled to be
in the [0, clipping_value] range.
in the [0, clipping_value] range (if upscale is `True`) or in the [0,1] (if `upscale` is `False`).
It is done to filtered_planes inplace.
"""
Expand Down
2 changes: 1 addition & 1 deletion cellfinder/core/detect/filters/plane/plane_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _threshold_planes(
threshold_value: int,
) -> None:
"""
Thresholds peaks to those above the mean/std.
Sets each plane (in-place) to threshold_value, where the corresponding enhanced_plane > mean + n_sds_above_mean_thresh*std. Each plane will be set to zero elsewhere.
"""
planes_1d = enhanced_planes.view(enhanced_planes.shape[0], -1)

Expand Down
3 changes: 2 additions & 1 deletion cellfinder/core/tools/threading.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Provides classes that can run a function in another thread or process and
allows passing data to and from them. It also passes on any exceptions that
allow passing data to and from the threads/processes. It also passes on any exceptions that
occur in the secondary thread/sub-process in the main thread or when it
exits.
Expand Down Expand Up @@ -36,6 +36,7 @@ def worker(thread: ThreadWithException, power: float):
# just send the id back
thread.send_msg_to_mainthread(tensor_id)
# we can also handle errors here, which will be re-raised in the main process
if tensor_id == 7:
raise ValueError("I fell asleep")
Expand Down
5 changes: 1 addition & 4 deletions tests/core/test_integration/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,7 @@ def test_detection_cluster_splitting(

def test_detection_cell_too_large(synthetic_spot_clusters, no_free_cpus):
"""
Test cluster splitting for overlapping cells.
Test filtering/detection on cpu and cuda. Because splitting is only on cpu
so make sure if detection is on cuda, splitting still works.
Test we detect one big artifact if the signal has a too large foreground structure.
"""
# max_cell_volume is volume of soma * spread sphere. For values below
# radius is 7 pixels. So volume is ~1500 pixels
Expand Down

0 comments on commit 04beb22

Please sign in to comment.