Note
Go to the end to download the full example code.
Synthesize a single neuronΒΆ
This example shows how to synthesize a single cell with simple parameters.
14 from pathlib import Path
15
16 import neurots
17
18
19 def run(output_dir, data_dir):
20 """Run the example for generating a single cell."""
21 # Initialize a neuron
22 N = neurots.NeuronGrower(
23 input_distributions=data_dir / "bio_distr.json",
24 input_parameters=data_dir / "bio_params.json",
25 )
26
27 # Grow the neuron
28 neuron = N.grow()
29
30 # Export the synthesized cell
31 neuron.write(output_dir / "generated_cell.asc")
32 neuron.write(output_dir / "generated_cell.swc")
33 neuron.write(output_dir / "generated_cell.h5")
34
35
36 if __name__ == "__main__":
37 result_dir = Path("results_single_neuron")
38 result_dir.mkdir(parents=True, exist_ok=True)
39
40 run(result_dir, Path("data"))