Skip to content

Model Zoo

Plugin-based neuron model zoo with auto-Verilog generation and auto-documentation. Ships with LIF, Izhikevich, AdEx, and Hodgkin-Huxley.

Quick Start

Python
from sc_neurocore.model_zoo.model_zoo import (
    PluginRegistry, VerilogGenerator, DocGenerator,
    LIFPlugin, IzhikevichPlugin, AdExPlugin,
)

sc_neurocore.model_zoo.model_zoo

Community model zoo with plugin-based neuron models and Verilog generation.

Provides an abstract NeuronPlugin base class that downstream contributors extend to define custom neuron dynamics. Built-in plugins cover the canonical spiking neuron models (LIF, Izhikevich, AdEx, Hodgkin–Huxley). The VerilogGenerator converts any plugin into synthesisable SystemVerilog suitable for FPGA deployment, and the DocGenerator emits markdown documentation from plugin metadata.

NeuronState dataclass

Generic state container for neuron models.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@dataclass
class NeuronState:
    """Generic state container for neuron models."""

    variables: Dict[str, float] = field(default_factory=dict)

    def __getitem__(self, key: str) -> float:
        """Return a state variable by name."""
        return self.variables[key]

    def __setitem__(self, key: str, value: float) -> None:
        """Assign a state variable by name."""
        self.variables[key] = value

    def copy(self) -> NeuronState:
        """Return an independent copy of this neuron state."""
        return NeuronState(variables=dict(self.variables))

    def as_dict(self) -> Dict[str, float]:
        """Return state variables as a plain dictionary."""
        return dict(self.variables)

__getitem__(key)

Return a state variable by name.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
83
84
85
def __getitem__(self, key: str) -> float:
    """Return a state variable by name."""
    return self.variables[key]

__setitem__(key, value)

Assign a state variable by name.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
87
88
89
def __setitem__(self, key: str, value: float) -> None:
    """Assign a state variable by name."""
    self.variables[key] = value

copy()

Return an independent copy of this neuron state.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
91
92
93
def copy(self) -> NeuronState:
    """Return an independent copy of this neuron state."""
    return NeuronState(variables=dict(self.variables))

as_dict()

Return state variables as a plain dictionary.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
95
96
97
def as_dict(self) -> Dict[str, float]:
    """Return state variables as a plain dictionary."""
    return dict(self.variables)

PluginMeta dataclass

Metadata carried by every neuron plugin.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
100
101
102
103
104
105
106
107
108
109
110
@dataclass
class PluginMeta:
    """Metadata carried by every neuron plugin."""

    name: str
    version: str
    author: str
    description: str
    references: List[str] = field(default_factory=list)
    parameters: Dict[str, str] = field(default_factory=dict)
    state_variables: List[str] = field(default_factory=list)

NeuronPlugin

Bases: ABC

Abstract base class for pluggable neuron models.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
class NeuronPlugin(ABC):
    """Abstract base class for pluggable neuron models."""

    @abstractmethod
    def meta(self) -> PluginMeta:
        """Return metadata describing this neuron plugin."""
        ...

    @abstractmethod
    def default_state(self) -> NeuronState:
        """Return the default state for a new neuron instance."""
        ...

    @abstractmethod
    def default_params(self) -> Dict[str, float]:
        """Return default parameters for the neuron dynamics."""
        ...

    @abstractmethod
    def ode_dynamics(
        self,
        state: NeuronState,
        current: float,
        params: Dict[str, float],
        dt: float,
    ) -> NeuronState:
        """Advance the neuron state by one timestep *dt*."""
        ...

    @abstractmethod
    def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
        """Return True if the neuron has fired."""
        ...

    @abstractmethod
    def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
        """Reset state after a spike."""
        ...

    def simulate(
        self,
        current_trace: np.ndarray[Any, Any],
        dt: float = 0.001,
        params: Optional[Dict[str, float]] = None,
    ) -> Tuple[np.ndarray[Any, Any], List[int]]:
        """Simulate the neuron response to a current trace.

        Parameters
        ----------
        current_trace:
            One-dimensional numeric current samples. Values must be finite.
        dt:
            Positive integration timestep in seconds.
        params:
            Optional finite real-valued parameter mapping. Defaults to the
            plugin's canonical parameters.

        Returns
        -------
        tuple[numpy.ndarray, list[int]]
            Membrane-voltage trace and spike indices.

        Raises
        ------
        ValueError
            If the current trace, timestep, or parameter mapping is malformed.
        """
        step = _validate_simulation_timestep(dt)
        trace = _validate_current_trace(current_trace)
        p = _validate_simulation_params(params if params is not None else self.default_params())
        state = self.default_state()
        voltages = np.zeros(len(trace), dtype=np.float64)
        spikes: List[int] = []
        for i, I_ext in enumerate(trace):
            state = self.ode_dynamics(state, float(I_ext), p, step)
            if self.threshold_check(state, p):
                spikes.append(i)
                state = self.reset(state, p)
            voltages[i] = state["V"]
        return voltages, spikes

meta() abstractmethod

Return metadata describing this neuron plugin.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
116
117
118
119
@abstractmethod
def meta(self) -> PluginMeta:
    """Return metadata describing this neuron plugin."""
    ...

default_state() abstractmethod

Return the default state for a new neuron instance.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
121
122
123
124
@abstractmethod
def default_state(self) -> NeuronState:
    """Return the default state for a new neuron instance."""
    ...

default_params() abstractmethod

Return default parameters for the neuron dynamics.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
126
127
128
129
@abstractmethod
def default_params(self) -> Dict[str, float]:
    """Return default parameters for the neuron dynamics."""
    ...

ode_dynamics(state, current, params, dt) abstractmethod

Advance the neuron state by one timestep dt.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
131
132
133
134
135
136
137
138
139
140
@abstractmethod
def ode_dynamics(
    self,
    state: NeuronState,
    current: float,
    params: Dict[str, float],
    dt: float,
) -> NeuronState:
    """Advance the neuron state by one timestep *dt*."""
    ...

threshold_check(state, params) abstractmethod

Return True if the neuron has fired.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
142
143
144
145
@abstractmethod
def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
    """Return True if the neuron has fired."""
    ...

reset(state, params) abstractmethod

Reset state after a spike.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
147
148
149
150
@abstractmethod
def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
    """Reset state after a spike."""
    ...

simulate(current_trace, dt=0.001, params=None)

Simulate the neuron response to a current trace.

Parameters

current_trace: One-dimensional numeric current samples. Values must be finite. dt: Positive integration timestep in seconds. params: Optional finite real-valued parameter mapping. Defaults to the plugin's canonical parameters.

Returns

tuple[numpy.ndarray, list[int]] Membrane-voltage trace and spike indices.

Raises

ValueError If the current trace, timestep, or parameter mapping is malformed.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
def simulate(
    self,
    current_trace: np.ndarray[Any, Any],
    dt: float = 0.001,
    params: Optional[Dict[str, float]] = None,
) -> Tuple[np.ndarray[Any, Any], List[int]]:
    """Simulate the neuron response to a current trace.

    Parameters
    ----------
    current_trace:
        One-dimensional numeric current samples. Values must be finite.
    dt:
        Positive integration timestep in seconds.
    params:
        Optional finite real-valued parameter mapping. Defaults to the
        plugin's canonical parameters.

    Returns
    -------
    tuple[numpy.ndarray, list[int]]
        Membrane-voltage trace and spike indices.

    Raises
    ------
    ValueError
        If the current trace, timestep, or parameter mapping is malformed.
    """
    step = _validate_simulation_timestep(dt)
    trace = _validate_current_trace(current_trace)
    p = _validate_simulation_params(params if params is not None else self.default_params())
    state = self.default_state()
    voltages = np.zeros(len(trace), dtype=np.float64)
    spikes: List[int] = []
    for i, I_ext in enumerate(trace):
        state = self.ode_dynamics(state, float(I_ext), p, step)
        if self.threshold_check(state, p):
            spikes.append(i)
            state = self.reset(state, p)
        voltages[i] = state["V"]
    return voltages, spikes

LIFPlugin

Bases: NeuronPlugin

Leaky Integrate-and-Fire neuron model.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
class LIFPlugin(NeuronPlugin):
    """Leaky Integrate-and-Fire neuron model."""

    def meta(self) -> PluginMeta:
        """Return LIF plugin metadata and parameter documentation."""
        return PluginMeta(
            name="LIF",
            version="1.0.0",
            author="Miroslav Šotek",
            description="Leaky Integrate-and-Fire with exponential decay.",
            references=["Lapicque, J. Physiol. Pathol. Gén. 9, 1907."],
            parameters={
                "tau_m": "Membrane time constant (s)",
                "V_rest": "Resting potential (V)",
                "V_thresh": "Spike threshold (V)",
                "V_reset": "Reset potential (V)",
                "R_m": "Membrane resistance (Ω)",
            },
            state_variables=["V"],
        )

    def default_state(self) -> NeuronState:
        """Return the resting LIF membrane state."""
        return NeuronState({"V": -0.070})

    def default_params(self) -> Dict[str, float]:
        """Return default SI-valued LIF parameters."""
        return {
            "tau_m": 0.020,
            "V_rest": -0.070,
            "V_thresh": -0.055,
            "V_reset": -0.075,
            "R_m": 1e7,
        }

    def ode_dynamics(
        self, state: NeuronState, current: float, params: Dict[str, float], dt: float
    ) -> NeuronState:
        """Advance LIF membrane voltage by one Euler step."""
        s = state.copy()
        tau = params["tau_m"]
        V = s["V"]
        dV = (-(V - params["V_rest"]) + params["R_m"] * current) / tau
        s["V"] = V + dV * dt
        return s

    def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
        """Return whether the LIF voltage crosses threshold."""
        return state["V"] >= params["V_thresh"]

    def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
        """Reset LIF membrane voltage after a spike."""
        s = state.copy()
        s["V"] = params["V_reset"]
        return s

meta()

Return LIF plugin metadata and parameter documentation.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
def meta(self) -> PluginMeta:
    """Return LIF plugin metadata and parameter documentation."""
    return PluginMeta(
        name="LIF",
        version="1.0.0",
        author="Miroslav Šotek",
        description="Leaky Integrate-and-Fire with exponential decay.",
        references=["Lapicque, J. Physiol. Pathol. Gén. 9, 1907."],
        parameters={
            "tau_m": "Membrane time constant (s)",
            "V_rest": "Resting potential (V)",
            "V_thresh": "Spike threshold (V)",
            "V_reset": "Reset potential (V)",
            "R_m": "Membrane resistance (Ω)",
        },
        state_variables=["V"],
    )

default_state()

Return the resting LIF membrane state.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
219
220
221
def default_state(self) -> NeuronState:
    """Return the resting LIF membrane state."""
    return NeuronState({"V": -0.070})

default_params()

Return default SI-valued LIF parameters.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
223
224
225
226
227
228
229
230
231
def default_params(self) -> Dict[str, float]:
    """Return default SI-valued LIF parameters."""
    return {
        "tau_m": 0.020,
        "V_rest": -0.070,
        "V_thresh": -0.055,
        "V_reset": -0.075,
        "R_m": 1e7,
    }

ode_dynamics(state, current, params, dt)

Advance LIF membrane voltage by one Euler step.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
233
234
235
236
237
238
239
240
241
242
def ode_dynamics(
    self, state: NeuronState, current: float, params: Dict[str, float], dt: float
) -> NeuronState:
    """Advance LIF membrane voltage by one Euler step."""
    s = state.copy()
    tau = params["tau_m"]
    V = s["V"]
    dV = (-(V - params["V_rest"]) + params["R_m"] * current) / tau
    s["V"] = V + dV * dt
    return s

threshold_check(state, params)

Return whether the LIF voltage crosses threshold.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
244
245
246
def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
    """Return whether the LIF voltage crosses threshold."""
    return state["V"] >= params["V_thresh"]

reset(state, params)

Reset LIF membrane voltage after a spike.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
248
249
250
251
252
def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
    """Reset LIF membrane voltage after a spike."""
    s = state.copy()
    s["V"] = params["V_reset"]
    return s

IzhikevichPlugin

Bases: NeuronPlugin

Izhikevich (2003) simple model of spiking neurons.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
class IzhikevichPlugin(NeuronPlugin):
    """Izhikevich (2003) simple model of spiking neurons."""

    def meta(self) -> PluginMeta:
        """Return Izhikevich plugin metadata and parameter documentation."""
        return PluginMeta(
            name="Izhikevich",
            version="1.0.0",
            author="Miroslav Šotek",
            description="Izhikevich 2-variable model (regular spiking default).",
            references=["Izhikevich, IEEE Trans. NN 14(6), 2003."],
            parameters={
                "a": "Recovery time scale",
                "b": "Sensitivity of u to V",
                "c": "After-spike reset of V (mV)",
                "d": "After-spike increment of u",
                "V_thresh": "Spike cutoff (mV)",
            },
            state_variables=["V", "u"],
        )

    def default_state(self) -> NeuronState:
        """Return regular-spiking Izhikevich default state."""
        return NeuronState({"V": -65.0, "u": -14.0})

    def default_params(self) -> Dict[str, float]:
        """Return regular-spiking Izhikevich default parameters."""
        return {"a": 0.02, "b": 0.2, "c": -65.0, "d": 8.0, "V_thresh": 30.0}

    def ode_dynamics(
        self, state: NeuronState, current: float, params: Dict[str, float], dt: float
    ) -> NeuronState:
        """Advance Izhikevich membrane and recovery variables."""
        s = state.copy()
        V, u = s["V"], s["u"]
        dt_ms = dt * 1000.0
        dV = 0.04 * V * V + 5.0 * V + 140.0 - u + current
        du = params["a"] * (params["b"] * V - u)
        s["V"] = V + dV * dt_ms
        s["u"] = u + du * dt_ms
        return s

    def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
        """Return whether the Izhikevich spike cutoff is crossed."""
        return state["V"] >= params["V_thresh"]

    def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
        """Apply Izhikevich post-spike reset to voltage and recovery."""
        s = state.copy()
        s["V"] = params["c"]
        s["u"] = s["u"] + params["d"]
        return s

meta()

Return Izhikevich plugin metadata and parameter documentation.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
def meta(self) -> PluginMeta:
    """Return Izhikevich plugin metadata and parameter documentation."""
    return PluginMeta(
        name="Izhikevich",
        version="1.0.0",
        author="Miroslav Šotek",
        description="Izhikevich 2-variable model (regular spiking default).",
        references=["Izhikevich, IEEE Trans. NN 14(6), 2003."],
        parameters={
            "a": "Recovery time scale",
            "b": "Sensitivity of u to V",
            "c": "After-spike reset of V (mV)",
            "d": "After-spike increment of u",
            "V_thresh": "Spike cutoff (mV)",
        },
        state_variables=["V", "u"],
    )

default_state()

Return regular-spiking Izhikevich default state.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
276
277
278
def default_state(self) -> NeuronState:
    """Return regular-spiking Izhikevich default state."""
    return NeuronState({"V": -65.0, "u": -14.0})

default_params()

Return regular-spiking Izhikevich default parameters.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
280
281
282
def default_params(self) -> Dict[str, float]:
    """Return regular-spiking Izhikevich default parameters."""
    return {"a": 0.02, "b": 0.2, "c": -65.0, "d": 8.0, "V_thresh": 30.0}

ode_dynamics(state, current, params, dt)

Advance Izhikevich membrane and recovery variables.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
284
285
286
287
288
289
290
291
292
293
294
295
def ode_dynamics(
    self, state: NeuronState, current: float, params: Dict[str, float], dt: float
) -> NeuronState:
    """Advance Izhikevich membrane and recovery variables."""
    s = state.copy()
    V, u = s["V"], s["u"]
    dt_ms = dt * 1000.0
    dV = 0.04 * V * V + 5.0 * V + 140.0 - u + current
    du = params["a"] * (params["b"] * V - u)
    s["V"] = V + dV * dt_ms
    s["u"] = u + du * dt_ms
    return s

threshold_check(state, params)

Return whether the Izhikevich spike cutoff is crossed.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
297
298
299
def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
    """Return whether the Izhikevich spike cutoff is crossed."""
    return state["V"] >= params["V_thresh"]

reset(state, params)

Apply Izhikevich post-spike reset to voltage and recovery.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
301
302
303
304
305
306
def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
    """Apply Izhikevich post-spike reset to voltage and recovery."""
    s = state.copy()
    s["V"] = params["c"]
    s["u"] = s["u"] + params["d"]
    return s

AdExPlugin

Bases: NeuronPlugin

Adaptive Exponential Integrate-and-Fire (Brette & Gerstner 2005).

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
class AdExPlugin(NeuronPlugin):
    """Adaptive Exponential Integrate-and-Fire (Brette & Gerstner 2005)."""

    def meta(self) -> PluginMeta:
        """Return AdEx plugin metadata and parameter documentation."""
        return PluginMeta(
            name="AdEx",
            version="1.0.0",
            author="Miroslav Šotek",
            description="Adaptive exponential I&F with sub-threshold resonance.",
            references=["Brette & Gerstner, J. Neurophysiology 94(5), 2005."],
            parameters={
                "C": "Capacitance (nF)",
                "gL": "Leak conductance (nS)",
                "EL": "Leak reversal (mV)",
                "VT": "Threshold (mV)",
                "DeltaT": "Slope factor (mV)",
                "tau_w": "Adaptation τ (ms)",
                "a": "Sub-threshold adaptation (nS)",
                "b": "Spike-triggered adaptation (nA)",
                "V_reset": "Reset voltage (mV)",
                "V_peak": "Spike cutoff (mV)",
            },
            state_variables=["V", "w"],
        )

    def default_state(self) -> NeuronState:
        """Return the default AdEx voltage and adaptation state."""
        return NeuronState({"V": -70.0, "w": 0.0})

    def default_params(self) -> Dict[str, float]:
        """Return Brette-Gerstner style AdEx default parameters."""
        return {
            "C": 0.281,
            "gL": 0.030,
            "EL": -70.6,
            "VT": -50.4,
            "DeltaT": 2.0,
            "tau_w": 144.0,
            "a": 0.004,
            "b": 0.0805,
            "V_reset": -70.6,
            "V_peak": 20.0,
        }

    def ode_dynamics(
        self, state: NeuronState, current: float, params: Dict[str, float], dt: float
    ) -> NeuronState:
        """Advance AdEx voltage and adaptation current by one Euler step."""
        s = state.copy()
        V, w = s["V"], s["w"]
        dt_ms = dt * 1000.0
        exp_term = params["DeltaT"] * math.exp(
            min((V - params["VT"]) / max(params["DeltaT"], 1e-6), 20.0)
        )
        dV = (-params["gL"] * (V - params["EL"]) + params["gL"] * exp_term - w + current) / params[
            "C"
        ]
        dw = (params["a"] * (V - params["EL"]) - w) / params["tau_w"]
        s["V"] = V + dV * dt_ms
        s["w"] = w + dw * dt_ms
        return s

    def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
        """Return whether the AdEx spike cutoff is crossed."""
        return state["V"] >= params["V_peak"]

    def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
        """Apply AdEx spike reset and adaptation increment."""
        s = state.copy()
        s["V"] = params["V_reset"]
        s["w"] = s["w"] + params["b"]
        return s

meta()

Return AdEx plugin metadata and parameter documentation.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
def meta(self) -> PluginMeta:
    """Return AdEx plugin metadata and parameter documentation."""
    return PluginMeta(
        name="AdEx",
        version="1.0.0",
        author="Miroslav Šotek",
        description="Adaptive exponential I&F with sub-threshold resonance.",
        references=["Brette & Gerstner, J. Neurophysiology 94(5), 2005."],
        parameters={
            "C": "Capacitance (nF)",
            "gL": "Leak conductance (nS)",
            "EL": "Leak reversal (mV)",
            "VT": "Threshold (mV)",
            "DeltaT": "Slope factor (mV)",
            "tau_w": "Adaptation τ (ms)",
            "a": "Sub-threshold adaptation (nS)",
            "b": "Spike-triggered adaptation (nA)",
            "V_reset": "Reset voltage (mV)",
            "V_peak": "Spike cutoff (mV)",
        },
        state_variables=["V", "w"],
    )

default_state()

Return the default AdEx voltage and adaptation state.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
335
336
337
def default_state(self) -> NeuronState:
    """Return the default AdEx voltage and adaptation state."""
    return NeuronState({"V": -70.0, "w": 0.0})

default_params()

Return Brette-Gerstner style AdEx default parameters.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
339
340
341
342
343
344
345
346
347
348
349
350
351
352
def default_params(self) -> Dict[str, float]:
    """Return Brette-Gerstner style AdEx default parameters."""
    return {
        "C": 0.281,
        "gL": 0.030,
        "EL": -70.6,
        "VT": -50.4,
        "DeltaT": 2.0,
        "tau_w": 144.0,
        "a": 0.004,
        "b": 0.0805,
        "V_reset": -70.6,
        "V_peak": 20.0,
    }

ode_dynamics(state, current, params, dt)

Advance AdEx voltage and adaptation current by one Euler step.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
def ode_dynamics(
    self, state: NeuronState, current: float, params: Dict[str, float], dt: float
) -> NeuronState:
    """Advance AdEx voltage and adaptation current by one Euler step."""
    s = state.copy()
    V, w = s["V"], s["w"]
    dt_ms = dt * 1000.0
    exp_term = params["DeltaT"] * math.exp(
        min((V - params["VT"]) / max(params["DeltaT"], 1e-6), 20.0)
    )
    dV = (-params["gL"] * (V - params["EL"]) + params["gL"] * exp_term - w + current) / params[
        "C"
    ]
    dw = (params["a"] * (V - params["EL"]) - w) / params["tau_w"]
    s["V"] = V + dV * dt_ms
    s["w"] = w + dw * dt_ms
    return s

