Ejemplo n.º 1
0
 def testMergeEpochs(self):
     ep1 = sp.array([
         [0, 10],
         [25, 30],
     ])
     ep2 = sp.array([
         [5, 15],
         [50, 65],
         [90, 88],
     ])
     ep_test = sp.array([
         [0, 15],
         [25, 30],
         [50, 65],
     ])
     assert_equal(merge_epochs(ep1, ep2), ep_test)
Ejemplo n.º 2
0
 def testMergeEpochs(self):
     ep1 = sp.array([
         [0, 10],
         [25, 30],
     ])
     ep2 = sp.array([
         [5, 15],
         [50, 65],
         [90, 88],
     ])
     ep_test = sp.array([
         [0, 15],
         [25, 30],
         [50, 65],
     ])
     assert_equal(merge_epochs(ep1, ep2), ep_test)
Ejemplo n.º 3
0
    spks_info = []
    spks = []
    for id_trl in trial_ids:
        trial_st = None
        try:
            trial_st = db.get_unit_data(id_mu, id_trl)["spiketrain"]
            if trial_st.size == 0:
                print "\tno spiketrain for %s" % db.get_fname_for_id(id_trl)
                continue
            trial_spks, trial_st = get_aligned_spikes(
                data[id_trl], trial_st, tf, align_at=align_at, mc=False, kind="min"
            )
            end = data[id_trl].shape[0]
            nep = epochs_from_spiketrain(trial_st, tf, end=end)
            nep = invert_epochs(nep, end=end)
            nep = merge_epochs(nep)
            ndet.update(data[id_trl], epochs=nep)
            spks.append(trial_spks)
            spks_info.append(sp.vstack([[id_trl] * trial_st.size, trial_st]).T)
            print "\tprocessed %s" % db.get_fname_for_id(id_trl)
        except Exception, e:
            raise RuntimeError("error processing %s\n%s" % (db.get_fname_for_id(id_trl), e))
        finally:
            del trial_st
    spks_info = sp.vstack(spks_info)
    spks = sp.vstack(spks)
    print "found %d spikes in total" % spks.shape[0]
    print "done."

    print "checking SNR of spikes"
    spks_snr = snr_maha(spks, ndet.get_icmx(tf=tf))