Пример #1
0
    def test_0(self):
        import numpy as np
        traj = mdio.iterload(fn('Tc5b.x'), fn('Tc5b.top'))
        fa = traj[:]
        mask = ':1@CA :14@CB :15CA'
        d0 = pt.calc_angle(traj, mask, dtype='dataset').to_ndarray()
        d1 = pt.angle(traj, mask)
        d2 = pt.angle(fa, mask)

        aa_eq(d0, d1)
        aa_eq(d0, d2)

        Nsize = 10
        arr = np.random.randint(0, 300, size=Nsize * 3).reshape(Nsize, 3)
        d3 = pt.angle(fa, arr)
        d4 = pt.angle(traj, arr)
        d5 = pt.calc_angle(traj, arr)
        d6 = pt.calc_angle(fa, arr)
        d7 = pt.calc_angle([fa, traj], arr, n_frames=2 * fa.n_frames)
        aa_eq(d3, d4)
        aa_eq(d3, d5)
        aa_eq(d3, d6)
        aa_eq(d3.T, d7.T[:fa.n_frames])
        aa_eq(d3.T, d7.T[fa.n_frames:])

        d8 = pt.angle(traj, mask, dtype='dataset')
        d9 = pt.tools.dict_to_ndarray(pt.angle(traj, mask, dtype='dict'))
        aa_eq(d0, d8.values)
        aa_eq([d0], d9)
Пример #2
0
    def test_0(self):
        import numpy as np
        traj = mdio.iterload("./data/Tc5b.x", "./data/Tc5b.top")
        fa = traj[:]
        mask = ':1@CA :14@CB :15CA'
        d0 = pt.calc_angle(traj, mask, dtype='dataset').to_ndarray()
        d1 = pt.angle(traj, mask)
        d2 = pt.angle(fa, mask)

        aa_eq(d0, d1)
        aa_eq(d0, d2)

        Nsize = 10
        arr = np.random.randint(0, 300, size=Nsize * 3).reshape(Nsize, 3)
        d3 = pt.angle(fa, arr)
        d4 = pt.angle(traj, arr)
        d5 = pt.calc_angle(traj, arr)
        d6 = pt.calc_angle(fa, arr)
        d7 = pt.calc_angle([fa, traj], arr, n_frames=2 * fa.n_frames)
        aa_eq(d3, d4)
        aa_eq(d3, d5)
        aa_eq(d3, d6)
        aa_eq(d3.T, d7.T[:fa.n_frames])
        aa_eq(d3.T, d7.T[fa.n_frames:])

        d8 = pt.angle(traj, mask, dtype='dataset')
        d9 = pt.tools.dict_to_ndarray(pt.angle(traj, mask, dtype='dict'))
        aa_eq(d0, d8.values)
        aa_eq(d0, d9)
Пример #3
0
    def test_run_3(self):
        dslist = CpptrajDatasetList()
        actlist = ActionList()
        traj = pt.iterload(tc5b_trajin, tc5b_top)
        mask_list = ['@CB @CA @N', '@CA @H @N']

        for mask in mask_list:
            actlist.add(CA.Action_Angle(), mask, traj.top, dslist=dslist)
        actlist.compute(traj)
        pt.calc_angle(traj, mask_list)

        dslist3_0 = pt.calc_angle(traj, mask_list[0])
        dslist3_1 = pt.calc_angle(traj, mask_list[1])
        aa_eq(dslist3_0, dslist[0].to_ndarray())
        aa_eq(dslist3_1, dslist[1].to_ndarray())

        aa_eq(dslist3_0, dslist[0].to_ndarray())
        aa_eq(dslist3_1, dslist[1].to_ndarray())
Пример #4
0
    def test_run_3(self):
        dslist = CpptrajDatasetList()
        actlist = ActionList()
        traj = pt.iterload("./data/Tc5b.x", "./data/Tc5b.top")
        mask_list = ['@CB @CA @N', '@CA @H @N']

        for mask in mask_list:
            actlist.add(CA.Action_Angle(),
                        mask,
                        traj.top,
                        dslist=dslist)
        actlist.compute(traj)

        dslist2 = pt.calc_angle(traj, mask_list)

        dslist3_0 = pt.calc_angle(traj, mask_list[0])
        dslist3_1 = pt.calc_angle(traj, mask_list[1])
        aa_eq(dslist3_0, dslist[0].to_ndarray())
        aa_eq(dslist3_1, dslist[1].to_ndarray())

        aa_eq(dslist3_0, dslist[0].to_ndarray())
        aa_eq(dslist3_1, dslist[1].to_ndarray())