Ejemplo n.º 1
0
    def __test(ns, lab, ints, y):
        _, ann = util.import_lab(ns, six.StringIO(lab))

        assert np.allclose(core.timedelta_to_float(ann.data['time'].values),
                           ints[:, 0])
        assert np.allclose(core.timedelta_to_float(ann.data['duration'].values),
                           ints[:, 1] - ints[:, 0])
        for y1, y2 in zip(list(ann.data['value'].values), y):
            eq_(y1, y2)
Ejemplo n.º 2
0
def test_timedelta_to_float():

    # 2.5 seconds
    t = 2.5
    x = np.timedelta64(int(t * 1e9))
    tn = core.timedelta_to_float(x)

    # convert back
    assert np.allclose(t, tn)