Beispiel #1
0
def test_nfo_1():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    raw_infos = proj.get_infos()
    nfo_infos = [proj.nfo(ri) for ri in raw_infos]
    assert len(nfo_infos) > 0
    for info in nfo_infos:
        assert info['raw']['success']
Beispiel #2
0
def test_nfo_bw():
    proj = Processor("v1", "data/v1", 'bw')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]

    with Pool() as pool:
        nfo_infos = pool.map(_process_trajectory, trajectories, chunksize=1)

    assert len(nfo_infos) == 2

    for info in nfo_infos:
        assert info['meta']['project'] == 'v1'

        if info['meta']['run'] == 5:
            assert info['meta']['clone'] == 0
        elif info['meta']['run'] == 6:
            assert info['meta']['clone'] == 0
        else:
            assert False

        assert os.path.exists(info['path']['workdir'])

        assert set(info.keys()) == {'raw', 'meta', 'path', 'top'}, info
        assert set(info['raw'].keys()) == {'indir', 'real_indir', 'date',
                                           'initdate', 'gens', 'gen_glob',
                                           'success'}
        assert set(info['meta'].keys()) == {'project', 'run', 'clone'}
        assert set(info['path'].keys()) == {'info', 'workdir'}
        assert set(info['top'].keys()) == {'struct', 'fext'}
Beispiel #3
0
def test_nfo_bw():
    proj = Processor("v1", "data/v1", 'bw')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]

    with Pool() as pool:
        nfo_infos = pool.map(_process_trajectory, trajectories, chunksize=1)

    assert len(nfo_infos) == 2

    for info in nfo_infos:
        assert info['meta']['project'] == 'v1'

        if info['meta']['run'] == 5:
            assert info['meta']['clone'] == 0
        elif info['meta']['run'] == 6:
            assert info['meta']['clone'] == 0
        else:
            assert False

        assert os.path.exists(info['path']['workdir'])

        assert set(info.keys()) == {'raw', 'meta', 'path', 'top'}, info
        assert set(info['raw'].keys()) == {
            'indir', 'real_indir', 'date', 'initdate', 'gens', 'gen_glob',
            'success'
        }
        assert set(info['meta'].keys()) == {'project', 'run', 'clone'}
        assert set(info['path'].keys()) == {'info', 'workdir'}
        assert set(info['top'].keys()) == {'struct', 'fext'}
Beispiel #4
0
def test_infogen_2():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    n = 0
    for info in proj.get_infos():
        assert os.path.exists(info['raw']['indir'])
        n += 1

    assert n > 0
Beispiel #5
0
def test_nfo_pool():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    raw_infos = proj.get_infos()
    print("Raw infos", list(proj.get_infos()))
    with Pool() as pool:
        print("Function", proj.nfo)
        nfo_infos = pool.map(proj.nfo, raw_infos)

    print("Returned", nfo_infos)
    assert len(list(nfo_infos)) > 0
Beispiel #6
0
def test_nfo_record():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    raw_infos = proj.get_infos()
    nfo_infos = [_record(proj.nfo, ri) for ri in raw_infos]
    assert len(nfo_infos) > 0

    for info in nfo_infos:
        assert os.path.exists(info['path']['info'])
        with open(info['path']['info']) as f:
            reconstitute = json.load(f)
        assert reconstitute == info
Beispiel #7
0
def test_trajectory_nfo():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]

    with Pool() as pool:
        nfo_infos = pool.map(_process_trajectory, trajectories, chunksize=1)

    n = 0
    for info in nfo_infos:
        assert os.path.exists(info['path']['info'])
        with open(info['path']['info']) as f:
            reconstitute = json.load(f)
        assert reconstitute == info
        n += 1
    assert n > 0
Beispiel #8
0
def test_trajectory_nfo():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]

    with Pool() as pool:
        nfo_infos = pool.map(_process_trajectory, trajectories, chunksize=1)

    n = 0
    for info in nfo_infos:
        assert os.path.exists(info['path']['info'])
        with open(info['path']['info']) as f:
            reconstitute = json.load(f)
        assert reconstitute == info
        n += 1
    assert n > 0
Beispiel #9
0
def test_cnv_bw():
    proj = Processor("v1", "data/v1", 'bw')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]
    cnv2_infos = list(map(_process_trajectory, trajectories))

    assert len(cnv2_infos) > 0

    for info in cnv2_infos:
        assert os.path.exists(info['cnv2']['gens'][0])
        assert "/cnv2" in info['cnv2']['outdir']

        with mdtraj.open(info['cnv2']['gens'][0]) as tfile:
            xyz, time, step, box = tfile.read()
            print("Shape", xyz.shape)
            assert xyz.shape == (11, 22, 3), xyz.shape
Beispiel #10
0
def test_cnv_bw():
    proj = Processor("v1", "data/v1", 'bw')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]
    cnv2_infos = list(map(_process_trajectory, trajectories))

    assert len(cnv2_infos) > 0

    for info in cnv2_infos:
        assert os.path.exists(info['cnv2']['gens'][0])
        assert "/cnv2" in info['cnv2']['outdir']

        with mdtraj.open(info['cnv2']['gens'][0]) as tfile:
            xyz, time, step, box = tfile.read()
            print("Shape", xyz.shape)
            assert xyz.shape == (11, 22, 3), xyz.shape
Beispiel #11
0
def test_cnv():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]
    cnv2_infos = list(map(_process_trajectory, trajectories))

    assert len(cnv2_infos) > 0

    for info in cnv2_infos:
        for g in range(len(info['cnv2']['gens'])):
            assert os.path.exists(info['cnv1']['gens'][g])
            assert os.path.exists(info['cnv2']['gens'][g])

            with mdtraj.open(info['cnv1']['gens'][g]) as tfile:
                with mdtraj.open(info['cnv2']['gens'][g]) as dcdfile:
                    xyz, time, step, box = tfile.read()
                    print("Shape", xyz.shape)
                    assert xyz.shape == (11, 22, 3), xyz.shape

                    xyz_nc, time, lengths, angles = dcdfile.read()
                    np.testing.assert_array_equal(xyz[:-1] * 10, xyz_nc)
Beispiel #12
0
def test_cnv():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    trajectories = [Trajectory(info, proj, None) for info in proj.get_infos()]
    cnv2_infos = list(map(_process_trajectory, trajectories))

    assert len(cnv2_infos) > 0

    for info in cnv2_infos:
        for g in range(len(info['cnv2']['gens'])):
            assert os.path.exists(info['cnv1']['gens'][g])
            assert os.path.exists(info['cnv2']['gens'][g])

            with mdtraj.open(info['cnv1']['gens'][g]) as tfile:
                with mdtraj.open(info['cnv2']['gens'][g]) as dcdfile:
                    xyz, time, step, box = tfile.read()
                    print("Shape", xyz.shape)
                    assert xyz.shape == (11, 22, 3), xyz.shape

                    xyz_nc, time, lengths, angles = dcdfile.read()
                    np.testing.assert_array_equal(xyz[:-1] * 10, xyz_nc)
Beispiel #13
0
def test_infogen():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    infos = list(proj.get_infos())
    assert len(infos) > 0, "{}".format(infos)
Beispiel #14
0
def test_glob():
    proj = Processor("p1234", "data/PROJ1234", 'xa4')
    assert len(proj.get_run_clone_dirs()) > 0