Note
Click here to download the full example code
Synthesize a single neuronΒΆ
This example shows how to synthesize a single cell with simple parameters.
25 from pathlib import Path
26
27 import neurots
28
29
30 def run(output_dir, data_dir):
31 """Run the example for generating a single cell."""
32 # Initialize a neuron
33 N = neurots.NeuronGrower(
34 input_distributions=data_dir / "bio_distr.json",
35 input_parameters=data_dir / "bio_params.json",
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_single_neuron")
49 result_dir.mkdir(parents=True, exist_ok=True)
50
51 run(result_dir, Path("data"))