Hey everyone,
I’m working on a two-layer network in Brian2 and encountering some strange behavior. The first layer of neurons receives a fixed input rate for each neuron, and I’m defining the NeuronGroup
like this:
globals()[name_prefix] = NeuronGroup(total_neurons, inp_eqs, threshold='rand() < rate*dt',
method='euler', name=name_prefix)
The input equation (inp_eqs
) is as follows:
inp_eqs = '''
unit_idx : integer (constant)
x : 1
y : 1
rate = input_array(t, i) : Hz
'''
For the input, I want the neurons to receive a specific rate for the first 100ms, and then for the next 100ms, only the background firing should be present. The input array is constructed as follows:
# Combine input from two populations with their respective background rates
input_array = np.hstack((self.amp_inp[0] * input[0] + self.bg_inp_rate[0],
self.amp_inp[1] * input[1] + self.bg_inp_rate[1]))
# Create an array of background rates for the second 100ms
half_length = input_array.size // 2
zero_array = np.hstack((np.full(half_length, self.bg_inp_rate[0]),
np.full(half_length, self.bg_inp_rate[1])))
# Stack the input rates and background rates
combined_array = np.vstack([input_array, zero_array])
# Use TimedArray to apply this input over time
input_mat = np.tile(combined_array, (1, 1)) # Adjust the tiling if needed
self.input_array = TimedArray(input_mat * Hz, dt=self.dur_rep)
After this first layer, the second layer is receiving the spiking activity of the neurons in the excitatory population and connects to an inhibitory population. However, I’m seeing some weird spiking activity in the second layer.
Problems I’m facing:
- The firing rate of the first layer neurons doesn’t seem to behave as expected. I’m seeing odd fluctuations that don’t match the input rate over time.
- The second layer, which should be influenced by the first layer’s spiking activity, shows strange, unpredictable patterns of spiking, especially high spiking activity at the begining of the simulation.
Does anyone have any ideas about why this might be happening? Any tips on debugging the firing rates or dealing with spiking activity transfer between layers in Brian2 would be much appreciated.
Thanks in advance!