Synthesize a cell with external diametrizerΒΆ

This example shows how to synthesize a cell with an external diametrizer. An external diametrizer should have the signature described in neurots.generate.diametrizer.build.

The code diameter_synthesis provides an example of such external diametrizer.

Warning

Note that the diameter-synthesis package must be installed.

22 from pathlib import Path
23
24 from diameter_synthesis import build_diameters  # pylint: disable=import-error
25
26 import neurots
27
28
29 def run(output_dir, data_dir):
30     """Run the example for generating a cell with external diametrizer."""
31     # Initialize a neuron with an external diametrizer
32     N = neurots.NeuronGrower(
33         input_distributions=data_dir / "IN_distr.json",
34         input_parameters=data_dir / "IN_params.json",
35         external_diametrizer=build_diameters.build,
36     )
37
38     # Grow the neuron
39     neuron = N.grow()
40
41     # Export the synthesized cell
42     neuron.write(output_dir / "generated_cell.asc")
43     neuron.write(output_dir / "generated_cell.swc")
44     neuron.write(output_dir / "generated_cell.h5")
45
46
47 if __name__ == "__main__":
48     result_dir = Path("results_neuron_external_diameter")
49     result_dir.mkdir(parents=True, exist_ok=True)
50
51     run(result_dir, Path("data"))

Gallery generated by Sphinx-Gallery