# From QIF equations to a working Brian2 implementation

Hello everyone! I started reproducing this model using Brian2. I am using the QIF equations that they have quoted in the figure below:

The details, including the parameter selection, are posted in the paper, but the values are not as important for this post as the actual implementation (which is an elegant way of saying that I struggled to make a complete table and eventually gave up).

My questions are as follows:

1. How would you implement the neurons? The QIF equations in the provided examples are different and with a different set of variables. Also, using `Vm**2` gives back units in voltage squared (expected).
2. The refractory period is set in the paper as `2/Vk` where `Vk` is the voltage of the neuron right before the spike. How would you write something like that? I tried using `refractory='2/Vm'` but it is obviously not working.
3. Lastly, how would you write the synaptic equations and the `on_pre` statement? `J_ln` is the weight to add/subtract to the membrane voltage, like in the simple LIF examples.

Hi @nvar. This is a very abstract model that is convenient for analytical results, but not so much for simulation. For example, the membrane potential is supposed to be reset to -∞, and a spike happens when it goes to +∞… From a quick look at the paper they cite, it seems that as if for actual simulations they use values of ±100 instead of ∞. The “refractory period” is the time it takes from 100 to ∞ and from -∞ to -100, which apparently is 2/Vk “time units”. I discussed abstract equations that do not have actual time quantities in seconds in this post: Coupled Van der Pol oscillators - #2 by mstimberg
The same applies here. In models like this, the membrane potential would not be in volt, but just a dimensionless quantity – a number of Brian examples use this approach as well: Example: non_reliability — Brian 2 2.5.0.3 documentation Having the value squared is not a problem then.
Regarding the refractoriness, this is also expressed relative to some time unit. In principle there’d be ways to make this dependent on the exact value of the membrane potential when it crossed the threshold, but I guess just using the value of the threshold should be good enough (I think the 2/Vk kind of assumes this, in fact).

The `on_pre` statement is the most straightforward: this is actually the same as in the simple LIF examples, each spike makes the membrane potential jump up by the given amount. There is an additional normalization term, but you could simply include this in the weight.

Hope that helps a bit!

1 Like

Yes, it helps quite a lot, thank you for your reply and the references, on point as always!

1 Like