界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

modeling

modeling

【效率与协作】Build and validate Brian2 2.9.0 neuron populations, equations, thresholds, resets, refractoriness, events, state initialization, subgroups, and shared or linked variables.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: modeling description: "Build and validate Brian2 2.9.0 neuron populations, equations, thresholds, resets, refractoriness, events, state initialization, subgroups, and shared or linked variables." disable-model-invocation: true metadata: disco-role: operating license: NOASSERTION

Modeling

Use this route when a task defines neuron state or neuron-local behavior in Brian2 2.9.0: NeuronGroup, model equations, parameters and subexpressions, threshold/reset/refractory behavior, custom events, initialization, subgroups, run_regularly, shared variables, or linked variables. Start with the smallest explicit Network and a NumPy run before adding connectivity, monitors, or a device target.

Route map

  • Constructor arguments, equation flags, state views, events, and links: read the API reference.
  • Construction recipes and validation gates: read the workflows.
  • Install/import, optional dependency, data/configuration, API misuse, and workflow recovery: read troubleshooting.
  • Run a plotting-free heterogeneous LIF fixture with a custom event: python scripts/model_smoke.py --help, then python scripts/model_smoke.py --target numpy.

Operating contract

  1. Declare every heterogeneous parameter in the model (tau : second, drive : 1, etc.). A Python value outside the model is a scalar namespace value, not a per-neuron parameter. Assign state immediately after creating the group, with units unless the raw underscore view is intentional.
  2. Make the model contract explicit: differential equations, compatible units, a boolean threshold, reset statements, and a refractory rule when repeated threshold crossings must be suppressed. A threshold with no reset is legal only when counting events or when the state naturally exits the condition.
  3. Treat model strings and state-assignment strings as Brian abstract code, not arbitrary Python. Use Brian-supported functions and vectorizable statements; do not put imports, comprehensions, object methods, I/O, or general Python control flow in them. A user-defined function must have a Brian unit contract and an explicit namespace entry; target-specific implementations are a separate code-generation concern.
  4. Use Network(group, ...) for validation and run it for 0*ms before a tiny positive duration. Constructor success alone does not prove that namespace, units, parser, event, or code-generation checks will pass.
  5. Subgroups are contiguous views, not copies. Assigning through G[:k] changes the parent. Their i is subgroup-relative; use parent state or an explicit parameter when an absolute identity is required.
  6. (shared) means one scalar value for the complete group. (linked) means live reference storage and must be bound with linked_var; check dimensions, source/target sizes, and any integer mapping before running.
  7. Keep external names reproducible: prefer a group namespace={...} or an explicit Network.run(..., namespace={...}). Do not rely on a coincidental caller local or leave competing definitions across namespaces.
  8. Keep custom event conditions and side effects model-local. Event recording, synaptic pathways, physical-unit/parser depth, monitor details, execution or device selection belong to the routes named below.

Boundaries

Route synaptic connectivity, pre/post code, delays, inputs, and plasticity to synapses-and-inputs; monitor selection and monitor data to recording; and detailed unit/parser, state-updater, or unit-aware function questions to units-and-equations. Route network lifecycle, cross-object scheduling, and multiple-run behavior to simulation-and-recording; route devices, compiler setup, and code-generation target selection to code-generation. Keep only the neuron-local construction contract here and follow the linked route rather than duplicating those APIs.

我的收藏