Skip to content
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

Merged
merged 11 commits into from
Jun 26, 2023

Conversation

linwang9926
Copy link
Collaborator

@linwang9926 linwang9926 commented Jun 9, 2023

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #32 (2abac65) into main (e8b9eed) will increase coverage by 15.21%.
The diff coverage is 90.69%.

@@             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     
Impacted Files Coverage Δ
sleap_roots/traitsgraph.py 100.00% <ø> (ø)
sleap_roots/bases.py 97.82% <66.66%> (+5.43%) ⬆️
sleap_roots/networklength.py 92.53% <71.42%> (-2.71%) ⬇️
sleap_roots/points.py 97.05% <75.00%> (-2.95%) ⬇️
sleap_roots/series.py 39.58% <80.00%> (+2.81%) ⬆️
sleap_roots/graphpipeline.py 95.38% <93.97%> (+80.13%) ⬆️
sleap_roots/scanline.py 97.36% <95.45%> (+2.13%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@linwang9926 linwang9926 requested a review from talmo June 13, 2023 17:10
Copy link
Contributor

@talmo talmo left a 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

Comment on lines 242 to 245
type(fn_outputs) == np.float64
or type(fn_outputs) == float
or type(fn_outputs) == np.int64
or type(fn_outputs) == int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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))

gt_instances_pr = primary.user_instances + primary.unused_predictions
gt_instances_lr = lateral.user_instances + lateral.unused_predictions

# lateral_pts = lateral.numpy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

Comment on lines 448 to 451
type(trait[0]) == int
or type(trait[0]) == np.int64
or type(trait[0]) == np.float64
or type(trait[0]) == float
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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])
Copy link
Contributor

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

intersection_line = []
for j in range(len(points)):
for i in range(n_line): # n_line
# y_loc = n_interval * (i + 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

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)])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

# filter out nan nodes
pts_j = np.array(points[j])[~np.isnan(points[j]).any(axis=1)]
# print(pts_j)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

y1 < horizontal_line_y and y2 >= horizontal_line_y
):
current_root += 1
# is_inside_root = not is_inside_root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

current_root += 1
# is_inside_root = not is_inside_root
intersection_counts_root += current_root
# print(intersection_counts_root)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused comment

@linwang9926 linwang9926 merged commit db93e0d into main Jun 26, 2023
@talmo talmo deleted the lin/pipeline_graph_plant_quick branch July 5, 2023 16:37
eberrigan added a commit that referenced this pull request Mar 14, 2024
…#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants