synthesis_workflow.extra.insitu_validation

In-situ validation functions for synthesis in atlas.

Functions

_extent_function(row)

Inner function to compute the max extent of dendrites.

compute_extents(sonata_path, morphology_path[, ext, ...])

Compute the extents (max radial distance) of all morphologies.

plot_extents(results_df[, pdf_name, bins])

Plot histograms of extents of morphologies.

get_layer_morpho_counts(sonata_path, morphology_path, ...)

For each layer, compute the fraction of crossing morphologies.

plot_layer_morph_counts(counts_df[, pdf_name])

Plot count of crossing of morphologies with layers.

get_depth(atlas, pos, layers[, lower, upper, precision])

Estimate the depth from 'pos' to pia using layer annotation from atlas.

plot_layer_collage(sonata_path, morphology_path, ...)

Plot morphologies next to each other with points colored by layer.

Module Contents

_extent_function(row)

Inner function to compute the max extent of dendrites.

compute_extents(sonata_path, morphology_path, ext='.h5', parallel_factory='multiprocessing')

Compute the extents (max radial distance) of all morphologies.

Parameters:
  • sonata_path (str) – path to a sonata file with morphologies

  • morphology_path (str) – base path to the morphologies

  • ext (str) – extension of the morphologies

  • parallel_factory (str) – name of parallel factory to use (see BluePyParallel)

Returns:

dataframe from sonata with column ‘extent’ containing the computed values

Return type:

pandas.DataFrame

plot_extents(results_df, pdf_name='extents.pdf', bins=200)

Plot histograms of extents of morphologies.

Parameters:
  • results_df (pandas.Dataframe) – results from compute_extents

  • pdf_name (str) – name of pdf to save

  • bins (int) – number of bins for histograms

get_layer_morpho_counts(sonata_path, morphology_path, atlas_path, n_cells=100, section_type='basal_dendrite', region=None, hemisphere='right', ext='.h5', region_structure_path='region_structure.yaml')

For each layer, compute the fraction of crossing morphologies.

Parameters:
  • sonata_path (str) – path to sonata file

  • morphology_path (str) – base path to morphologies

  • atlas_path (str) – path to atlas folder

  • n_cells (int) – number of morphologies to use to compute the fraction

  • section_type (str) – section type (attr of morphio.SectionType)

  • region (str) – is not None, must be the name of a region to filter morphologies

  • hemisphere (str) – left/right hemisphere

  • ext (str) – extension of morphology files

  • region_structure_path (str) – path to region_structure.yaml file

Returns:

dafaframe with the counts, mtype and layers information

Return type:

pandas.DataFrame

plot_layer_morph_counts(counts_df, pdf_name='layer_count_comparison.pdf')

Plot count of crossing of morphologies with layers.

If ‘label’ column is present in counts_df, the barplots will split the data for comparison.

For example:

df1 = get_layer_morpho_counts(…) df1[‘label’] = ‘dataset1’ df2 = get_layer_morpho_counts(…) df2[‘label’] = ‘dataset2’ plot_layer_morph_counts(pd.concat([df1, df2]))

Parameters:
  • counts_df (pandas.DataFrame) – results of get_layer_morpho_counts,

  • pdf_name (str) – name of pdf to save

get_depth(atlas, pos, layers, lower=0, upper=1000, precision=0.1)

Estimate the depth from ‘pos’ to pia using layer annotation from atlas.

plot_layer_collage(sonata_path, morphology_path, atlas_path, n_cells=10, section_types=None, region=None, hemisphere='right', pdf_name='layer_collage.pdf', shift=200, dpi=200, ext='.h5', region_structure_path='region_structure.yaml')

Plot morphologies next to each other with points colored by layer.

Parameters:
  • sonata_path (str) – path to sonata file

  • morphology_path (str) – base path to morphologies

  • atlas_path (str) – path to atlas folder

  • n_cells (int) – number of morphologies to use to compute the fraction

  • section_types (list) – list of section types (attr of morphio.SectionType), if None, basal_dendrite, apical_dendrite will be used

  • region (str) – is not None, must be the name of a region to filter morphologies

  • hemisphere (str) – left/right hemisphere

  • pdf_name (str) – name of pdf to save

  • shift (float) – x-shift between morphologies

  • dpi (int) – dpi to save rasterized pdf

  • ext (str) – extension of morphology files

  • region_structure_path (str) – path to region_structure.yaml file