-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Hello!
We are interested in using Rastermap to sort individual neurons, and small clusters of neurons with high similarity.
Following the rastermap_singleneurons.ipynb example:
from rastermap import Rastermap
model = Rastermap(n_clusters=None, # None turns off clustering and sorts single neurons
n_PCs=64, # use fewer PCs than neurons
locality=0.1, # some locality in sorting (this is a value from 0-1)
time_lag_window=15, # use future timepoints to compute correlation
grid_upsample=0, # 0 turns off upsampling since we're using single neurons
).fit(spks)Errors:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[15], line 10
3 import matplotlib.pyplot as plt
4 from rastermap import Rastermap
5 model = Rastermap(n_clusters=None, # None turns off clustering and sorts single neurons
6 n_PCs=64, # use fewer PCs than neurons
7 locality=0.1, # some locality in sorting (this is a value from 0-1)
8 time_lag_window=15, # use future timepoints to compute correlation
9 grid_upsample=0, # 0 turns off upsampling since we're using single neurons
---> 10 ).fit(spks)
File c:\Users\RBO\miniforge3\envs\lsp\lib\site-packages\rastermap\rastermap.py:364, in Rastermap.fit(self, data, Usv, Vsv, U_nodes, itrain, compute_X_embedding, BBt)
362 imax = np.arange(0, U_nodes.shape[0])
363 elif self.n_clusters is None:
--> 364 raise ValueError("n_clusters set to None")
365 elif self.n_clusters >= 200:
366 raise ValueError("n_clusters cannot be greater than 200")
ValueError: n_clusters set to NoneThis only works if we select a subsample of spks:
model = Rastermap(
n_clusters=None, # None turns off clustering and sorts single neurons
n_PCs=64, # use fewer PCs than neurons
locality=0.1, # some locality in sorting (this is a value from 0-1)
time_lag_window=15, # use future timepoints to compute correlation
grid_upsample=0, # 0 turns off upsampling since we're using single neurons
).fit(spks[:200])
2025-03-10 16:09:51,713 [INFO] normalizing data across axis=1
2025-03-10 16:09:51,758 [INFO] projecting out mean along axis=0
2025-03-10 16:09:51,811 [INFO] data normalized, 0.10sec
2025-03-10 16:09:51,812 [INFO] sorting activity: 200 valid samples by 64594 timepoints
2025-03-10 16:09:52,210 [INFO] n_PCs = 64 computed, 0.50sec
2025-03-10 16:09:52,230 [INFO] skipping clustering, n_clusters is None
... proceeds successfullyBut any value over 200 errors:
model = Rastermap(
n_clusters=None, # None turns off clustering and sorts single neurons
n_PCs=64, # use fewer PCs than neurons
locality=0.1, # some locality in sorting (this is a value from 0-1)
time_lag_window=15, # use future timepoints to compute correlation
grid_upsample=0, # 0 turns off upsampling since we're using single neurons
).fit(spks[:201])
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[3], line 7
1 model = Rastermap(
2 n_clusters=None, # None turns off clustering and sorts single neurons
3 n_PCs=64, # use fewer PCs than neurons
4 locality=0.1, # some locality in sorting (this is a value from 0-1)
5 time_lag_window=15, # use future timepoints to compute correlation
6 grid_upsample=0, # 0 turns off upsampling since we're using single neurons
----> 7 ).fit(spks[:201])
File c:\Users\RBO\miniforge3\envs\lsp\lib\site-packages\rastermap\rastermap.py:364, in Rastermap.fit(self, data, Usv, Vsv, U_nodes, itrain, compute_X_embedding, BBt)
362 imax = np.arange(0, U_nodes.shape[0])
363 elif self.n_clusters is None:
--> 364 raise ValueError("n_clusters set to None")
365 elif self.n_clusters >= 200:
366 raise ValueError("n_clusters cannot be greater than 200")
ValueError: n_clusters set to NonePlease let me know if there is a reason for this behavior. Thank you!
Metadata
Metadata
Assignees
Labels
No labels