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.

33 from pathlib import Path
34
35 from diameter_synthesis import build_diameters  # pylint: disable=import-error
36
37 import neurots
38
39
40 def run(output_dir, data_dir):
41     """Run the example for generating a cell with external diametrizer."""
42     # Initialize a neuron with an external diametrizer
43     N = neurots.NeuronGrower(
44         input_distributions=data_dir / "IN_distr.json",
45         input_parameters=data_dir / "IN_params.json",
46         external_diametrizer=build_diameters.build,
47     )
48
49     # Grow the neuron
50     neuron = N.grow()
51
52     # Export the synthesized cell
53     neuron.write(output_dir / "generated_cell.asc")
54     neuron.write(output_dir / "generated_cell.swc")
55     neuron.write(output_dir / "generated_cell.h5")
56
57
58 if __name__ == "__main__":
59     result_dir = Path("results_neuron_external_diameter")
60     result_dir.mkdir(parents=True, exist_ok=True)
61
62     run(result_dir, Path("data"))

Gallery generated by Sphinx-Gallery