def test_Exceptions(self, universe, sn1_thickness): match = "sn1_thickness and sn2_thickness must have been run with the same frames" with pytest.raises(ValueError, match=match): sn2_thickness = ZThickness( universe=universe, **self.kwargs, ) sn2_thickness.run(stop=0) ZThickness.average(sn1_thickness, sn2_thickness) with pytest.raises(ValueError, match=match): sn2_thickness = ZThickness( universe=universe, **self.kwargs, ) sn2_thickness.run(stop=1) sn2_thickness.frames = np.array([10]) ZThickness.average(sn1_thickness, sn2_thickness)
def test_ZThickness_average_different_tails(self, sn1_thickness, sn2_thickness): thickness = ZThickness.average(sn1_thickness, sn2_thickness) reference = { 'n_residues': 50, 'n_frames': 1, 'z_thickness': np.full((50, 1), fill_value=20) } assert thickness.z_thickness.shape == (reference['n_residues'], reference['n_frames']) assert_array_almost_equal(thickness.z_thickness, reference['z_thickness'])
def test_ZThickness_average(self, sn1_thickness): thickness = ZThickness.average(sn1_thickness, sn1_thickness) reference = { 'n_residues': 25, 'n_frames': 1, 'z_thickness': np.full((25, 1), fill_value=20) } assert isinstance(thickness, ZThickness) assert thickness.z_thickness.shape == (reference['n_residues'], reference['n_frames']) assert_array_almost_equal(thickness.z_thickness, reference['z_thickness'])