Synthesize a population of neurons with the same parametersΒΆ

This example shows how to synthesize a population of cells with the same parameters for all of them.

14 from pathlib import Path
15
16 import numpy as np
17
18 import neurots
19
20
21 def run(output_dir, data_dir):
22     """Run the example for generating a population of cells with the same parameters."""
23     num_cells = 10
24
25     # Generate any number of cells, based on the same input
26     for i in np.arange(num_cells):
27         # Initialize a neuron
28         N = neurots.NeuronGrower(
29             input_distributions=data_dir / "bio_distr.json",
30             input_parameters=data_dir / "bio_params.json",
31         )
32
33         # Grow the neuron
34         neuron = N.grow()
35
36         # Export the synthesized cell
37         neuron.write(output_dir / f"generated_cell_{i}.swc")
38
39
40 if __name__ == "__main__":
41     result_dir = Path("results_neurons")
42     result_dir.mkdir(parents=True, exist_ok=True)
43
44     run(result_dir, Path("data"))

Gallery generated by Sphinx-Gallery