Fix raster plot handling of segment times where t_start is not zero. - #4790
Open
JoeZiminski wants to merge 24 commits into
Open
JoeZiminski wants to merge 24 commits into
JoeZiminski wants to merge 24 commits into
Conversation
JoeZiminski
marked this pull request as draft
September 16, 2026 18:55
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
2 times, most recently
from
September 16, 2026 19:40
e322cac to
434d58e
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 13:49
41fa6e9 to
98143d1
Compare
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 14:19
8abc381 to
48ca1c9
Compare
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 14:46
aed7a7e to
25de7b4
Compare
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 14:57
6591e5b to
5ae61c4
Compare
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 16:28
5cf7398 to
da4456c
Compare
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 16:31
7b83d1e to
c000d5b
Compare
JoeZiminski
commented
Sep 17, 2026
| color: str = "Gray", | ||
| clim: tuple[float, float] | None = None, | ||
| alpha: float = 1, | ||
| segment_index: int | list[int] | None = None, |
Contributor
Author
There was a problem hiding this comment.
This is unused in main, but I guess this is public facing and will need a deprecation warning? (although maybe not if its never used anyway)
JoeZiminski
marked this pull request as ready for review
September 17, 2026 17:16
t_start is not zero.
JoeZiminski
force-pushed
the
fix-raster-plot-segment
branch
from
September 17, 2026 17:56
904fecf to
244d985
Compare
for more information, see https://pre-commit.ci
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.
This PR updates the raster widgets which was not handling
t_start, and also patches the associatedget_segment_durationsfunction similarly.The previous implementation calculated spike times using the sample index and sampling frequency, but not incorporating
t_start. Similarly created durations for each segment, and used these in raster plots for things like drawing vertical lines betwen segments.This PR fixes by using the newer time-getting machinery for spike times, and replacing
durationswith a dictionary of start-stop times (tuples) per segment calledsegment_start_stop_times. The reason it's a dictionary not a list is because the segments to display can be sub-selected, and if these are not referred to explicitly it gets complicated as the segments are re-indexed in BaseRasterWidget.durationsis just removed, I assume that's okay as was only used internally.Now
get_segment_durationsalso returns thissegment_start_stop_times. Two things are a bit weird with this fuction, one the name is now not great because it returns two things. Secondly it could look to see if theres a recording and if so, get the true segment spike times, but instead always infers them from the spike_vector. This is to keep the previous behaviour, but maybe it can be renamed likeget_segment_durations_from_spike_vector.In the plots below you can see the original issue / fix - in this example the recording has three segments each 10 seconds long starting at [5.0, 25, 50]. The raster plot however all start at
t=0and the segment boundaries are not correct (note motion plot only takes 1 segment).Before

After

Code to produce plots below, note that the amplitude plots will not generate as show, as needs #4796
Test code