-
Notifications
You must be signed in to change notification settings - Fork 8
[ENH] add min/max len #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,8 @@ def __init__( | |||||||||||||||||||||||||
| sphere_edges: np.ndarray, | ||||||||||||||||||||||||||
| max_angle: float = radians(60), | ||||||||||||||||||||||||||
| step_size: float = 0.5, | ||||||||||||||||||||||||||
| min_pts=0, | ||||||||||||||||||||||||||
| max_pts=np.inf, | ||||||||||||||||||||||||||
|
Comment on lines
+47
to
+48
|
||||||||||||||||||||||||||
| min_pts=0, | |
| max_pts=np.inf, | |
| min_pts: int = 0, | |
| max_pts: float = np.inf, |
Copilot
AI
Feb 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states max_pts is of type int, but the default value is np.inf (a float). This type mismatch in the documentation could confuse users. Consider updating the documentation to reflect that max_pts can be either int or float, or use Union[int, float] in the type hint to be more accurate.
| min_pts : int, optional | |
| Minimum number of points in a streamline to be kept | |
| default: 0 | |
| max_pts : int, optional | |
| Maximum number of points in a streamline to be kept | |
| default: np.inf | |
| min_pts : int or float, optional | |
| Minimum number of points in a streamline to be kept | |
| default: 0 | |
| max_pts : int or float, optional | |
| Maximum number of points in a streamline to be kept. Use | |
| np.inf for no upper limit (default). |
Copilot
AI
Feb 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent parameter naming between GPUTracker and SeedBatchPropagator. GPUTracker uses min_pts/max_pts while SeedBatchPropagator uses minlen/maxlen. For better clarity and consistency, consider aligning the naming (e.g., both using min_pts/max_pts or both using minlen/maxlen). The current naming might confuse future maintainers about whether these represent the same concept.
| self.seed_propagator = SeedBatchPropagator( | |
| gpu_tracker=self, | |
| minlen=min_pts, | |
| maxlen=max_pts | |
| minlen = min_pts | |
| maxlen = max_pts | |
| self.seed_propagator = SeedBatchPropagator( | |
| gpu_tracker=self, | |
| minlen=minlen, | |
| maxlen=maxlen |
Copilot
AI
Feb 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from sl_per_seed_guess = 4 to sl_per_seed_guess = 2 appears unrelated to adding min/max length filtering. This change affects memory allocation for TRX file generation and could impact performance if the actual number of streamlines per seed exceeds this guess (causing more frequent resizes). If this change is intentional and related to the filtering reducing expected streamlines per seed, it should be documented in the PR description or as a comment in the code.
| sl_len_guess = 100 | |
| sl_len_guess = 100 | |
| # Heuristic: initial guess of how many streamlines we get per seed. | |
| # With the current min/max length filtering in the GPU propagator we | |
| # typically obtain fewer valid streamlines per seed than before, so | |
| # we lower the guess from 4 to 2 to avoid over-allocating memory. | |
| # If the filtering or seeding strategy changes (e.g. more accepted | |
| # streamlines per seed), this value should be re-evaluated to balance | |
| # memory usage against the cost of TRX internal resizes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing type hints for minlen and maxlen parameters. The gpu_tracker parameter should also have a type hint. Consider adding type hints for consistency with the rest of the codebase, e.g., gpu_tracker should reference the GPUTracker class, and minlen/maxlen should be typed appropriately (int for minlen, Union[int, float] for maxlen since it can be np.inf).