threshold_check(state, params)

Return whether the AdEx spike cutoff is crossed.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
372
373
374
def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
    """Return whether the AdEx spike cutoff is crossed."""
    return state["V"] >= params["V_peak"]

reset(state, params)

Apply AdEx spike reset and adaptation increment.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
376
377
378
379
380
381
def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
    """Apply AdEx spike reset and adaptation increment."""
    s = state.copy()
    s["V"] = params["V_reset"]
    s["w"] = s["w"] + params["b"]
    return s

HodgkinHuxleyPlugin

Bases: NeuronPlugin

Hodgkin–Huxley conductance-based model (1952).

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
class HodgkinHuxleyPlugin(NeuronPlugin):
    """Hodgkin–Huxley conductance-based model (1952)."""

    def meta(self) -> PluginMeta:
        """Return Hodgkin-Huxley plugin metadata and parameter documentation."""
        return PluginMeta(
            name="Hodgkin-Huxley",
            version="1.0.0",
            author="Miroslav Šotek",
            description="Full HH model with Na/K/leak conductances.",
            references=["Hodgkin & Huxley, J. Physiology 117(4), 1952."],
            parameters={
                "C_m": "Membrane capacitance (µF/cm²)",
                "g_Na": "Na max conductance",
                "g_K": "K max conductance",
                "g_L": "Leak conductance",
                "E_Na": "Na reversal",
                "E_K": "K reversal",
                "E_L": "Leak reversal",
                "V_thresh": "Spike detection threshold (mV)",
            },
            state_variables=["V", "m", "h", "n"],
        )

    def default_state(self) -> NeuronState:
        """Return resting Hodgkin-Huxley voltage and gating variables."""
        return NeuronState({"V": -65.0, "m": 0.05, "h": 0.6, "n": 0.32})

    def default_params(self) -> Dict[str, float]:
        """Return canonical Hodgkin-Huxley conductance parameters."""
        return {
            "C_m": 1.0,
            "g_Na": 120.0,
            "g_K": 36.0,
            "g_L": 0.3,
            "E_Na": 50.0,
            "E_K": -77.0,
            "E_L": -54.387,
            "V_thresh": 0.0,
        }

    def ode_dynamics(
        self, state: NeuronState, current: float, params: Dict[str, float], dt: float
    ) -> NeuronState:
        """Advance Hodgkin-Huxley voltage and gating variables."""
        s = state.copy()
        V, m, h, n = s["V"], s["m"], s["h"], s["n"]
        dt_ms = dt * 1000.0

        def _safe_exp(x: float) -> float:
            return math.exp(max(-500.0, min(500.0, x)))

        a_m = (
            0.1 * (V + 40.0) / (1.0 - _safe_exp(-(V + 40.0) / 10.0))
            if abs(V + 40.0) > 1e-6
            else 1.0
        )
        b_m = 4.0 * _safe_exp(-(V + 65.0) / 18.0)
        a_h = 0.07 * _safe_exp(-(V + 65.0) / 20.0)
        b_h = 1.0 / (1.0 + _safe_exp(-(V + 35.0) / 10.0))
        a_n = (
            0.01 * (V + 55.0) / (1.0 - _safe_exp(-(V + 55.0) / 10.0))
            if abs(V + 55.0) > 1e-6
            else 0.1
        )
        b_n = 0.125 * _safe_exp(-(V + 65.0) / 80.0)

        I_Na = params["g_Na"] * m**3 * h * (V - params["E_Na"])
        I_K = params["g_K"] * n**4 * (V - params["E_K"])
        I_L = params["g_L"] * (V - params["E_L"])

        dV = (current - I_Na - I_K - I_L) / params["C_m"]
        s["V"] = V + dV * dt_ms
        s["m"] = m + (a_m * (1 - m) - b_m * m) * dt_ms
        s["h"] = h + (a_h * (1 - h) - b_h * h) * dt_ms
        s["n"] = n + (a_n * (1 - n) - b_n * n) * dt_ms

        s["m"] = max(0.0, min(1.0, s["m"]))
        s["h"] = max(0.0, min(1.0, s["h"]))
        s["n"] = max(0.0, min(1.0, s["n"]))
        return s

    def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
        """Return whether the Hodgkin-Huxley voltage threshold is crossed."""
        return state["V"] >= params["V_thresh"]

    def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
        """Return an independent no-op reset copy for Hodgkin-Huxley."""
        return state.copy()

meta()

Return Hodgkin-Huxley plugin metadata and parameter documentation.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
def meta(self) -> PluginMeta:
    """Return Hodgkin-Huxley plugin metadata and parameter documentation."""
    return PluginMeta(
        name="Hodgkin-Huxley",
        version="1.0.0",
        author="Miroslav Šotek",
        description="Full HH model with Na/K/leak conductances.",
        references=["Hodgkin & Huxley, J. Physiology 117(4), 1952."],
        parameters={
            "C_m": "Membrane capacitance (µF/cm²)",
            "g_Na": "Na max conductance",
            "g_K": "K max conductance",
            "g_L": "Leak conductance",
            "E_Na": "Na reversal",
            "E_K": "K reversal",
            "E_L": "Leak reversal",
            "V_thresh": "Spike detection threshold (mV)",
        },
        state_variables=["V", "m", "h", "n"],
    )

default_state()

