Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Simulations & Solvers
  4. Nuerosimulation

Nuerosimulation

Scheduled Pinned Locked Moved Simulations & Solvers
2 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fariba_karimi
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • AntoninoMCA Offline
      AntoninoMCA Offline
      AntoninoMC
      wrote on last edited by AntoninoMC
      #2

      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
      
      R=10 # Radius (mm)
      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)
      		folder.Add(axon)
      		cnt+=1
      
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Search