injecting continuous normally distributed noise in python

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

Moderator: hines

Post Reply
Posts: 1
Joined: Fri Aug 23, 2019 2:54 pm

injecting continuous normally distributed noise in python

Post by thiank »


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_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
  , t_list, True)
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!

Post Reply