Import the necessary libraries from yass


In [1]:
import numpy as np
import scipy.io
from yass.evaluate import stability, util, visualization, analyzer

Instantiating an analyzer (evaluation)

Here for demonstration, we use retinal dataset that we have gold standard for.

To instantiate, you just have to give the path to .yaml file.

If there is a gold standard spike train you can perform accuracy, if you only can have stability.

Important:

Do not run this code on two configuration files that share the same root_dir.


In [2]:
# Get the gold standard spike train which shape (N, 2)
map_ = scipy.io.loadmat('/ssd/data/peter/ej49_dataset/groundtruth_ej49_data1_set1.mat')
gstd_spike_train = np.append(map_['spt_gt'], map_['L_gt'], axis=1).astype('int32')

# Pass the configuration file.
a = analyzer.Analyzer('/ssd/data/hooshmand/newyass/stability2/config_dummy.yaml', gstd_spike_train)
a.run_analyses()

Stability Results

To see the summary of stability, which is stability of each unit vs SNR of its waveform, just use the following method.

The label of each unit is plotted in the first figure.


In [3]:
a.visualize('stability')


Stability More Details

Using the same method, you can plot waveforms of units of interes. Note that for each indicated unit, you have two wavefors

  • Solid line is for the ground truth/gold standard (in the case of stability, just augmented yass spike train)
  • Dashed line is for the yass cluster mean wave form that has been matched with the ground truth mean waveform.

In [4]:
a.visualize('stability', units=[12, 50, 60])


The Same Goes for Accuracy


In [5]:
a.visualize('accuracy')



In [6]:
a.visualize('accuracy', units=[5, 9, 27])



In [ ]: