# Nuerosimulation

Dear supporter,
I want to distribute axons (more than 100) in my geometry (a cylinder) to investigate the interaction between my electric fields and axons and determine the activated axons in my model. How can I do that automatically?
Thanks a lot.

Dear Farima,
you can use Python scripts to do that quickly and precisely. The first thing to do is to write a script that sample N=100 (x,y) coordinates within the radius of the cylinder according to a distribution that you want (random, uniform, etc.). Then you can create trajectories as polylines for each sampled point. Something like that:

``````import s4l_v1 as s4l
import numpy as np
from s4l_v1 import Vec3

Z=100 # length of the cylinder (mm)
N=100 # N axons

## Creates a folder in the Model Panel
folder=s4l.model.CreateGroup('Axon Trajectories')

points=[]
cnt=0

while cnt<N:
# Creates Randomly Distributed Points
x=2*R*(-0.5+np.random.rand());
y=2*R*(-0.5+np.random.rand())

if (x*x+y*y<R*R):
axon=s4l.model.CreatePolyLine([Vec3(x,y,-0.5*Z),Vec3(x,y,+0.5*Z)])
axon.Name='Axon_'+str(cnt)