synthesis_workflow.synthesis

Functions for synthesis to be used by luigi tasks.

Attributes

with_placement_algo

Functions

_get_morph_class(path)

get_neurite_types(morphs_df)

Get the neurite types to consider for PC or IN cells by checking if apical exists.

apply_substitutions(original_morphs_df[, ...])

Applies substitution rule on .dat file.

_build_distributions_single_mtype(mtype[, morphs_df, ...])

Internal function for multiprocessing of tmd_distribution building.

build_distributions(mtypes, morphs_df, neurite_types, ...)

Build tmd_distribution dictionary for synthesis.

get_axon_base_dir(morphs_df[, col_name])

Get the common base directory of morphologies.

run_choose_morphologies(kwargs[, nb_jobs])

Runs placement algorithm from python.

create_axon_morphologies_tsv(circuit_path[, ...])

Create required axon_morphology tsv file for placement-algorithm to graft axons.

get_target_length(soma_layer, target_layer, ...)

Compute the target length of a neurite from soma and target layer.

get_max_len(neurite[, mode])

Get the max length of a neurite, either in y direction, or in radial direction.

rescale_neurites(morphology, neurite_type, target_length)

Rescale neurites of morphologies to match target length.

rescale_morphologies(morphs_df, scaling_rules, ...[, ...])

Rescale all morphologies to fulfill scaling rules.

_fit_population(mtype, neurite_type, file_names)

add_scaling_rules_to_parameters(tmd_parameters, ...[, ...])

Adds the scaling rules to TMD parameters.

Module Contents

with_placement_algo = True
_get_morph_class(path)
get_neurite_types(morphs_df)

Get the neurite types to consider for PC or IN cells by checking if apical exists.

apply_substitutions(original_morphs_df, substitution_rules=None)

Applies substitution rule on .dat file.

Parameters:
  • original_morphs_df (DataFrame) – dataframe with morphologies

  • substitution_rules (dict) – rules to assign duplicated mtypes to morphologies

Returns:

dataframe with original and new morphologies

Return type:

DataFrame

_build_distributions_single_mtype(mtype, morphs_df=None, neurite_types=None, diameter_model_function=None, config=None, morphology_path=None)

Internal function for multiprocessing of tmd_distribution building.

build_distributions(mtypes, morphs_df, neurite_types, diameter_model_function, config, morphology_path, region, nb_jobs=-1, joblib_verbose=10)

Build tmd_distribution dictionary for synthesis.

Parameters:
  • mtypes (list) – list of mtypes to build distribution for

  • morphs_df (DataFrame) – morphology dataframe with reconstruction to use

  • diameter_model_function (function) – diametrizer function (from diameter-synthesis)

  • morphology_path (str) – name of the column in morphs_df to use for paths to morphologies

  • region (str) – region we are building

  • nb_jobs (int) – number of jobs to run in parallal with joblib

  • joblib_verbose (int) – verbose level of joblib

Returns:

dict to save to tmd_distribution.json

Return type:

dict

get_axon_base_dir(morphs_df, col_name='morphology_path')

Get the common base directory of morphologies.

run_choose_morphologies(kwargs, nb_jobs=-1)

Runs placement algorithm from python.

Parameters:
  • kwargs (dict) – dictionary with argument from placement-algorithm CLI

  • nb_jobs (int) – number of jobs

  • debug_scales_path (str) – path to the directory containing the log files

create_axon_morphologies_tsv(circuit_path, morphs_df_path=None, atlas_path=None, annotations_path=None, rules_path=None, morphdb_path=None, alpha=1.0, scales=None, seed=0, axon_morphs_path='axon_morphs.tsv', scores_output_path=None, bias_kind='linear', with_optional_scores=True, nb_jobs=-1)

Create required axon_morphology tsv file for placement-algorithm to graft axons.

Parameters:
  • circuit_path (str) – Path to circuit somata file

  • morphs_df_path (str) – Path to morphology dataframe

  • atlas_path (str) – Path to the atlas

  • annotations_path (str) – Path to annotations

  • rules_path (str) – Path to rules

  • morphdb_path (str) – Path to morphdb file

  • alpha (float) – Use score ** alpha as morphology choice probability

  • scales (list(float)) – Scale(s) to check

  • seed (int) – Random number generator seed

  • axon_morphs_path (str) – Name of the axon morphology list in .tsv format

  • scores_output_path (str) – Make placement_algorithm.app.choose_morphologies export scores into files in this folder

  • bias_kind (str) – Kind of bias used to penalize scores of rescaled morphologies (can be “linear” or “gaussian”)

  • with_optional_scores (bool) – Use or ignore optional rules for morphology choice

  • nb_jobs (int) – Number of jobs

get_target_length(soma_layer, target_layer, cortical_thicknesses)

Compute the target length of a neurite from soma and target layer.

get_max_len(neurite, mode='y')

Get the max length of a neurite, either in y direction, or in radial direction.

rescale_neurites(morphology, neurite_type, target_length, scaling_mode='y')

Rescale neurites of morphologies to match target length.

rescale_morphologies(morphs_df, scaling_rules, cortical_thicknesses, morphology_path='morphology_path', rescaled_morphology_base_path='rescaled_morphologies', rescaled_morphology_path='rescaled_morphology_path', ext='.h5', scaling_mode='y', skip_rescale=False)

Rescale all morphologies to fulfill scaling rules.

_fit_population(mtype, neurite_type, file_names)
add_scaling_rules_to_parameters(tmd_parameters, morphs_df_path, morphology_path, scaling_rules, nb_jobs=-1)

Adds the scaling rules to TMD parameters.