Open hernanhd14 opened 4 years ago
it didn't go really well. Hi,
did you get an error message or something ? do you have a screenshot that shows the issue ?
Hi, not really. It wasn't an error of the codes... I supposed it is the wrong answer. But I can't develop what is it the mistake?
Hi, my name is Hernan. I did the assignment of the week 3 and it didn't go really well. I don't know if I can submit it again? Can someone help me with that? This is what I did... neuron.h.load_file("stdrun.hoc"); neuron.h.stdinit();
Define soma
soma = neuron.h.Section(name='soma') soma.L = 40 soma.diam = 40 soma.insert('hh'); soma.gl_hh = 5e-4 # Leak conductance, S/cm^2 soma.el_hh = -65 # Reversal potential leak current, mV soma.gkbar_hh = 0.0 # in S/cm^2 soma.gnabar_hh = 0.0
Define dendrite
dend = neuron.h.Section(name='dend') dend.connect(soma) dend.insert('hh') dend.el_hh = -65 # Reversal potential leak current, mV dend.gl_hh = 5e-4 # Leak conductance, S/cm^2 dend.gkbar_hh = 0.0 dend.gnabar_hh = 0.0 dend.L = 400 # micron dend.nseg = 51 # number of segments in the dendritic section dend.Ra = 200
Record voltage
time = neuron.h.Vector() voltage = neuron.h.Vector()
time.record(neuron.h._ref_t) voltage.record(dend(0)._ref_v);
def plot_tv(time_array, voltage_array, show=True, label=None, constants=[]): import matplotlib.pyplot as plt import numpy plt.plot(time_array, voltage_array, label=label) for constant in constants: plt.plot(time_array, constant*numpy.ones(len(time_array))) plt.xlabel('Time (ms)') plt.ylabel('Membrane voltage (mV)') if show: plt.show()
Add synapse
expsyn = neuron.h.ExpSyn(0.5, sec=dend) netstim = neuron.h.NetStim() netstim.interval = 1 netstim.number = 1 netstim.start = 20 netstim.noise = 0
netcon = neuron.h.NetCon(netstim, expsyn) netcon.weight[0] = .01 neuron.h.tstop = 100 neuron.h.run()
How affects diameter in our attenuation
diameter_vector = {} atts = []
diameter_range = numpy.linspace(0.1, 10.0, 20) for dend_diameter in diameter_range: dend.diam = dend_diameter diameter_vector[dend_diameter] = numpy.array(voltage)
plt.show()
epsp_size1 = [] a = [] for dend_diameter in diameter_range:
Get the EPSP size by subtracting the min (baseline) voltage from the max voltage
Bring x[0] to 0.0
x = diameter_range-diameter_range[0]
Normalize
y = epsp_size1/epsp_size1[0]
Fit a linear line to log plot
a , b = numpy.polyfit(x, numpy.log(y), 1)
exp_decay_constant = a
x1 = numpy.log(diameter_range) y1 = numpy.log(y)
Plot the data
plt.plot(x1, y1, 'o')
Plot the fit
plt.plot(x1, a*x1 + b)
plt.xlabel('log diameter') plt.ylabel('log Max voltage (mV)') plt.show()
print('Exponential decay constant of EPSPs: %f' % exp_decay_constant)