def test_multiply_conformations(): traj = structure.load_coor(ref_file('goldBenchMark.coor')) n_samples = 150 otraj = structure.multiply_conformations(traj, n_samples, 0.1) # iterate over x,y,z and check if any of the bins are more than 3 STD from the mean for i in [0,1,2]: h = np.histogram(otraj.xyz[:,0,i])[0] cutoff = h.std() * 3.0 # chosen arbitrarily deviations = np.abs(h - h.mean()) print deviations / h.std() if np.any( deviations > cutoff ): raise RuntimeError('Highly unlikely centers of mass are randomly ' 'distributed in space. Test is stochastic, though, so' ' try running again to make sure you didn\'t hit a ' 'statistical anomaly')
def test_m_confs(): # smoke test t = trajectory.load( ref_file('ala2.pdb') ) m = structure.multiply_conformations(t, 10, 1.0)