@@ -1356,6 +1356,34 @@ class QuaIF(Neuron):
13561356 V : HiddenState
13571357 Membrane potential.
13581358
1359+ Examples
1360+ --------
1361+ >>> import brainpy
1362+ >>> import brainstate
1363+ >>> import brainunit as u
1364+ >>>
1365+ >>> # Create a QuaIF neuron layer with 10 neurons
1366+ >>> quaif = brainpy.state.QuaIF(10, tau=10*u.ms, V_th=-30*u.mV, V_c=-50*u.mV)
1367+ >>>
1368+ >>> # Initialize the state
1369+ >>> quaif.init_state(batch_size=1)
1370+ >>>
1371+ >>> # Apply an input current and update the neuron state
1372+ >>> spikes = quaif.update(x=2.5*u.mA)
1373+ >>>
1374+ >>> # Create a network with QuaIF neurons
1375+ >>> network = brainstate.nn.Sequential([
1376+ ... brainpy.state.QuaIF(100, tau=10.0*u.ms),
1377+ ... brainstate.nn.Linear(100, 10)
1378+ ... ])
1379+
1380+ Notes
1381+ -----
1382+ - The quadratic nonlinearity provides a more realistic spike initiation compared to LIF.
1383+ - The critical voltage V_c determines the onset of spike generation.
1384+ - When V approaches V_c, the quadratic term causes rapid acceleration toward threshold.
1385+ - This model can exhibit Type I excitability (continuous f-I curve).
1386+
13591387 References
13601388 ----------
13611389 .. [1] P. E. Latham, B.J. Richmond, P. Nelson and S. Nirenberg
@@ -1479,6 +1507,36 @@ class AdQuaIF(Neuron):
14791507 w : HiddenState
14801508 Adaptation current.
14811509
1510+ Examples
1511+ --------
1512+ >>> import brainpy
1513+ >>> import brainstate
1514+ >>> import brainunit as u
1515+ >>>
1516+ >>> # Create an AdQuaIF neuron layer with 10 neurons
1517+ >>> adquaif = brainpy.state.AdQuaIF(10, tau=10*u.ms, tau_w=100*u.ms,
1518+ ... a=1.0*u.siemens, b=0.1*u.mA)
1519+ >>>
1520+ >>> # Initialize the state
1521+ >>> adquaif.init_state(batch_size=1)
1522+ >>>
1523+ >>> # Apply an input current and observe spike-frequency adaptation
1524+ >>> spikes = adquaif.update(x=3.0*u.mA)
1525+ >>>
1526+ >>> # Create a network with adaptive neurons
1527+ >>> network = brainstate.nn.Sequential([
1528+ ... brainpy.state.AdQuaIF(100, tau=10.0*u.ms, tau_w=100.0*u.ms),
1529+ ... brainstate.nn.Linear(100, 10)
1530+ ... ])
1531+
1532+ Notes
1533+ -----
1534+ - The adaptation current w provides negative feedback, reducing firing rate.
1535+ - Parameter 'a' controls subthreshold adaptation (coupling from V to w).
1536+ - Parameter 'b' controls spike-triggered adaptation (increment after spike).
1537+ - With appropriate parameters, can exhibit regular spiking, bursting, etc.
1538+ - The adaptation time constant tau_w determines adaptation speed.
1539+
14821540 References
14831541 ----------
14841542 .. [1] Izhikevich, E. M. (2004). Which model to use for cortical spiking
@@ -1616,6 +1674,37 @@ class AdQuaIFRef(Neuron):
16161674 Last spike time recorder.
16171675 refractory : HiddenState
16181676 Neuron refractory state (if ref_var=True).
1677+
1678+ Examples
1679+ --------
1680+ >>> import brainpy
1681+ >>> import brainstate
1682+ >>> import brainunit as u
1683+ >>>
1684+ >>> # Create an AdQuaIFRef neuron layer with refractory period
1685+ >>> adquaif_ref = brainpy.state.AdQuaIFRef(10, tau=10*u.ms, tau_w=100*u.ms,
1686+ ... tau_ref=2.0*u.ms, ref_var=True)
1687+ >>>
1688+ >>> # Initialize the state
1689+ >>> adquaif_ref.init_state(batch_size=1)
1690+ >>>
1691+ >>> # Apply input and observe refractory behavior
1692+ >>> with brainstate.environ.context(dt=0.1*u.ms, t=0.0*u.ms):
1693+ ... spikes = adquaif_ref.update(x=3.0*u.mA)
1694+ >>>
1695+ >>> # Create a network with refractory adaptive neurons
1696+ >>> network = brainstate.nn.Sequential([
1697+ ... brainpy.state.AdQuaIFRef(100, tau=10.0*u.ms, tau_ref=2.0*u.ms),
1698+ ... brainstate.nn.Linear(100, 10)
1699+ ... ])
1700+
1701+ Notes
1702+ -----
1703+ - Combines spike-frequency adaptation with absolute refractory period.
1704+ - During refractory period, neuron state is held at reset values.
1705+ - Set ref_var=True to track refractory state as a boolean variable.
1706+ - Refractory period prevents unrealistically high firing rates.
1707+ - More biologically realistic than AdQuaIF without refractory period.
16191708 """
16201709 __module__ = 'brainpy'
16211710
@@ -1809,6 +1898,37 @@ class Gif(Neuron):
18091898 V_th : HiddenState
18101899 Spiking threshold potential.
18111900
1901+ Examples
1902+ --------
1903+ >>> import brainpy
1904+ >>> import brainstate
1905+ >>> import brainunit as u
1906+ >>>
1907+ >>> # Create a Gif neuron layer with dynamic threshold
1908+ >>> gif = brainpy.state.Gif(10, tau=20*u.ms, k1=0.2/u.ms, k2=0.02/u.ms,
1909+ ... a=0.005/u.ms, b=0.01/u.ms)
1910+ >>>
1911+ >>> # Initialize the state
1912+ >>> gif.init_state(batch_size=1)
1913+ >>>
1914+ >>> # Apply input and observe diverse firing patterns
1915+ >>> spikes = gif.update(x=1.5*u.mA)
1916+ >>>
1917+ >>> # Create a network with Gif neurons
1918+ >>> network = brainstate.nn.Sequential([
1919+ ... brainpy.state.Gif(100, tau=20.0*u.ms),
1920+ ... brainstate.nn.Linear(100, 10)
1921+ ... ])
1922+
1923+ Notes
1924+ -----
1925+ - The Gif model uses internal currents (I1, I2) for complex dynamics.
1926+ - Dynamic threshold V_th adapts based on membrane potential and its own dynamics.
1927+ - Can reproduce diverse firing patterns: regular spiking, bursting, adaptation.
1928+ - Parameters a and b control threshold adaptation.
1929+ - Parameters k1, k2, R1, R2, A1, A2 control internal current dynamics.
1930+ - More flexible than simpler IF models for matching biological data.
1931+
18121932 References
18131933 ----------
18141934 .. [1] Mihalaş, Ştefan, and Ernst Niebur. "A generalized linear
@@ -1998,6 +2118,38 @@ class GifRef(Neuron):
19982118 Last spike time recorder.
19992119 refractory : HiddenState
20002120 Neuron refractory state (if ref_var=True).
2121+
2122+ Examples
2123+ --------
2124+ >>> import brainpy
2125+ >>> import brainstate
2126+ >>> import brainunit as u
2127+ >>>
2128+ >>> # Create a GifRef neuron layer with refractory period
2129+ >>> gif_ref = brainpy.state.GifRef(10, tau=20*u.ms, tau_ref=2.0*u.ms,
2130+ ... k1=0.2/u.ms, k2=0.02/u.ms, ref_var=True)
2131+ >>>
2132+ >>> # Initialize the state
2133+ >>> gif_ref.init_state(batch_size=1)
2134+ >>>
2135+ >>> # Apply input and observe refractory behavior
2136+ >>> with brainstate.environ.context(dt=0.1*u.ms, t=0.0*u.ms):
2137+ ... spikes = gif_ref.update(x=1.5*u.mA)
2138+ >>>
2139+ >>> # Create a network with refractory Gif neurons
2140+ >>> network = brainstate.nn.Sequential([
2141+ ... brainpy.state.GifRef(100, tau=20.0*u.ms, tau_ref=2.0*u.ms),
2142+ ... brainstate.nn.Linear(100, 10)
2143+ ... ])
2144+
2145+ Notes
2146+ -----
2147+ - Combines Gif model's rich dynamics with absolute refractory period.
2148+ - During refractory period, all state variables are held at reset values.
2149+ - Set ref_var=True to track refractory state as a boolean variable.
2150+ - More biologically realistic than Gif without refractory mechanism.
2151+ - Can still exhibit diverse firing patterns: regular, bursting, adaptation.
2152+ - Refractory period prevents unrealistically high firing rates.
20012153 """
20022154 __module__ = 'brainpy'
20032155
0 commit comments