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

Extracting waveforms but not sure how to get cluster ID #581

Closed
Coglet00 opened this issue Dec 19, 2023 · 0 comments · Fixed by #595
Closed

Extracting waveforms but not sure how to get cluster ID #581

Coglet00 opened this issue Dec 19, 2023 · 0 comments · Fixed by #595

Comments

@Coglet00
Copy link

import sys
import matplotlib.pyplot as plt
from phylib.io.model import load_model
from phylib.utils.color import selected_cluster_color

First, we load the TemplateModel.

model = load_model(sys.argv[1]) # first argument: path to params.py

We obtain the cluster id from the command-line arguments.

cluster_id = int(sys.argv[2]) # second argument: cluster index

We get the waveforms of the cluster.

waveforms = model.get_cluster_spike_waveforms(cluster_id)
n_spikes, n_samples, n_channels_loc = waveforms.shape

We get the channel ids where the waveforms are located.

channel_ids = model.get_cluster_channels(cluster_id)

We plot the waveforms on the first four channels.

f, axes = plt.subplots(1, min(4, n_channels_loc), sharey=True)
for ch in range(min(4, n_channels_loc)):
axes[ch].plot(waveforms[::100, :, ch].T, c=selected_cluster_color(0, .05))
axes[ch].set_title("channel %d" % channel_ids[ch])
plt.show()

this is the code given in (https://phy.readthedocs.io/en/latest/visualization/)

i am getting an assertion error while writing the cluster ID . it shd be an integer. Its also said it can be obtained using command line arguments.. i am struggling to find which argument is this?

Thanks in advance

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 a pull request may close this issue.

1 participant