Exemplo n.º 1
0
    def _init_data(self):
        self.cache_dir = self.config_dir
        self.n_samples_waveforms = 31
        self.n_samples_t = 20000
        self.n_channels = 11
        self.n_clusters = 4
        self.n_spikes_per_cluster = 50
        n_spikes_total = self.n_clusters * self.n_spikes_per_cluster
        n_features_per_channel = 4

        self.n_channels = self.n_channels
        self.n_spikes = n_spikes_total
        self.sample_rate = 20000.
        self.duration = self.n_samples_t / float(self.sample_rate)
        self.spike_times = np.arange(0, self.duration, 100. / self.sample_rate)
        self.spike_clusters = np.repeat(np.arange(self.n_clusters),
                                        self.n_spikes_per_cluster)
        assert len(self.spike_times) == len(self.spike_clusters)
        self.cluster_ids = np.unique(self.spike_clusters)
        self.channel_positions = staggered_positions(self.n_channels)

        sc = self.spike_clusters
        self.spikes_per_cluster = lambda c: _spikes_in_clusters(sc, [c])
        self.spike_count = lambda c: len(self.spikes_per_cluster(c))
        self.n_features_per_channel = n_features_per_channel
        self.cluster_groups = {c: None for c in range(self.n_clusters)}

        self.all_traces = artificial_traces(self.n_samples_t, self.n_channels)
        self.all_masks = artificial_masks(n_spikes_total, self.n_channels)
        self.all_waveforms = artificial_waveforms(n_spikes_total,
                                                  self.n_samples_waveforms,
                                                  self.n_channels)
        self.all_features = artificial_features(n_spikes_total,
                                                self.n_channels,
                                                self.n_features_per_channel)
Exemplo n.º 2
0
def test_probe_view(qtbot, tempdir):

    n = 50
    positions = staggered_positions(n)
    best_channels = lambda cluster_id: range(1, 9, 2)

    v = ProbeView(positions=positions,
                  best_channels=best_channels,
                  )
    gui = GUI(config_dir=tempdir)
    gui.show()
    v.attach(gui)
    qtbot.addWidget(gui)

    v.on_select([])
    v.on_select([0])
    v.on_select([0, 2, 3])
    v.on_select([0, 2])

    # qtbot.stop()
    gui.close()
Exemplo n.º 3
0
def test_probe_view(qtbot, tempdir):

    n = 50
    positions = staggered_positions(n)
    best_channels = lambda cluster_id: range(1, 9, 2)

    v = ProbeView(positions=positions,
                  best_channels=best_channels,
                  )
    gui = GUI(config_dir=tempdir)
    gui.show()
    v.attach(gui)
    qtbot.addWidget(gui)

    v.on_select([])
    v.on_select([0])
    v.on_select([0, 2, 3])
    v.on_select([0, 2])

    # qtbot.stop()
    gui.close()
Exemplo n.º 4
0
    def _init_data(self):
        self.cache_dir = self.config_dir
        self.n_samples_waveforms = 31
        self.n_samples_t = 20000
        self.n_channels = 11
        self.n_clusters = 4
        self.n_spikes_per_cluster = 200
        n_spikes_total = self.n_clusters * self.n_spikes_per_cluster
        n_features_per_channel = 4

        self.n_channels = self.n_channels
        self.n_spikes = n_spikes_total
        self.sample_rate = 20000.
        self.duration = self.n_samples_t / float(self.sample_rate)
        self.spike_times = np.arange(
            0, self.duration,
            5000. / (self.sample_rate * self.n_spikes_per_cluster))
        self.spike_clusters = np.repeat(np.arange(self.n_clusters),
                                        self.n_spikes_per_cluster)
        assert len(self.spike_times) == len(self.spike_clusters)
        self.cluster_ids = np.unique(self.spike_clusters)
        self.channel_positions = staggered_positions(self.n_channels)
        self.channel_order = np.arange(self.n_channels)

        sc = self.spike_clusters
        self.spikes_per_cluster = lambda c: _spikes_in_clusters(sc, [c])
        self.spike_count = lambda c: len(self.spikes_per_cluster(c))
        self.n_features_per_channel = n_features_per_channel
        self.cluster_groups = {c: None for c in range(self.n_clusters)}

        self.all_traces = artificial_traces(self.n_samples_t, self.n_channels)
        self.all_masks = artificial_masks(n_spikes_total, self.n_channels)
        self.all_waveforms = artificial_waveforms(n_spikes_total,
                                                  self.n_samples_waveforms,
                                                  self.n_channels)
        self.all_features = artificial_features(n_spikes_total,
                                                self.n_channels,
                                                self.n_features_per_channel)
Exemplo n.º 5
0
def test_get_boxes():
    positions = [[-1, 0], [1, 0]]
    boxes = _get_boxes(positions)
    ac(boxes, [[-1, -.25, 0, .25],
               [+0, -.25, 1, .25]], atol=1e-4)

    positions = [[-1, 0], [1, 0]]
    boxes = _get_boxes(positions, keep_aspect_ratio=False)
    ac(boxes, [[-1, -1, 0, 1],
               [0, -1, 1, 1]], atol=1e-4)

    positions = linear_positions(4)
    boxes = _get_boxes(positions)
    ac(boxes, [[-0.5, -1.0, +0.5, -0.5],
               [-0.5, -0.5, +0.5, +0.0],
               [-0.5, +0.0, +0.5, +0.5],
               [-0.5, +0.5, +0.5, +1.0],
               ], atol=1e-4)

    positions = staggered_positions(8)
    boxes = _get_boxes(positions)
    ac(boxes[:, 1], np.arange(.75, -1.1, -.25), atol=1e-6)
    ac(boxes[:, 3], np.arange(1, -.76, -.25), atol=1e-7)
Exemplo n.º 6
0
 def get_waveforms(cluster_id):
     return Bunch(
         data=artificial_waveforms(10, 20, nc),
         channel_ids=np.arange(nc),
         channel_positions=staggered_positions(nc),
     )
Exemplo n.º 7
0
def site_positions(n_channels):
    yield staggered_positions(n_channels)
Exemplo n.º 8
0
def site_positions(n_channels):
    yield staggered_positions(n_channels)
Exemplo n.º 9
0
 def get_waveforms(cluster_id):
     return Bunch(
         data=artificial_waveforms(10, 20, nc), channel_ids=np.arange(nc), channel_positions=staggered_positions(nc)
     )