Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Display tract profiles grouped by var_interest #136

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pierre-nedelec
Copy link

@pierre-nedelec pierre-nedelec commented Feb 7, 2023

Prototype of generic function to display tract profiles, grouped by a variable of interest.

Todos:

  • write documentation/example, need @arokem or @richford feedback on where is best
  • review default settings
  • (optional) checks on input data

Copy link
Collaborator

@arokem arokem left a comment

Choose a reason for hiding this comment

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

This is a great start! I have a few comments/suggestions.

Regarding documentation example -- I wonder if this couldn't be added to one of the existing examples here?



def plot_profiles_by_group(
tracto_df:pd.DataFrame,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Type annotations! We haven't done any of those yet, but it's a good step into the future!

tracto (pd.DataFrame): tractometry dataframe.

Returns:
pd.DataFrame: tractometry dataframe, with embelishments for
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sentence seems to be curtailed.




def optimize(df:pd.DataFrame) -> pd.DataFrame:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This function name is rather generic. What does "optimize" mean here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And please add a docstring

@@ -0,0 +1,152 @@
"""Utility functions to manipulate tractometry type dataframe
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that these functions could be added to the existing "utils.py" file.

def center_cut(df: pd.DataFrame, cut: tuple=(25,75)) -> pd.DataFrame:
""" Returns dataframe where the nodeID is cut between two indicated values.

Args:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use the numpy docstring standard (used in other functions you wrote) here as well.

sessions=1,
tracts=2,
) -> pd.DataFrame:

Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs a docstring.

tractometry data
var_df : pd.DataFrame
dataframe with categorical or pseudocontinuous variable of interest
center_cut : bool, optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can allow center_cut to be a number between 0 and 1 that tells how much of the center to cut?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants