feat: enhance sync channel plotting and fix tox coverage path#255
Open
Thashira wants to merge 2 commits into
Open
feat: enhance sync channel plotting and fix tox coverage path#255Thashira wants to merge 2 commits into
Thashira wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to improve sync-channel visualization for long recordings by adding windowed plotting options, and fixes CI coverage configuration to target the correct module.
Changes:
- Add
time_rangeanduse_secondsparameters toSession.plot_sync_channeland delegate them to the run-level plotter. - Update
RawRun.plot_sync_channelplotting to support windowing and improved aesthetics. - Fix
tox.inicoverage target fromswc_epystospikewrap.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| tox.ini | Updates pytest coverage target to the spikewrap package. |
| spikewrap/structure/session.py | Extends session-level sync plotting API to pass through windowing/unit parameters. |
| spikewrap/structure/_raw_run.py | Implements windowed plotting logic and refreshed plot styling for the sync channel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Before submitting a pull request (PR), please read the contributing guide.
Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)
Description
What is this PR
Why is this PR needed?
This PR addresses the TODO in _raw_run.py regarding the improvement of sync channel visualization. Currently, plotting the sync channel lacks time-range support, which is critical for researchers to verify digital trigger alignments in long electrophysiological recordings without incurring memory overhead or UI freezes.
What does this PR do?
1.Time-Range Support: Adds a time_range parameter to plot_sync_channel, allowing specific windowing (defaulting to 0-10s for safety).
2.Physical Units: Introduces a use_seconds flag to plot against a time axis (s) rather than sample indices, improving interpretability.
3.CI Maintenance: Updates tox.ini to point coverage to the correct spikewrap module (formerly swc_epys).
4.UI Improvements: Standardizes plot aesthetics (labels, grid, and coloring) as requested in the source code TODO.
References
Please reference any existing issues/PRs that relate to this PR.
1.Addresses internal TODO in spikewrap/structure/_raw_run.py.
How has this PR been tested?
1.Manual Verification: Tested with the internal sub-001 example dataset to ensure time-to-sample indexing accurately reflects the sampling frequency (fs).
2.Integration Testing: Ran pytest tests/test_integration/test_sync.py and tests/test_integration/test_preprocessing.py to ensure core workflows remain intact.
3.Linting: All changes passed pre-commit hooks (Ruff, Black, Mypy).
Please explain how any new code has been tested, and how you have ensured that no existing functionality has changed.
Is this a breaking change?
If this PR breaks any existing functionality, please explain how and why.
No.
While the function signature changed, I implemented default values (time_range=None, use_seconds=False) that ensure all existing calls in the test suite and user scripts remain fully compatible.
Does this PR require an update to the documentation?
If any features have changed, or have been added. Please explain how the
documentation has been updated.
Yes, the docstrings for Session.plot_sync_channel and SeparateRawRun.plot_sync_channel have been updated to reflect the new parameters.
Checklist: