import swc file for network simulation

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
bosse89
Posts: 8
Joined: Tue Jul 08, 2014 2:34 am

import swc file for network simulation

Post by bosse89 »

I have a neuron model in python that works great for single cell simulations.
An swc file is used for importing the morphology:
################################################
Import = h.Import3d_SWC_read()
Import.input('morphology.swc')
imprt = h.Import3d_GUI(Import, 0)
imprt.instantiate(None)
################################################
Other than that the model is similar to the ballandstick model in this tutorial:
http://neuron.yale.edu/neuron/static/do ... tick3.html
My problem is that I can do single cell simulations but when I create multiple cells from the class I can only record from the latest created neuron or else:
#############################################################
Assertion failed: file cabcode.c, line 1455
NEURON: n >= 0.
near line 0
{axon { pt3dadd(0, 66, -3, 1) }}
^
*** longjmp causes uninitialized stack frame ***: /usr/bin/python terminated
######################################################
So I read that if I want to do network-simulations I should not use imprt.instantiate(None) but instead imprt.cbexport(None),
http://www.neuron.yale.edu/phpbb/viewto ... =swc+files
however that does not work either. None of the compartments, e.g. soma, can be found.

Question 1. How is it possible to import a swc file and create a network simulation using only python?
Question 2. Is it possible to automatically convert an swc file into python code of "h.pt3dadd" , "self.dend.connect" etc?
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: import swc file for network simulation

Post by ramcdougal »

For an example addressing both (1) and (2), see the load_swc function in https://github.com/ahwillia/PyNeuron-To ... phology.py

You linked to a prior thread about using SWC morphologies. Remember Ted's cautions: always check the morphology to make sure it is reasonable for your purposes.
bosse89
Posts: 8
Joined: Tue Jul 08, 2014 2:34 am

Re: import swc file for network simulation

Post by bosse89 »

The code worked very well. Thank you!
Post Reply