-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update scanline functions and get_pr/lr_pts function in series class. #32
Conversation
linwang9926
commented
Jun 9, 2023
•
edited
Loading
edited
- Update scanline functions
- Update get_pr/lr_pts function in series class.
- Update stem width function
- Disable warning spam from nan/empty slice operations (Disable warning spam from nan/empty slice operations #34 ).
Codecov Report
@@ Coverage Diff @@
## main #32 +/- ##
===========================================
+ Coverage 67.37% 82.59% +15.21%
===========================================
Files 13 13
Lines 656 678 +22
===========================================
+ Hits 442 560 +118
+ Misses 214 118 -96
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
mostly minor changes, except one special case that may lead to errors
sleap_roots/graphpipeline.py
Outdated
type(fn_outputs) == np.float64 | ||
or type(fn_outputs) == float | ||
or type(fn_outputs) == np.int64 | ||
or type(fn_outputs) == int |
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.
type(fn_outputs) == np.float64 | |
or type(fn_outputs) == float | |
or type(fn_outputs) == np.int64 | |
or type(fn_outputs) == int | |
isinstance(fn_outputs, (np.floating, float)) | |
or isinstance(fn_outputs, (np.integer, int)) |
sleap_roots/graphpipeline.py
Outdated
gt_instances_pr = primary.user_instances + primary.unused_predictions | ||
gt_instances_lr = lateral.user_instances + lateral.unused_predictions | ||
|
||
# lateral_pts = lateral.numpy() |
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.
remove unused comment
sleap_roots/graphpipeline.py
Outdated
for i in range(len(SCALAR_TRAITS)): | ||
if SCALAR_TRAITS[i] in column_names: | ||
trait = data_plant[SCALAR_TRAITS[i]].values | ||
trait = data_plant_df[SCALAR_TRAITS[i]] | ||
# LW start |
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.
remove unused comment
sleap_roots/graphpipeline.py
Outdated
type(trait[0]) == int | ||
or type(trait[0]) == np.int64 | ||
or type(trait[0]) == np.float64 | ||
or type(trait[0]) == float |
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.
type(trait[0]) == int | |
or type(trait[0]) == np.int64 | |
or type(trait[0]) == np.float64 | |
or type(trait[0]) == float | |
isinstance(trait[0], (np.floating, float)) | |
or isinstance(trait[0], (np.integer, int)) |
or type(trait[0]) == np.float64 | ||
or type(trait[0]) == float | ||
): | ||
values = np.array([element[0] for element in trait]) |
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.
Won't this break if trait
contains scalars? Like if type(trait[0]) == int
, then for example:
trait = [0, 1, 2]
assert type(trait[0]) == int
element = trait[0]
element[0] # error
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.
I remembered that the trait is like: [[0,1,2]].
The test of the pipeline is good, but I met a problem using Spyder to run code with new environment, will fix it soon
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.
I will modify it together with issue #33
sleap_roots/scanline.py
Outdated
intersection_line = [] | ||
for j in range(len(points)): | ||
for i in range(n_line): # n_line | ||
# y_loc = n_interval * (i + 1) |
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.
remove unused comment
sleap_roots/scanline.py
Outdated
for i in range(n_line): # n_line | ||
# y_loc = n_interval * (i + 1) | ||
horizontal_line_y = n_interval * (i + 1) | ||
# line = LineString([(0, y_loc), (width, y_loc)]) |
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.
remove unused comment
sleap_roots/scanline.py
Outdated
# filter out nan nodes | ||
pts_j = np.array(points[j])[~np.isnan(points[j]).any(axis=1)] | ||
# print(pts_j) |
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.
remove unused comment
sleap_roots/scanline.py
Outdated
y1 < horizontal_line_y and y2 >= horizontal_line_y | ||
): | ||
current_root += 1 | ||
# is_inside_root = not is_inside_root |
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.
remove unused comment
sleap_roots/scanline.py
Outdated
current_root += 1 | ||
# is_inside_root = not is_inside_root | ||
intersection_counts_root += current_root | ||
# print(intersection_counts_root) |
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.
remove unused comment
…into lin/pipeline_graph_plant_quick
…#32) * Update scanline functions and get_pr/lr_pts function in series class. * fix case where points are in a list * Specified SLEAP version * Uncomment graphpipeline tests * Bump version requirement for sleap-io * Use isinstance and remove commented lines. * Black format of graphpipeline.py and scanline.py. * Disable warning spam from nan/empty slice operations. --------- Co-authored-by: Lin Wang <linwang9926@gmail.com> Co-authored-by: Elizabeth Berrigan <berri104@gmail.com> Co-authored-by: Talmo Pereira <talmo@salk.edu>