Add SONATA support for spatially_uniform_e_field stimulus#82
Open
darshanmandge wants to merge 16 commits into
Open
Add SONATA support for spatially_uniform_e_field stimulus#82darshanmandge wants to merge 16 commits into
darshanmandge wants to merge 16 commits into
Conversation
Collaborator
darshanmandge
commented
Apr 13, 2026
- Solves Add SONATA support for spatially_uniform_e_field stimulus module #80.
- Merged main into uniform_e_field_stimulus branch - Re-applied SpatiallyUniformEField stimulus pattern and class - Re-applied ElectrodeSource integration in circuit_simulation.py - Re-applied compute_segment_coordinates() to Cell class - Ported axon/myelin interpolation methods from neurodamus - Updated _add_extracellular_stimulus to use coordinate interpolation - Added unit tests for coordinate helpers (interp_axon_positions, interp_myelin_positions) - All pytest tests pass
- Import Callable from typing instead of using builtins.callable - Add proper type annotation for func_loc2glob parameter - Change return type to Optional[np.ndarray] for get_segment_position - Add type annotation for cell_targets dict in circuit_simulation.py - Remove unused variable post_sec_id (ruff F841)
- Add spatially_uniform_e_field to test_pattern_from_sonata_valid test - Fix docformatter issue in circuit_simulation.py (wrap docstring) - All 68 stimulus tests pass - All 58 cell core tests pass
- Add tests for ElectrodeSource.__iadd__() edge cases (delay, non-overlapping, concatenation) - Add test for cleanup() method - Add tests for Pattern.from_blueconfig() method - Add tests for SINUSOIDAL and SECLAMP patterns in from_sonata() - Coverage increased from 93% to 94%
Previously _add_extracellular_stimulus only iterated over the soma segments from the resolved targets list (seg_list), causing the e-field displacement to be ~zero and producing no visible effect. Neurodamus iterates over all sections/segments of each target cell. This fix replaces the seg_list loop with iteration over all sections and segments of each cell, matching the neurodamus implementation. Verified: voltage difference with vs without e-field increased from ~0 mV to >48 mV.
- Add Cell.set_local_to_global_matrix() and local_to_global_coord_mapping() with quaternion->rotation matrix construction (no scipy dependency). - Rename compute_segment_coordinates -> compute_segment_local_coordinates; add compute_segment_global_coordinates that applies the cell transform. - Switch _add_extracellular_stimulus to iterate the resolved seg_list (honoring compartment_set or node_set->all sections per neurodamus target_point_list semantics). - Set soma displacement to zero in _add_extracellular_stimulus. - Pass a local-to-global closure to get_segment_position for axon/myelin sections that lack 3D points. - Populate the cell transform during instantiate_gids using a new SonataCircuitAccess.get_cell_position_rotation helper. - Make Cell.delete robust against partially-initialized cells. - Add unit tests for cell coordinate helpers, integration tests for the e-field stimulus glue, and additional ElectrodeSource coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.