60 task write trails drawing feature functions total distance updated#118
Conversation
…ons-calculate_segment_velocity_metrics
… class but will be calculated outside for sake of simplicity
…s into test_models, write calculate segment metrics
…valid_ink_trajectory and into compute_segment_metrics
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 98.61% 98.14% -0.47%
==========================================
Files 19 19
Lines 1080 1131 +51
==========================================
+ Hits 1065 1110 +45
- Misses 15 21 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ns-total_distance_updated
…functions and fixed tests
…ns-total_distance_updated
Asanto32
left a comment
There was a problem hiding this comment.
A few questions on this one with why we are using patching in the tests, and then some comments about re-arranging the if/elif chain to improve readability
| } | ||
| } | ||
|
|
||
| with patch.object(segment, "valid_ink_trajectory", return_value=(0, 4)): |
There was a problem hiding this comment.
why do we need to patch for these next few tests?
There was a problem hiding this comment.
because valid_ink_trajectory determines if a trajectory exists from a start circle to another but the circles and point data I am using are arbitrary and it would fail if I let it run in these tests
There was a problem hiding this comment.
We know valid_ink_trajectory works, I want to make sure the outer function works
|
|
||
| import dataclasses | ||
| import datetime | ||
| from asyncio.log import logger |
There was a problem hiding this comment.
we already have a logger in config.py, if you look at some of the spiral modules, spiral_orchestrator for example you can see how we were using it
| ink_start_idx, ink_end_idx = self.valid_ink_trajectory(start_circle, end_circle) | ||
|
|
||
| if ink_start_idx is None: | ||
| logger.warning( |
There was a problem hiding this comment.
This should exit and return right? I prefer that over the long if/elif chain.
if `ink_start_idx` is None:
logger.warning()
return
if `ink_end_idx` is None:
self.ink_points = ...
if len > 2
do stuff;
else:
logger.warning()
return
etc.
Let me know if this still isn't clear, we can chat about it 1-1
There was a problem hiding this comment.
It was more compressed the other way, I still have to do these checks but since you wanted it to be more readable I broke it all up
This PR closes issues #82 #60 #72 .
compute_segment_metrics belongs to LineSegment and calls all feature classmethods associated with LineSegment (valid_ink_trajectory, calculate_velocity_metrics, calculate_path_optimality, calculate_smoothness, detect_hesitations). It also calculates the ink_time metric.