Model Zoo¶
Plugin-based neuron model zoo with auto-Verilog generation and auto-documentation. Ships with LIF, Izhikevich, AdEx, and Hodgkin-Huxley.
Quick Start¶
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 | |
__getitem__(key)
¶
Return a state variable by name.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
83 84 85 | |
__setitem__(key, value)
¶
Assign a state variable by name.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
87 88 89 | |
copy()
¶
Return an independent copy of this neuron state.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
91 92 93 | |
as_dict()
¶
Return state variables as a plain dictionary.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
95 96 97 | |
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 | |
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 | |
meta()
abstractmethod
¶
Return metadata describing this neuron plugin.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
116 117 118 119 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
default_state()
¶
Return the resting LIF membrane state.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
219 220 221 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
default_state()
¶
Return regular-spiking Izhikevich default state.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
276 277 278 | |
default_params()
¶
Return regular-spiking Izhikevich default parameters.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
280 281 282 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
__init__()
¶
Create an empty plugin registry.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
481 482 483 | |
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 | |
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 | |
list_plugins()
¶
Return registered plugin names in deterministic order.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
494 495 496 | |
__len__()
¶
Return the number of registered plugins.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
498 499 500 | |
__contains__(name)
¶
Return whether a plugin name is registered.
Source code in src/sc_neurocore/model_zoo/model_zoo.py
| Python | |
|---|---|
502 503 504 | |
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 | |
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 | |
__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 | |
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 | |
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 | |
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 | |
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 | |