morphval.validation_main

Main module of MorphVal package.

Attributes

TEMPLATE_FILE

SUMMARY_TEMPLATE_FILE

Classes

Validation

Validation state object.

Functions

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.

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, ...)

Validate a test population against a reference population.

write_morphometrics(output_dir, morphometrics)

Dump CSV of morphometrics for each of the features.

create_morphometrics_histograms(output_dir, ...[, ...])

Create histograms based on morphometrics.

validate_feature(mtype, config, output_dir, ref_files, ...)

Validate one feature.

compute_summary_statistics(data)

Compute the summary statistics of a feature.

compute_statistical_tests(test_data, ref_data, ...)

Compute the test statistic and the p-value of a statistical test.

plot_save_feature(figures_dir, test_data, ref_data, ...)

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.

Parameters:
  • validation_report (bool) – True if ‘validation’ to be shown in report, False if p-values shown instead, with no ‘Pass/Fail’ information

  • template_file (str) – template file name

  • prefix (str) – report is saved as <prefix> + <mtype> + ‘.html’

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.

Parameters:
  • figures_dir (str) – the directory where the figures are stored,

  • test_data (np.array) – test feature array

  • ref_data (np.array) – reference feature array

  • feature (str) – the feature name

  • bin_count (int) – the number of histogram bins