<jupyter_start><jupyter_text>First, let's load the clusters.<jupyter_code>from ephys import core
clusters = core.get_clusters(block_path)
print clusters.head()<jupyter_output><empty_output><jupyter_text>Let's check the distribution of cluster values.<jupyter_code>clusters.quality.value_counts()
%matplotlib inline
import seaborn as sns

sns.countplot('quality',data=clusters)<jupyter_output><empty_output><jupyter_text>Sweet! Let's get a new dataframe without the noise or unsorted clusters<jupyter_code>neurons = (
    clusters[clusters.quality.isin(['Good','MUA'])]
    .sort_values(['quality','cluster'])
    .reset_index()
)
print neurons.quality.unique()<jupyter_output>['Good' 'MUA']<jupyter_text>Nice! Now, let's compute some metrics.<jupyter_code>from ephys import clust

neurons['width'] = neurons['cluster'].map(
    lambda clu: clust.get_width(block_path,clu)
)

print neurons.head()
sns.distplot(neurons['width'])
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]
)
import matplotlib.pyplot as plt
plt.scatter(neurons['x_probe'],neurons['y_probe'])
plt.axis('equal')
from ephys import viz
f,ax = plt.subplots(1,1,figsize=(8,16))
viz.plot_all_clusters(block_path,neurons,scale_factor=0.05)
viz.plot_cluster_locations(block_path)
sns.set_style('white')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14238628872775214, 'fraction_numerical': 0.0065919578114700065, 'mean_word_length': 8.92156862745098, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '207508', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 582, 'n_tokens_neox': 559, 'n_words': 83, 'path': 'notebooks/example_cluster_analyses.ipynb', 'repo_name': 'MarvinT/ephys-analysis', 'size': '1517'}