Beispiel #1
0
    for cellid in cell_csv['id']:
        node = h5f.getNode('/', cellid) 
        cell_path = "/".join(cellid.split('/'))
        stim_path = "/".join(cellid.split('/')[:-1]+['stim'])
        try:
            events = node.cache.events.read()
            n_events = len(events)-1
        except NoSuchNodeError:
            n_events = 1
        
        try:
            score = int(node.cache.score[0])
        except NoSuchNodeError:
            score = 0

        spt = data_filter.read_spt(cell_path)
        stim = data_filter.read_spt(stim_path)
        n_spikes = len(spt['data'])
        n_trials = len(stim['data'])
        try:
            psth, psth_time = patterns.CalcPSTH(spt['data'],
                                                stim['data'],
                                                norm=True)
            psth_peak = psth.max()
        except IndexError:
            psth_peak = np.NaN
        stim_start = 0
        stim_stop = -1
        records.append((cell_path, n_events, n_spikes, n_trials,
                        psth_peak, stim_start, stim_stop, score))
Beispiel #2
0
 def test_read_spt(self):
     filter = BakerlabFilter(self.conf_file)
     sp = filter.read_spt(self.cell_node)
     read_data = sp["data"]
     ok_((np.abs(read_data - self.spt_data) <= 1 / 200.0).all())
Beispiel #3
0
    features = sort.features.combine(
        (sort.features.fetP2P(sp_waves, contacts=[0, 1, 2, 3]), sort.features.fetPCs(sp_waves, ncomps=1)),
        normalize=True,
    )

    clust_idx = sort.cluster.cluster("gmm", features, 5)

    features = sort.features.combine((sort.features.fetSpIdx(sp_waves), features))
    spike_sort.ui.plotting.plot_features(features, clust_idx)
    spike_sort.ui.plotting.figure()
    spike_sort.ui.plotting.plot_spikes(sp_waves, clust_idx, n_spikes=200)

    spt_cells = sort.cluster.split_cells(spt, clust_idx)
    features_cells = sort.features.split_cells(features, clust_idx)
    spikes_cells = sort.extract.split_cells(sp_waves, clust_idx)
    stim = io_filter.read_spt(dataset)
    io_filter.close()

    from matplotlib.pyplot import figure, show

    color_map = spike_sort.ui.plotting.label_color(np.unique(spt_cells.keys()))
    for i in spt_cells.keys():
        # plotPSTH(spt_cells[i]['data'], stim['data'],
        #         color=color_map(i),
        #         label="cell {0}".format(i))
        figure()
        dashboard.single_cell(stim, spt_cells[i], color=color_map(i))
    # figure()
    # spike_sort.ui.plotting.legend(spt_cells.keys(),
    #                             color_map(spt_cells.keys()))
    show()
Beispiel #4
0
 def test_read_spt(self):
     filter = BakerlabFilter(self.conf_file)
     sp = filter.read_spt(self.cell_node)
     read_data = sp['data']
     ok_((np.abs(read_data - self.spt_data) <= 1 / 200.).all())