morphval.validation_main¶
Main module of MorphVal package.
Attributes¶
Classes¶
Validation state object. |
Functions¶
|
Save data to CSV file. |
|
Load a template. |
|
Count the number of passing, and total validations for a dict of features. |
|
Based on the config thresholds and criterion, computes if validation passed or failed. |
|
Validate a test population against a reference population. |
|
Dump CSV of morphometrics for each of the features. |
|
Create histograms based on morphometrics. |
|
Validate one feature. |
Compute the summary statistics of a feature. |
|
|
Compute the test statistic and the p-value of a statistical test. |
|
Plot and saves the figure of the overlaid histograms of feature distributions. |
Module Contents¶
- TEMPLATE_FILE¶
- SUMMARY_TEMPLATE_FILE¶
- save_csv(dir_name, feature, data)¶
Save data to CSV file.
- load_template(template_file)¶
Load a template.
- count_passing_validations(features)¶
Count the number of passing, and total validations for a dict of features.
- Returns:
returns tuple(feature_pass, features_total)
- compute_validation_criterion(config, stat_test_results)¶
Based on the config thresholds and criterion, computes if validation passed or failed.
- do_validation(validation_config, ref_population, test_population)¶
Validate a test population against a reference population.
- Parameters:
validation_config (dict) – {component: {feature: {…}}}
ref_population (NeuroM morph population) – reference population
test_population (NeuroM morph population) – test population
- Returns:
tuple of morphometrics, results, where morphometrics is a dictionary containing the raw feature values for the morphologies, and the results is a dictionary containing statistical results on this raw data
- write_morphometrics(output_dir, morphometrics)¶
Dump CSV of morphometrics for each of the features.
- create_morphometrics_histograms(output_dir, morphometrics, config, notebook_desc=None)¶
Create histograms based on morphometrics.
- validate_feature(mtype, config, output_dir, ref_files, test_files, cell_figure_count, notebook=False)¶
Validate one feature.
- class Validation(config, test_data, ref_data, output_dir, create_timestamp_dir=True, notebook=False)¶
Validation state object.
This class holds the state information of a validation run.
- timestamp¶
- config¶
- output_dir¶
- results = None¶
- results_file = None¶
- test_plots¶
- ref_plots¶
- notebook¶
- _arg_to_file_list(arg, arg_name)¶
- _list_files(directory)¶
- validate_features(cell_figure_count=100, nb_jobs=-1, joblib_verbose=0)¶
Validate all features.
- generate_report_data(mtype)¶
Generate dictionary with the text that will fill the template.
It contains all data of the results dictionary in text form with additional information on the directories where the data come from. tt is a shortcut for template text.
- static merge_results_features(mtype, component, feature_name, feature_config, feature_results)¶
Merge result features.
- write_report(validation_report=True, template_file=TEMPLATE_FILE, prefix='report-')¶
For each mtype in the results, write out its report.
- write_report_summary(validation_report=True, template_file=SUMMARY_TEMPLATE_FILE, prefix='report-summary-')¶
Write summary report.
- render_mtype_report(template_file, mtype, validation_report)¶
Render mtype report.
- compute_summary_statistics(data)¶
Compute the summary statistics of a feature.
- Parameters:
data – the feature data array
- Returns:
The dictionary summary_statistics which contains sample size, mean, standard deviation and median.
- compute_statistical_tests(test_data, ref_data, test_name, thresh)¶
Compute the test statistic and the p-value of a statistical test.
- Parameters:
test_data – the test feature array
ref_data – the reference feature array
test – the statistical test (ex.: KS test)
thresh – the threshold
- Returns:
statistical tests
- Return type:
the dictionary
- plot_save_feature(figures_dir, test_data, ref_data, feature, bin_count)¶
Plot and saves the figure of the overlaid histograms of feature distributions.
The result image is a .png figure.