ted wrote: ↑Fri Jan 31, 2025 3:02 pm
It's not a good idea to do that, unless you enjoy setting booby traps for yourself and anyone who tries to reuse your code. Specification of the mechanisms used by a model should be made by hoc or Python statements.
Hi Ted, thank you for your reply.
I am not sure what you mean and why this is not a good idea or why am I setting a trap for me and others
Let me rephrase in case I have caused a confusion.
I simply want to create a list of strings (bearing the names of the DENSITY mechanisms contained in the rnrmech.dll file) e.g. ['Ka', 'kv', 'CaL', etc] then choose which ones to insert in each compartment of my neuron. My neuron has 1500 compartments and is a biolorealistic neuron from my recordings (Neurolucida reconstruction)
I have 100's of ion channel mechanisms and I would like to be able to choose which ones I insert in my model, then systematically choose others and compare the results on the simulations.
class Morph_HumanNeuron:
def __init__(self, morph_file_path):
# Initialize the cell and load the morphology from the provided .asc file
self.cell = self.load_morphology(morph_file_path)
def load_morphology(self, morph_file_path):
# Import the morphology from the .asc file (Neurolucida)
h.load_file("import3d.hoc")
cell = h.Import3d_Neurolucida3()
cell.input(morph_file_path)
imprt = h.Import3d_GUI(cell, False)
imprt.instantiate(None)
morph_plot = h.PlotShape( )
return cell, morph_plot
def create_secList(self):
# Create a list of all sections (compartments) in the cell
secList = []
for sec in h.allsec():
secList.append(sec)
return secList
def create_mechList(self):
# Create a list of all DENSITY MECHANISMS available
mechList = []
HOW DO I SNIFF OUT THE DENSITY MECHANISM NAMES
THAT HAVE BEEN LOADED VIA THER NRNMECH.DLL AND ARE AVAILABLE FOR USE?
return mechList
def insert_mechanism(self):
# Insert the mechanism desired into specific sections or based on section type
for idx, sec in enumerate(secList):
if sec == secList[0]:
print('soma found')
sec.nseg = 1
sec.cm = 1
sec.Ra = 35.4
for seg in sec:
# simply load just the the two first density mechnims of the mechList
sec.insert(mechList[0])
sec.insert(mechList[1]))
elif sec == secList[1]:
print('axon found')
sec.nseg = 1
sec.cm = 1
sec.Ra = 35.4
for seg in sec:
sec.insert('hh')
sec.gnabar_hh = 0.72
sec.gkbar_hh = 0.035
sec.gl_hh = 3e-4
sec.el_hh = -74.3
sec.ek = -97
else:
sec.nseg = 10
sec.cm = 1
sec.Ra = 35.4
for seg in sec:
sec.insert('pas')
sec.g_pas = 0.001
sec.e_pas = -74.3