Return resting Hodgkin-Huxley voltage and gating variables.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
408
409
410
def default_state(self) -> NeuronState:
    """Return resting Hodgkin-Huxley voltage and gating variables."""
    return NeuronState({"V": -65.0, "m": 0.05, "h": 0.6, "n": 0.32})

default_params()

Return canonical Hodgkin-Huxley conductance parameters.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
412
413
414
415
416
417
418
419
420
421
422
423
def default_params(self) -> Dict[str, float]:
    """Return canonical Hodgkin-Huxley conductance parameters."""
    return {
        "C_m": 1.0,
        "g_Na": 120.0,
        "g_K": 36.0,
        "g_L": 0.3,
        "E_Na": 50.0,
        "E_K": -77.0,
        "E_L": -54.387,
        "V_thresh": 0.0,
    }

ode_dynamics(state, current, params, dt)

Advance Hodgkin-Huxley voltage and gating variables.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
def ode_dynamics(
    self, state: NeuronState, current: float, params: Dict[str, float], dt: float
) -> NeuronState:
    """Advance Hodgkin-Huxley voltage and gating variables."""
    s = state.copy()
    V, m, h, n = s["V"], s["m"], s["h"], s["n"]
    dt_ms = dt * 1000.0

    def _safe_exp(x: float) -> float:
        return math.exp(max(-500.0, min(500.0, x)))

    a_m = (
        0.1 * (V + 40.0) / (1.0 - _safe_exp(-(V + 40.0) / 10.0))
        if abs(V + 40.0) > 1e-6
        else 1.0
    )
    b_m = 4.0 * _safe_exp(-(V + 65.0) / 18.0)
    a_h = 0.07 * _safe_exp(-(V + 65.0) / 20.0)
    b_h = 1.0 / (1.0 + _safe_exp(-(V + 35.0) / 10.0))
    a_n = (
        0.01 * (V + 55.0) / (1.0 - _safe_exp(-(V + 55.0) / 10.0))
        if abs(V + 55.0) > 1e-6
        else 0.1
    )
    b_n = 0.125 * _safe_exp(-(V + 65.0) / 80.0)

    I_Na = params["g_Na"] * m**3 * h * (V - params["E_Na"])
    I_K = params["g_K"] * n**4 * (V - params["E_K"])
    I_L = params["g_L"] * (V - params["E_L"])

    dV = (current - I_Na - I_K - I_L) / params["C_m"]
    s["V"] = V + dV * dt_ms
    s["m"] = m + (a_m * (1 - m) - b_m * m) * dt_ms
    s["h"] = h + (a_h * (1 - h) - b_h * h) * dt_ms
    s["n"] = n + (a_n * (1 - n) - b_n * n) * dt_ms

    s["m"] = max(0.0, min(1.0, s["m"]))
    s["h"] = max(0.0, min(1.0, s["h"]))
    s["n"] = max(0.0, min(1.0, s["n"]))
    return s

threshold_check(state, params)

Return whether the Hodgkin-Huxley voltage threshold is crossed.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
466
467
468
def threshold_check(self, state: NeuronState, params: Dict[str, float]) -> bool:
    """Return whether the Hodgkin-Huxley voltage threshold is crossed."""
    return state["V"] >= params["V_thresh"]

reset(state, params)

Return an independent no-op reset copy for Hodgkin-Huxley.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
470
471
472
def reset(self, state: NeuronState, params: Dict[str, float]) -> NeuronState:
    """Return an independent no-op reset copy for Hodgkin-Huxley."""
    return state.copy()

PluginRegistry

Discovers and manages neuron model plugins.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
class PluginRegistry:
    """Discovers and manages neuron model plugins."""

    def __init__(self) -> None:
        """Create an empty plugin registry."""
        self._plugins: Dict[str, NeuronPlugin] = {}

    def register(self, plugin: NeuronPlugin) -> None:
        """Register a neuron plugin under its metadata name."""
        name = plugin.meta().name
        self._plugins[name] = plugin

    def get(self, name: str) -> Optional[NeuronPlugin]:
        """Return a registered plugin by name, if present."""
        return self._plugins.get(name)

    def list_plugins(self) -> List[str]:
        """Return registered plugin names in deterministic order."""
        return sorted(self._plugins.keys())

    def __len__(self) -> int:
        """Return the number of registered plugins."""
        return len(self._plugins)

    def __contains__(self, name: str) -> bool:
        """Return whether a plugin name is registered."""
        return name in self._plugins

    @classmethod
    def with_builtins(cls) -> PluginRegistry:
        """Create a registry pre-loaded with all built-in neuron models."""
        reg = cls()
        for plugin_cls in (LIFPlugin, IzhikevichPlugin, AdExPlugin, HodgkinHuxleyPlugin):
            reg.register(plugin_cls())
        return reg

__init__()

Create an empty plugin registry.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
481
482
483
def __init__(self) -> None:
    """Create an empty plugin registry."""
    self._plugins: Dict[str, NeuronPlugin] = {}

register(plugin)

Register a neuron plugin under its metadata name.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
485
486
487
488
def register(self, plugin: NeuronPlugin) -> None:
    """Register a neuron plugin under its metadata name."""
    name = plugin.meta().name
    self._plugins[name] = plugin

get(name)

Return a registered plugin by name, if present.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
490
491
492
def get(self, name: str) -> Optional[NeuronPlugin]:
    """Return a registered plugin by name, if present."""
    return self._plugins.get(name)

list_plugins()

Return registered plugin names in deterministic order.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
494
495
496
def list_plugins(self) -> List[str]:
    """Return registered plugin names in deterministic order."""
    return sorted(self._plugins.keys())

__len__()

Return the number of registered plugins.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
498
499
500
def __len__(self) -> int:
    """Return the number of registered plugins."""
    return len(self._plugins)

__contains__(name)

Return whether a plugin name is registered.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
502
503
504
def __contains__(self, name: str) -> bool:
    """Return whether a plugin name is registered."""
    return name in self._plugins

with_builtins() classmethod

Create a registry pre-loaded with all built-in neuron models.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
506
507
508
509
510
511
512
@classmethod
def with_builtins(cls) -> PluginRegistry:
    """Create a registry pre-loaded with all built-in neuron models."""
    reg = cls()
    for plugin_cls in (LIFPlugin, IzhikevichPlugin, AdExPlugin, HodgkinHuxleyPlugin):
        reg.register(plugin_cls())
    return reg

VerilogGenerator

Generates synthesisable SystemVerilog from a NeuronPlugin.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
class VerilogGenerator:
    """Generates synthesisable SystemVerilog from a NeuronPlugin."""

    def __init__(self, bit_width: int = 16, frac_bits: int = 8) -> None:
        """Configure fixed-point width for generated plugin modules."""
        self.bit_width = bit_width
        self.frac_bits = frac_bits

    def generate(self, plugin: NeuronPlugin) -> str:
        """Produce a complete SystemVerilog module for the given plugin."""
        meta = plugin.meta()
        params = plugin.default_params()
        state_vars = meta.state_variables

        module_name = f"sc_neuron_{meta.name.lower().replace('-', '_')}"
        bw = self.bit_width

        port_lines = [
            "    input  logic clk,",
            "    input  logic rst_n,",
            f"    input  logic signed [{bw - 1}:0] i_current,",
        ]
        for sv in state_vars:
            port_lines.append(f"    output logic signed [{bw - 1}:0] o_{sv},")
        port_lines.append("    output logic o_spike")

        reg_lines = []
        for sv in state_vars:
            reg_lines.append(f"    logic signed [{bw - 1}:0] {sv}_reg;")

        reset_lines = []
        default_state = plugin.default_state()
        for sv in state_vars:
            fixed_val = self._to_fixed(default_state[sv])
            reset_lines.append(f"            {sv}_reg <= {bw}'sd{fixed_val};")

        param_lines = []
        for pname, pval in params.items():
            fixed_val = self._to_fixed(pval)
            safe_name = pname.replace("-", "_")
            param_lines.append(
                f"    localparam signed [{bw - 1}:0] {safe_name.upper()} = {bw}'sd{fixed_val};"
            )

        assign_lines = []
        for sv in state_vars:
            assign_lines.append(f"    assign o_{sv} = {sv}_reg;")

        header = textwrap.dedent(f"""\
            // SPDX-License-Identifier: AGPL-3.0-or-later
            // Commercial license available
            // © Concepts 1996–2026 Miroslav Šotek. All rights reserved.
            // © Code 2020–2026 Miroslav Šotek. All rights reserved.
            // ORCID: 0009-0009-3560-0851
            // Contact: www.anulum.li | protoscience@anulum.li
            // SC-NeuroCore — Auto-generated {meta.name} neuron module
            //
            // Generated from plugin: {meta.name} v{meta.version}
            // {meta.description}
        """)

        body = textwrap.dedent(f"""\
            module {module_name} (
            {chr(10).join(port_lines)}
            );

            {chr(10).join(param_lines)}

            {chr(10).join(reg_lines)}

                logic spike_detect;

                always_ff @(posedge clk or negedge rst_n) begin
                    if (!rst_n) begin
            {chr(10).join(reset_lines)}
                        spike_detect <= 1'b0;
                    end else begin
                        // Dynamics integration point: downstream synthesis fills in
                        // the actual ODE integration from plugin parameters.
                        spike_detect <= 1'b0;
                    end
                end

            {chr(10).join(assign_lines)}
                assign o_spike = spike_detect;

            endmodule
        """)

        return header + body

    def _to_fixed(self, value: float) -> int:
        """Convert a real-valued scalar into generator fixed-point format."""
        return int(round(value * (1 << self.frac_bits)))

__init__(bit_width=16, frac_bits=8)

Configure fixed-point width for generated plugin modules.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
521
522
523
524
def __init__(self, bit_width: int = 16, frac_bits: int = 8) -> None:
    """Configure fixed-point width for generated plugin modules."""
    self.bit_width = bit_width
    self.frac_bits = frac_bits

generate(plugin)

