Skip to content

Support generic SONATA modoverride synapses via helper HOC - #91

Open
darshanmandge wants to merge 4 commits into
mainfrom
feat/generic-modoverride
Open

Support generic SONATA modoverride synapses via helper HOC#91
darshanmandge wants to merge 4 commits into
mainfrom
feat/generic-modoverride

Conversation

@darshanmandge

@darshanmandge darshanmandge commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Generalise ConnectionOverrides.mod_override to support any compiled NEURON mechanism SUFFIX.
  • Add Neurodamus-compatible helper-HOC loading for generic synapses.
  • Construct non-built-in mod-overridden synapses through GenericSpikeSynapse.
  • Parse the SONATA-spec modoverride key.
  • Retain support for the legacy mod_override spelling.
  • Add regression tests for generic mechanisms, helper loading, and SONATA connection override parsing.
  • Generic custom modoverride mechanisms use the Neurodamus-compatible Helper convention. Existing built-in GluSynapse and Exp2Syn mechanisms retain their native BlueCelluLab construction paths for backward compatibility.

Motivation

BlueCelluLab previously restricted mod_override to the built-in GluSynapse mechanism and did not correctly read the SONATA-standard modoverride key. As a result, custom mechanisms that reference processes could not be selected via SONATA connection overrides.

This change enables SONATA circuits to select arbitrary compiled NMODL mechanisms together with their companion helper HOC templates.

Changes

Generic mod override support

  • Change ConnectionOverrides.mod_override from a Literal["GluSynapse"] to str | None.
  • Validate that the requested SUFFIX exists in the loaded NEURON namespace.
  • Dispatch non-built-in overrides to GenericSpikeSynapse.
  • Preserve the existing built-in GluSynapse path.

Helper HOC loading

Add bluecellulab.synapse.synapse_helpers with:

  • load_synapse_helper(suffix)
  • helper_available(suffix)

The loader follows the Neurodamus convention:

  • SUFFIX.mod
  • SUFFIXHelper.hoc

- Relax ConnectionOverrides.mod_override from Literal["GluSynapse"] to str
- Add bluecellulab.synapse.synapse_helpers.load_synapse_helper for
  neurodamus-style auto-loading of {SUFFIX}Helper.hoc via HOC_LIBRARY_PATH
- Add GenericSpikeSynapse class that constructs the point process via the
  helper HOC template, matching neurodamus calling convention
- Wire SynapseFactory to dispatch to GenericSpikeSynapse when ModOverride
  is set to a non-builtin SUFFIX
- Make U_SYN scaling tolerant of missing properties for non-AMPANMDA
  mechanisms
Read the SONATA `modoverride` key when constructing connection overrides,
while retaining `mod_override` as a backward-compatible fallback.

Add regression coverage for the standard key and connections without a
modoverride.
@darshanmandge darshanmandge self-assigned this Aug 10, 2026
@darshanmandge
darshanmandge requested a review from ilkilic August 10, 2026 05:51
Keep Exp2Syn connection overrides on the built-in synapse path instead of
requiring a nonexistent Exp2SynHelper.hoc template.

Also fix reStructuredText formatting in the generic synapse docstrings so
the documentation build passes with warnings treated as errors.
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.47644% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bluecellulab/synapse/synapse_types.py 97.67% 1 Missing ⚠️
Files with missing lines Coverage Δ
bluecellulab/circuit/config/sections.py 93.84% <100.00%> (+0.76%) ⬆️
bluecellulab/synapse/synapse_factory.py 91.83% <100.00%> (+0.53%) ⬆️
bluecellulab/synapse/synapse_helpers.py 100.00% <100.00%> (ø)
tests/test_synapse/test_synapse_helpers.py 100.00% <100.00%> (ø)
bluecellulab/synapse/synapse_types.py 87.50% <97.67%> (+2.06%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant