Skip to content

Add SONATA point-process cell support - #51

Merged
jamesgking merged 24 commits into
mainfrom
point-process
Jun 30, 2026
Merged

Add SONATA point-process cell support#51
jamesgking merged 24 commits into
mainfrom
point-process

Conversation

@ilkilic

@ilkilic ilkilic commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

This PR adds support for SONATA point-process cells.

Point-process cells are instantiated from SONATA model_type = "point_process" and model_template, mapping directly to NEURON point mechanisms defined in HOC/MOD files.

What is included

  • New HocPointProcessCell for SONATA point-process populations
  • Mechanism instantiation driven by model_template (e.g. nrn:IntFire1, hoc:)
  • Integration with CircuitSimulation (instantiate_gids, callbacks, deletion)
  • Spike detection and recording compatible with existing simulation flow
  • Support for SONATA inputs and SynapseReplay via _add_stimuli
  • Compatibility with SONATA edge loading through existing SonataCircuitAccess

@codecov

codecov Bot commented Jan 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bluecellulab/cell/point_process.py 93.05% 10 Missing ⚠️
bluecellulab/circuit_simulation.py 80.95% 4 Missing ⚠️
tests/test_allen_v1/test_ringcells_allen_v1.py 96.77% 2 Missing ⚠️
bluecellulab/point/point_connection.py 96.77% 1 Missing ⚠️
Files with missing lines Coverage Δ
bluecellulab/cell/core.py 78.92% <ø> (ø)
...ab/circuit/circuit_access/sonata_circuit_access.py 95.92% <100.00%> (+0.11%) ⬆️
bluecellulab/circuit/synapse_properties.py 69.23% <100.00%> (+1.23%) ⬆️
bluecellulab/point/connection_params.py 100.00% <100.00%> (ø)
bluecellulab/reports/utils.py 94.76% <100.00%> (+0.11%) ⬆️
bluecellulab/synapse/__init__.py 100.00% <100.00%> (ø)
bluecellulab/synapse/synapse_factory.py 91.30% <100.00%> (+0.49%) ⬆️
bluecellulab/synapse/synapse_types.py 85.43% <100.00%> (+2.40%) ⬆️
bluecellulab/point/point_connection.py 96.77% <96.77%> (ø)
tests/test_allen_v1/test_ringcells_allen_v1.py 96.77% <96.77%> (ø)
... and 2 more

... and 2 files with indirect coverage changes

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

@jamesgking jamesgking self-assigned this Mar 9, 2026
The logic for loading from sonata files is to swap out the list of parameters if the BBP TYPE is not present

Likewise, when instantiating a synapse object, if no TYPE field is present, assume it is for allen and
create a Exp2Syn synapse
…e instantiated.

The reporting adds try/except since these don't have a soma
… target point neurons

and deliver replay spikes to the proper netcon
Removed call to finalize for point process type cells since this is not needed
Updated allen tests to collection cell_info and get ExpSyn data as consequence
…re netcon code

Remove more unused code sections; can be added when use case example is available
Added additional test for invalid Mechanism given to HocPointProcessCell

@darshanmandge darshanmandge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jamesgking, for adding this to bluecellulab! I have left some comments.

Comment thread bluecellulab/cell/point_process.py
Comment thread bluecellulab/cell/point_process.py Outdated
Comment thread bluecellulab/cell/point_process.py Outdated
Comment thread bluecellulab/cell/point_process.py Outdated
Comment thread bluecellulab/cell/point_process.py Outdated
Comment thread bluecellulab/reports/utils.py Outdated
Comment thread bluecellulab/reports/utils.py Outdated
Comment thread bluecellulab/circuit/synapse_properties.py Outdated
Comment thread tests/test_allen_v1/test_ringcells_allen_v1.py Outdated
Comment thread tests/test_allen_v1/test_ringcells_allen_v1.py Outdated
Comment thread bluecellulab/cell/point_process.py Outdated
Comment thread bluecellulab/point/point_connection.py
darshanmandge
darshanmandge previously approved these changes Jun 30, 2026

@darshanmandge darshanmandge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, @jamesgking!

@jamesgking
jamesgking marked this pull request as ready for review June 30, 2026 09:35
darshanmandge
darshanmandge previously approved these changes Jun 30, 2026
Comment thread bluecellulab/cell/point_process.py Outdated
self,
cell_id: Optional[CellId],
mechanism_name: str,
spike_threshold: float = 1.0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a strange default value for spike threshold. Maybe we could use -30.0, as is done in https://github.com/openbraininstitute/BlueCelluLab/blob/main/bluecellulab/cell/core.py#L526

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For point-process cells, spikes are already emitted as events so the threshold is only kept for API compatibility. 0.0 feels like a better neutral default than 1.0 or -30.0.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I didn't know that it was different for point process cells. Sounds good then!

Comment thread bluecellulab/cell/point_process.py Outdated
duration = getattr(stimulus, "duration", np.inf)

spikes_of_interest = spikes_of_interest[
(spikes_of_interest >= delay) & (spikes_of_interest <= duration)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't keep spikes between delay and duration + delay? Instead of delay and duration?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This logic exists in core Cell.add_synapse_replay() too but I think it is wrong there as well: duration should be interpreted as a length, so the stop time is delay + duration. I will fix both core.py and point_process.py for consistency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you haven't started, I can do this now. Or maybe you want the change in Cell as a separate commit to make the change easier to track in git history?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jamesgking for fixing it!

Comment thread bluecellulab/cell/point_process.py Outdated
vs = h.VecStim()
vs.play(vec)

if self.pointcell is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could put this check before the for loop imo

Comment thread bluecellulab/point/connection_params.py Outdated
delay: float # ms
weight: float # NetCon weight

# isec: int = -1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?
This should be removed maybe?

@AurelienJaquier AurelienJaquier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

@jamesgking
jamesgking merged commit 9df2c2d into main Jun 30, 2026
9 checks passed
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.

5 participants