-
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
Refactoring trait pipeline (1/2) #45
Conversation
…se graph and add comments. Delete duplicate `primary_depth`.
…ptional arguments
sleap_roots/angle.py
Outdated
"""Find angles for each root. | ||
|
||
Args: | ||
pts: Numpy array of points of shape (instances, nodes, 2). | ||
node_ind: primary or lateral root node index. |
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.
Uppercase "P" in primary :)
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.
looks good!
@@ -24,15 +25,17 @@ def get_bases(pts: np.ndarray, monocots: bool = False) -> np.ndarray: | |||
|
|||
|
|||
def get_base_tip_dist( |
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 input traits always have to match the trait definition. This function is too complicated. We should simplify it to just assume taking in the expected input traits from from the trait graph.
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 base_pts
and tip_pts
can be used for our pipeline to quickly calculate the base-tip distance. The optional pts
is designed for general purpose.
@@ -107,7 +108,7 @@ def get_root_lengths_max(pts: np.ndarray) -> np.ndarray: | |||
def get_grav_index( |
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.
Same here: only input traits in the trait definition can be arguments to the function.
I redo the
|
Network-related functions need further test after testing |
@@ -41,18 +41,36 @@ def get_node_ind(pts: np.ndarray, proximal: bool = True) -> np.ndarray: | |||
return np.nan | |||
|
|||
if proximal: |
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.
sorry I tried to vectorize this but looks like I did it incorrectly. If it was better before you can change it back!
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.
No problem! The current version also works and uses vectors instead of a for loop.
==================================================================================
chull_area: float = None,pts_all_array: Optional[np.ndarray] = None,monocots: bool = False,)
get_traits_value_frame
function.==================================================================================
get_root_angle
function by adding node_ind as an arugment.get_base_ct_density
,get_base_length_ratio
) by assuming the primary_pts as primary_length_max.get_base_median_ratio
function by using lateral_base_ys and primary_tip_pt_y.get_base_tip_dist
andget_grav_index
functionsget_node_ind
function: