injecting continuous normally distributed noise in python
Posted: Sun Aug 25, 2019 10:57 pm
Hi,
I've been trying to insert normally distributed noise onto my cells via IClamp, but the amp can only be set to one number/integer/float. I have a vector of say 1x1000 (1 per ms) that I want to set as the amp value. I guess one way would be to make a 1000 instances of the IClamp set at each time point, but that seems rather brutish.
I've looked through the previous post on this matter, where Ted posted the hoc code to do this (viewtopic.php?t=2986), but I'm looking to build my network using Python as the interpreter.
If there is another solution I would be happy to pursue it. I would also be happy with some guidance/pointers on where to look/how I could translate the hoc code into a python format. I have access to the NEURON book as well.
Thanks in advance!
Ian
I've been trying to insert normally distributed noise onto my cells via IClamp, but the amp can only be set to one number/integer/float. I have a vector of say 1x1000 (1 per ms) that I want to set as the amp value. I guess one way would be to make a 1000 instances of the IClamp set at each time point, but that seems rather brutish.
Code: Select all
def Insert_Noise(self, noise_mean, noise_std_dev):
noise_mean, noise_std_dev = 1, 0.5
self.noise_list = []
for idx1 in range(self.N):
t_list = np.arange(0,self.stop_time,h.dt)
noise_current = np.random.normal(noise_mean, noise_std_dev, len(t_list))
noise_current_vector = h.Vector()
noise_current_vector.from_python(noise_current)
noise_input = h.IClamp(0.5, sec = self.cells[idx1].soma)
noise_input.delay = 0
noise_input.dur = 1e9
#noise_input.amp = 0.1#noise_current_vector
noise_current_vector.play(noise_input.amp, t_list, True)
self.noise_list.append(noise_input)
If there is another solution I would be happy to pursue it. I would also be happy with some guidance/pointers on where to look/how I could translate the hoc code into a python format. I have access to the NEURON book as well.
Thanks in advance!
Ian