Exemplo n.º 1
0
def test_bakerlab_signal_source():

    data = np.random.randint(-1000, 1000, (100, ))
    fname = "32test011.sp"

    data.astype(np.int16).tofile(fname)
    src = components.BakerlabSource(conf_file, el_node)

    sp_read = src.signal
    os.unlink(fname)
    ok_((np.abs(sp_read['data'] - data) <= 1 / 200.).all())
Exemplo n.º 2
0
def test_bakerlab_event_read():
    spt_fname = "32test0111.spt"
    spt_data = np.random.randint(0, 100, (10, )) / 200.

    (spt_data * 200).astype(np.int32).tofile(spt_fname)

    src = components.BakerlabSource(conf_file, el_node)

    spt_read = src.events[cell]

    os.unlink(spt_fname)
    ok_((np.ceil(np.abs(spt_read['data'] - spt_data) / 200.) <= 1).all())
Exemplo n.º 3
0
def test_bakerlab_event_write():
    spt_data = np.random.randint(0, 100, (10, )) / 200.

    conf_file = 'test.conf'
    spt_fname = "32test0111.spt"

    src = components.BakerlabSource(conf_file, el_node)
    spt_dict = {"data": spt_data}
    src.events[cell] = spt_dict

    ok = os.path.exists(spt_fname)
    os.unlink(spt_fname)
    ok_(ok)
Exemplo n.º 4
0
def test_export_component():
    base.features.Provide("SpikeMarkerSource", DummySpikeDetector())
    base.features.Provide("LabelSource", DummyLabelSource())
    base.features.Provide("EventsOutput",
                          components.BakerlabSource(conf_file, el_node))

    labels = np.unique(base.features['LabelSource'].labels)
    export_comp = components.ExportCells()
    export_comp.export()

    for i in labels:
        fname = "32test011{0}.spt".format(i)
        assert os.path.exists(fname)
        os.unlink(fname)