Produce a complete SystemVerilog module for the given plugin.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
def generate(self, plugin: NeuronPlugin) -> str:
    """Produce a complete SystemVerilog module for the given plugin."""
    meta = plugin.meta()
    params = plugin.default_params()
    state_vars = meta.state_variables

    module_name = f"sc_neuron_{meta.name.lower().replace('-', '_')}"
    bw = self.bit_width

    port_lines = [
        "    input  logic clk,",
        "    input  logic rst_n,",
        f"    input  logic signed [{bw - 1}:0] i_current,",
    ]
    for sv in state_vars:
        port_lines.append(f"    output logic signed [{bw - 1}:0] o_{sv},")
    port_lines.append("    output logic o_spike")

    reg_lines = []
    for sv in state_vars:
        reg_lines.append(f"    logic signed [{bw - 1}:0] {sv}_reg;")

    reset_lines = []
    default_state = plugin.default_state()
    for sv in state_vars:
        fixed_val = self._to_fixed(default_state[sv])
        reset_lines.append(f"            {sv}_reg <= {bw}'sd{fixed_val};")

    param_lines = []
    for pname, pval in params.items():
        fixed_val = self._to_fixed(pval)
        safe_name = pname.replace("-", "_")
        param_lines.append(
            f"    localparam signed [{bw - 1}:0] {safe_name.upper()} = {bw}'sd{fixed_val};"
        )

    assign_lines = []
    for sv in state_vars:
        assign_lines.append(f"    assign o_{sv} = {sv}_reg;")

    header = textwrap.dedent(f"""\
        // SPDX-License-Identifier: AGPL-3.0-or-later
        // Commercial license available
        // © Concepts 1996–2026 Miroslav Šotek. All rights reserved.
        // © Code 2020–2026 Miroslav Šotek. All rights reserved.
        // ORCID: 0009-0009-3560-0851
        // Contact: www.anulum.li | protoscience@anulum.li
        // SC-NeuroCore — Auto-generated {meta.name} neuron module
        //
        // Generated from plugin: {meta.name} v{meta.version}
        // {meta.description}
    """)

    body = textwrap.dedent(f"""\
        module {module_name} (
        {chr(10).join(port_lines)}
        );

        {chr(10).join(param_lines)}

        {chr(10).join(reg_lines)}

            logic spike_detect;

            always_ff @(posedge clk or negedge rst_n) begin
                if (!rst_n) begin
        {chr(10).join(reset_lines)}
                    spike_detect <= 1'b0;
                end else begin
                    // Dynamics integration point: downstream synthesis fills in
                    // the actual ODE integration from plugin parameters.
                    spike_detect <= 1'b0;
                end
            end

        {chr(10).join(assign_lines)}
            assign o_spike = spike_detect;

        endmodule
    """)

    return header + body

DocGenerator

Generates markdown documentation from plugin metadata.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
class DocGenerator:
    """Generates markdown documentation from plugin metadata."""

    def generate(self, plugin: NeuronPlugin) -> str:
        """Generate Markdown documentation for one plugin."""
        meta = plugin.meta()
        lines = [
            f"# {meta.name}",
            "",
            f"**Version**: {meta.version}  ",
            f"**Author**: {meta.author}  ",
            f"**Description**: {meta.description}",
            "",
        ]
        if meta.references:
            lines.append("## References")
            lines.append("")
            for ref in meta.references:
                lines.append(f"- {ref}")
            lines.append("")

        if meta.parameters:
            lines.append("## Parameters")
            lines.append("")
            lines.append("| Name | Description |")
            lines.append("|------|-------------|")
            for pname, pdesc in meta.parameters.items():
                lines.append(f"| `{pname}` | {pdesc} |")
            lines.append("")

        default_params = plugin.default_params()
        if default_params:
            lines.append("## Default Values")
            lines.append("")
            lines.append("| Parameter | Value |")
            lines.append("|-----------|-------|")
            for pname, pval in default_params.items():
                lines.append(f"| `{pname}` | {pval} |")
            lines.append("")

        if meta.state_variables:
            lines.append("## State Variables")
            lines.append("")
            for sv in meta.state_variables:
                lines.append(f"- `{sv}`")
            lines.append("")

        return "\n".join(lines)

    def generate_index(self, registry: PluginRegistry) -> str:
        """Generate a summary index for all registered plugins."""
        lines = [
            "# SC-NeuroCore Model Zoo",
            "",
            "| Model | Version | Description |",
            "|-------|---------|-------------|",
        ]
        for name in registry.list_plugins():
            plugin = registry.get(name)
            if plugin:
                m = plugin.meta()
                lines.append(f"| {m.name} | {m.version} | {m.description} |")
        lines.append("")
        return "\n".join(lines)

generate(plugin)

Generate Markdown documentation for one plugin.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
def generate(self, plugin: NeuronPlugin) -> str:
    """Generate Markdown documentation for one plugin."""
    meta = plugin.meta()
    lines = [
        f"# {meta.name}",
        "",
        f"**Version**: {meta.version}  ",
        f"**Author**: {meta.author}  ",
        f"**Description**: {meta.description}",
        "",
    ]
    if meta.references:
        lines.append("## References")
        lines.append("")
        for ref in meta.references:
            lines.append(f"- {ref}")
        lines.append("")

    if meta.parameters:
        lines.append("## Parameters")
        lines.append("")
        lines.append("| Name | Description |")
        lines.append("|------|-------------|")
        for pname, pdesc in meta.parameters.items():
            lines.append(f"| `{pname}` | {pdesc} |")
        lines.append("")

    default_params = plugin.default_params()
    if default_params:
        lines.append("## Default Values")
        lines.append("")
        lines.append("| Parameter | Value |")
        lines.append("|-----------|-------|")
        for pname, pval in default_params.items():
            lines.append(f"| `{pname}` | {pval} |")
        lines.append("")

    if meta.state_variables:
        lines.append("## State Variables")
        lines.append("")
        for sv in meta.state_variables:
            lines.append(f"- `{sv}`")
        lines.append("")

    return "\n".join(lines)

generate_index(registry)

Generate a summary index for all registered plugins.

Source code in src/sc_neurocore/model_zoo/model_zoo.py
Python
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
def generate_index(self, registry: PluginRegistry) -> str:
    """Generate a summary index for all registered plugins."""
    lines = [
        "# SC-NeuroCore Model Zoo",
        "",
        "| Model | Version | Description |",
        "|-------|---------|-------------|",
    ]
    for name in registry.list_plugins():
        plugin = registry.get(name)
        if plugin:
            m = plugin.meta()
            lines.append(f"| {m.name} | {m.version} | {m.description} |")
    lines.append("")
    return "\n".join(lines)