def test_Exceptions(self, universe, sn1_scc): match = "sn1_scc and sn2_scc must have been run with the same frames" with pytest.raises(ValueError, match=match): sn2_scc = SCC( universe=universe, **self.kwargs, ) sn2_scc.run(stop=0) SCC.weighted_average(sn1_scc, sn2_scc) with pytest.raises(ValueError, match=match): sn2_scc = SCC( universe=universe, **self.kwargs, ) sn2_scc.run(stop=1) sn2_scc.frames = np.array([10]) SCC.weighted_average(sn1_scc, sn2_scc)
def test_SCC_weighted_average(self, sn1_scc): scc = SCC.weighted_average(sn1_scc, sn1_scc) reference = { 'n_residues': 50, 'n_frames': 1, 'scc': np.full((50, 1), fill_value=-0.5) # all bonds are perpendicular to the z-axis } assert scc.SCC.shape == (reference['n_residues'], reference['n_frames']) assert_array_almost_equal(scc.SCC, reference['scc'])
def test_SCC_weighted_average_different_tails(self, universe, sn1_scc): sn2_scc = SCC(universe, "name L") sn2_scc.run() scc = SCC.weighted_average(sn1_scc, sn2_scc) reference = { 'n_residues': 100, 'n_frames': 1, 'scc': np.full( (100, 1), fill_value=-0.5) # all bonds are perpendicular to the z-axis } assert scc.SCC.shape == (reference['n_residues'], reference['n_frames']) assert_array_almost_equal(scc.SCC, reference['scc'])