In [1]:
# block_path = '/mnt/cube/ephys-example-data/Pen01_Lft_AP2500_ML1350__Site10_Z2026__B997_cat_P01_S10_Epc10/'
block_path = '/mnt/cube/nyoni-raw/test_data/'
# block_path = '/mnt/cube/ephys-example-data/Pen04_Lft_AP2555_ML500__Site02_Z2688__st979_cat_P04_S02_1/'
First, let's load the clusters.
In [4]:
from ephys import core
In [6]:
clusters = core.get_clusters(block_path)
print clusters.head()
Let's check the distribution of cluster values.
In [4]:
clusters.quality.value_counts()
Out[4]:
In [5]:
%matplotlib inline
import seaborn as sns
sns.countplot('quality',data=clusters)
Out[5]:
Sweet! Let's get a new dataframe without the noise or unsorted clusters
In [6]:
neurons = (
clusters[clusters.quality.isin(['Good','MUA'])]
.sort_values(['quality','cluster'])
.reset_index()
)
print neurons.quality.unique()
Nice! Now, let's compute some metrics.
In [7]:
from ephys import clust
neurons['width'] = neurons['cluster'].map(
lambda clu: clust.get_width(block_path,clu)
)
print neurons.head()
In [8]:
sns.distplot(neurons['width'])
Out[8]:
In [9]:
neurons['x_probe'] = neurons['cluster'].map(
lambda clu: clust.get_cluster_coords(block_path,clu,weight_func=clust.mean_masks_w)[0]
)
neurons['y_probe'] = neurons['cluster'].map(
lambda clu: clust.get_cluster_coords(block_path,clu,weight_func=clust.mean_masks_w)[1]
)
In [10]:
import matplotlib.pyplot as plt
plt.scatter(neurons['x_probe'],neurons['y_probe'])
plt.axis('equal')
Out[10]:
In [11]:
from ephys import viz
f,ax = plt.subplots(1,1,figsize=(8,16))
viz.plot_all_clusters(block_path,neurons,scale_factor=0.05)
In [19]:
viz.plot_cluster_locations(block_path)
In [18]:
sns.set_style('white')