Skip to content

Conversation

NathanMolinier
Copy link
Contributor

Description

Add new scripts to analyze BIDS compliant datasets

Comment on lines +164 to +176
parser = argparse.ArgumentParser(description='Analyse config file')

## Parameters
parser.add_argument('--paths-to-bids', default='', nargs='+',
help='Paths to BIDS compliant datasets (You can add multiple paths using spaces)')
parser.add_argument('--config', default='',
help='Path to JSON config file that contains all the training splits')
parser.add_argument('--paths-to-csv', default='', nargs='+',
help='Paths to csv files with already computed metrics (You can add multiple paths using spaces)')
parser.add_argument('--split', default='ALL', choices=('TRAINING', 'VALIDATION', 'TESTING', 'ALL'),
help='Split of the data that will be analysed (default="ALL")')
parser.add_argument('--create-csv', default=True,
help='Store computed metrics using a csv file in results/files (default=True)')
Copy link
Member

Choose a reason for hiding this comment

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

I believe it would be more "pythonic" to include these lines under a separate function, for example, get_parser, example here and here.

help='Store computed metrics using a csv file in results/files (default=True)')

# Start analysis
run_analysis(parser.parse_args()) No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

I would add a main() function (example here) and call run_analysis from it.


from utils import get_img_path_from_mask_path, get_mask_path_from_img_path, edit_metric_dict, save_graphs, change_mask_suffix, get_deriv_sub_from_img_path, str_to_float_list, str_to_str_list, mergedict

def run_analysis(args):
Copy link
Member

Choose a reason for hiding this comment

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

This function is slightly "heavy".
Would it be possible to split it into several smaller functions (10-20 lines per function)? Each one with a self-explaning docstring.
Also, some nested for loops and if-else conditions are hard to follow. Adding comments would make them easier to follow.

@valosekj
Copy link
Member

Thank you for the initiative, @NathanMolinier! I will try the scripts and take a closer look next week (after the workshop and course).

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.

2 participants