Note
Click here to download the full example code
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.
25 from pathlib import Path
26
27 import numpy as np
28
29 import neurots
30
31
32 def run(output_dir, data_dir):
33 """Run the example for generating a population of cells with the same parameters."""
34 num_cells = 10
35
36 # Generate any number of cells, based on the same input
37 for i in np.arange(num_cells):
38 # Initialize a neuron
39 N = neurots.NeuronGrower(
40 input_distributions=data_dir / "bio_distr.json",
41 input_parameters=data_dir / "bio_params.json",
42 )
43
44 # Grow the neuron
45 neuron = N.grow()
46
47 # Export the synthesized cell
48 neuron.write(output_dir / f"generated_cell_{i}.swc")
49
50
51 if __name__ == "__main__":
52 result_dir = Path("results_neurons")
53 result_dir.mkdir(parents=True, exist_ok=True)
54
55 run(result_dir, Path("data"))