region_grower.synthesize_morphologies

Synthesize the morphologies.

  • launch TMD(?) synthesis in parallel

  • write each synthesized morphology to a separate file

  • assign morphology names to MVD3/sonata

  • assign identity cell rotations to MVD3/sonata

  • optional axon grafting “on-the-fly”

Classes

RegionMapper(synthesis_regions, region_map)

Mapper between region acronyms and regions names in synthesis config files.

SynthesizeMorphologies(input_cells, ...[, ...])

Synthesize morphologies.

class region_grower.synthesize_morphologies.RegionMapper(synthesis_regions, region_map, known_regions=None)

Bases: object

Mapper between region acronyms and regions names in synthesis config files.

property inverse_mapper

Access the internal inverse mapper.

property mapper

Access the internal mapper.

class region_grower.synthesize_morphologies.SynthesizeMorphologies(input_cells, tmd_parameters, tmd_distributions, atlas, out_cells, out_apical=None, out_morph_dir='out', out_morph_ext=None, morph_axon=None, base_morph_dir=None, atlas_cache=None, seed=0, out_apical_nrn_sections=None, max_files_per_dir=None, overwrite=False, max_drop_ratio=0, scaling_jitter_std=None, rotational_jitter_std=None, out_debug_data=None, nb_processes=None, with_mpi=False, min_depth=25, max_depth=5000, skip_write=False, min_hard_scale=0.2, region_structure=None, container_path=None, hide_progress_bar=False, dask_config=None, chunksize=None, synthesize_axons=False)

Bases: object

Synthesize morphologies.

The synthesis steps are the following:

  • load CellCollection

  • load and check TMD parameters / distributions

  • prepare morphology output folder

  • fetch atlas data

  • check axon morphology list

  • call TNS to synthesize each cell and write it to the output folder

  • write the global results (the new CellCollection and the apical points)

Parameters:
  • input_cells – the path to the MVD3/sonata file.

  • tmd_parameters – the path to the JSON file containing the TMD parameters.

  • tmd_distributions – the path to the JSON file containing the TMD distributions.

  • atlas – the path to the Atlas directory.

  • out_cells – the path to the MVD3/sonata file in which the properties of the synthesized cells are written.

  • out_apical – the path to the YAML file in which the apical points are written.

  • out_morph_dir – the path to the directory in which the synthesized morphologies are written.

  • out_morph_ext – the file extensions used to write the synthesized morphologies.

  • morph_axon – the path to the TSV file containing the name of the morphology that should be used to graft the axon on each synthesized morphology.

  • base_morph_dir – the path containing the morphologies listed in the TSV file given in morph_axon.

  • synthesize_axons – set to True to synthesize axons instead of grafting

  • atlas_cache – the path to the directory used for the atlas cache.

  • seed – the starting seed to use (note that the GID of each cell is added to this seed to ensure all cells has different seeds).

  • out_apical_nrn_sections – the path to the YAML file in which the apical section IDs used by Neuron are written.

  • max_files_per_dir – the maximum number of file in each directory (will create subdirectories if needed).

  • overwrite – if set to False, the directory given to out_morph_dir must be empty.

  • max_drop_ratio – the maximum ratio that

  • scaling_jitter_std – the std of the scaling jitter.

  • rotational_jitter_std – the std of the rotational jitter.

  • nb_processes – the number of processes when MPI is not used.

  • with_mpi – initialize and use MPI when set to True.

  • min_depth – minimum depth from atlas computation

  • max_depth – maximum depth from atlas computation

  • skip_write – set to True to bypass writing to disk for debugging/testing

  • min_hard_scale – the scale value below which a neurite is removed

assign_atlas_data(min_depth=25, max_depth=5000)

Open an Atlas and compute depths and orientations according to the given positions.

check_context_consistency()

Check that the context_constraints entries in TMD parameters are consistent.

compute()

Run synthesis for all GIDs.

export_empty_results()

Create result DataFrame for empty population.

finalize(result: DataFrame)

Finalize master work.

  • assign ‘morphology’ property based on workers’ result

  • assign ‘orientation’ property to identity matrix

  • dump CellCollection to MVD3/sonata

Parameters:

result – A pandas.DataFrame

set_cortical_depths()

Set cortical depths for all regions.

set_default_params_and_distrs()

Set default values to all regions in tmd_parameters and tmd_distributions.

synthesize()

Execute the complete synthesis process and export the results.

property task_ids

Task IDs (= CellCollection IDs).

verify() None

Check that context has distributions / parameters for all given regions and mtypes.