Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plot_drift_raster_map widget #3068

Merged
merged 12 commits into from
Jun 27, 2024
Merged

Conversation

alejoe91
Copy link
Member

Separate drift maps into a separate widget:

image

@alejoe91 alejoe91 added the widgets Related to widgets module label Jun 24, 2024
Copy link
Collaborator

@zm711 zm711 left a comment

Choose a reason for hiding this comment

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

Couple initial doc things.

src/spikeinterface/widgets/driftmap.py Outdated Show resolved Hide resolved
peaks : np.array
The peaks array, with dtype ("sample_index", "channel_index", "amplitude", "segment_index")
peak_locations : np.array
The peak locations, with dtype ("x", "y") or ("x", "y", "z")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may need more here for peak_locations just because the issue of what x y and z mean come up a lot on probe interface no?

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe just, as computed from the localize_peaks or spike_locations extension?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fair so that the user knows that the input needs to be exactly from that function/extension.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Another use for the glossary @zm711 !

src/spikeinterface/widgets/driftmap.py Outdated Show resolved Hide resolved
src/spikeinterface/widgets/driftmap.py Outdated Show resolved Hide resolved
@samuelgarcia
Copy link
Member

Could we move this into the motion.py to centralize everything related in the palce ?

Copy link
Collaborator

@JoeZiminski JoeZiminski left a comment

Choose a reason for hiding this comment

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

Nice! Approved with some suggested changes.

cmap="inferno",
clim=None,
alpha=1,
backend=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this backend argument must be None or matplotlib so it is undocumented. I think it is nicer to either document and state it's value is fixed, or (probably better?) remove as an option.

Copy link
Member Author

Choose a reason for hiding this comment

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

it gets documented later, see widget_list

src/spikeinterface/widgets/driftmap.py Outdated Show resolved Hide resolved
src/spikeinterface/widgets/driftmap.py Outdated Show resolved Hide resolved
@alejoe91
Copy link
Member Author

Ready for final review! @samuelgarcia @JoeZiminski @zm711

@alejoe91 alejoe91 added this to the 0.101.0 milestone Jun 27, 2024
Copy link
Collaborator

@JoeZiminski JoeZiminski left a comment

Choose a reason for hiding this comment

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

Changes look good, sorry forgot two things!

src/spikeinterface/widgets/tests/test_widgets.py Outdated Show resolved Hide resolved
self.figure, self.axes, self.ax = make_mpl_figure(**backend_kwargs)

if dp.times is None:
peak_times = dp.peaks["sample_index"] / dp.sampling_frequency
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry completely forgot, is this a place to use time_from_sample_index etc. to handle t_start and time vector?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem here is that recording can be None (in that case sampling_frequency is required)

Copy link
Collaborator

@zm711 zm711 left a comment

Choose a reason for hiding this comment

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

I think just one more correction from me and then two discussion points more for the future than to have to do right now :)

segment_index : int | None, default: None
If Motion is multi segment, the must be not None.
mode : "auto" | "line" | "map", default: "line"
How to plot map or lines. "auto" makes it automatic if the number of motion depths is too high.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just thinking about this (but fine to say out of scope for this PR, but "map" vs "line" isn't the clearest right? I mean "line" makes more sense, but thinking from a new user's perspective would I know what "map" meant. What do you think @JoeZiminski?

Copy link
Member Author

Choose a reason for hiding this comment

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

I kind of like map, but we can be clearer about it's definition. Agree that it probably deserves a different issue

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant should we define "map" in all our docstrings, not change the argument :)

cmap : str, default: "inferno"
The colormap to use for the amplitude.
color : str, default: "Gray"
The color of the scatter points if color_amplitude is False.
Copy link
Collaborator

Choose a reason for hiding this comment

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

something for us to discuss. We are super inconsistent with

color_amplitude vs 'color_amplitude' vs color_amplitude (with ticks, but they are being rendered so you can't see them in this third option....)

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I like ticks because it's clear they refer to arguments and " for strings. We need another unification effort here

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with you. I like ticks to emphasize arguments. I'll open an issue for the doc team :)

src/spikeinterface/widgets/motion.py Outdated Show resolved Hide resolved
@alejoe91
Copy link
Member Author

alejoe91 commented Jun 27, 2024

All done! thanks for the feedback :) Will merge after tests so I can update the hybrid tools How to: https://spikeinterface--2436.org.readthedocs.build/en/2436/how_to/benchmark_with_hybrid_recordings.html

@alejoe91 alejoe91 merged commit 96663b7 into SpikeInterface:main Jun 27, 2024
17 checks passed
@alejoe91 alejoe91 changed the title Add plot_drift_map widget Add plot_drift_raster_map widget Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
widgets Related to widgets module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants