# Description of problem

HI,

I’m working on a analog circuit implementation of lif neuruons. Meanwhile, I’m considering using brian to simulate it. The analog neuron, which is essentially a leaky integrator, can be modeled simply by an ode. However, the spike cannot be an ideal impulse, it’s more like a rectangle waveform. in brian2, the spike is more like a event, which triggers other state variables. Is there any way to implement spike with shapes?

Thanks.

# Full traceback of error (if relevant)

Hi,

I had a similar problem and I solved it by kinda “hacking” Brian.
Check this out:

C, gL, EL  = 200*pF, 4*nS, -70*mV
eqs = ('dV/dt = (gL * (EL-V) + I) / C  :volt \n'
'I  :amp')

neuron = NeuronGroup(1, model=eqs, threshold= 'V>-40*mV', method='euler',
reset ='V = 30*mV', refractory=4*ms)
neuron.V = -70*mV

second_reset = Synapses(neuron, neuron, on_pre='V=-50*mV', delay=0.5*ms)
second_reset.connect(j='i')

Instead of using a single reset value, I introduced a second reset with a self-synapse.
When Vth is crossed, the voltage goes to 30 mV and after a delay of 0.5 ms it goes
to the “normal” reset at -50 mV. I don’t know if this is the best way to achieve more realistic
spikes, but for me, it works well. Also by adjusting the delay you can calibrate the “half amplitude”

I hope I helped

I think you might also be able to do the same thing with custom events: https://brian2.readthedocs.io/en/stable/advanced/custom_events.html