def test_opentrack_bugged():
    u"tests opening incorrect or missing trks"
    try:
        readtrack("does_not_exist.trk")
    except OSError:
        pass
    assert readtrack(path("grfile.gr")) is None
def test_opentrack_small():
    u"test a small track file"
    trk = readtrack(path("small_legacy"))
    assert trk['cyclemin'] == 3
    assert trk['cyclemax'] == 4
    assert trk['nphases'] == 8
    assert trk['t'].size == 996
    assert trk['zmag'].size == 996
    for i in range(39):
        assert trk[i].size == 996
    assert (frozenset(x for x in trk if isinstance(x, int)) == frozenset(
        [x for x in range(92)]))
def test_opentrack_big():
    u"test a big track file"
    trk = readtrack(path("big_legacy"))
    assert trk['cyclemin'] == 3
    assert trk['cyclemax'] == 105
    assert trk['nphases'] == 8
    assert trk['t'].size == 50290
    assert trk['zmag'].size == 50290
    for i in range(39):
        assert trk[i].size == 50290
    assert (frozenset(x for x in trk if isinstance(x, int)) == frozenset(
        [x for x in range(39)]))
示例#4
0
def test_dataframe():
    "test ramp dataframe"
    add = {'fixed', 'status', 'good', 'track', 'modification'}
    out = next(
        create(TrackReaderTask(path=path("ramp_legacy")),
               RampStatsTask()).run())
    assert set(out.columns) == set(RampCycleTuple.fields()) | add

    out = next(
        create(TrackReaderTask(path=path("ramp_legacy")),
               RampStatsTask(events=True)).run())
    assert set(out.columns) == set(RampEventTuple.fields()) | add

    out = next(
        create(TrackReaderTask(path=path("ramp_Hela_mRNA_CIP_4ul_F9.trk")),
               RampStatsTask()).run())
    assert set(out.columns) == set(RampCycleTuple.fields()) | add

    status = out.reset_index().groupby("status").bead.unique()
    assert sorted(status.loc['ok']) == [1, 2, 3, 4, 7, 8, 9, 11, 12]
    assert sorted(status.loc['fixed']) == [0, 5, 10, 13]
    assert sorted(status.loc['bad']) == [6]
def test_opengr():
    u"test a .gr file"
    ret = readgr(path("grfile.gr"))
    assert ret['title'] == (
        b'\\stack{{Bead 0 Z(t) 10}'
        b'{\\pt7 Cycles:[3,104] phase(s) [1,2,3,4,5,6,7]}}')
    assert len(ret) == 101
    key = (b'Bead Cycle 95 phase(s): [1,2,3,4,5,6,7] '
           b'tracking at xx Hz Acquistion 10 for bead 0 \n'
           b' Z coordinate l = xx, w = xx, nim = xx\n')
    assert len(ret[key]) == 2
    assert len(ret[key][0]) == 448
    assert len(ret[key][1]) == 448
    assert str(ret[key][0].dtype) == 'float32'
    assert str(ret[key][1].dtype) == 'float32'
def test_opengr_bugged():
    u"tests opening incorrect or missing grs"
    assert readgr("does_not_exist.gr") is None
    assert readgr(path("small_legacy")) is None