Author: bugman Date: Tue Sep 30 15:32:36 2014 New Revision: 26096 URL: http://svn.gna.org/viewcvs/relax?rev=26096&view=rev Log: Created the Structure.test_mean system test. This is to test the functionality of a planned new feature, the structure.mean user function. This is an analysis aid that will calculate the mean structure from all loaded models. Modified: trunk/test_suite/system_tests/structure.py Modified: trunk/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=26096&r1=26095&r2=26096&view=diff ============================================================================== --- trunk/test_suite/system_tests/structure.py (original) +++ trunk/test_suite/system_tests/structure.py Tue Sep 30 15:32:36 2014 @@ -2726,6 +2726,33 @@ self.interpreter.results.read(file=path+sep+'str_internal') + def test_mean(self): + """Test the U{structure.mean user function<http://www.nmr-relax.com/manual/structure_mean.html>}.""" + + # Create 2 models. + self.interpreter.structure.add_model(model_num=1) + self.interpreter.structure.add_model(model_num=2) + + # Add a single atom. + self.interpreter.structure.add_atom(atom_name='N', res_name='Tyr', res_num=2, pos=[[0., 0., 0.], [1., 2., -2.]], element='N') + self.interpreter.structure.add_atom(atom_name='N', res_name='Phe', res_num=3, pos=[[-1., -2., 2.], [1., 2., -2.]], element='N') + + # Calculate the mean. + self.interpreter.structure.mean() + + # Test the molecule data. + self.assertEqual(len(cdp.structure.structural_data), 1) + self.assertEqual(len(cdp.structure.structural_data[0].mol), 1) + mol = cdp.structure.structural_data[0].mol[0] + self.assertEqual(len(mol.atom_names), 2) + self.assertEqual(mol.x[0], 0.5) + self.assertEqual(mol.y[0], 1.0) + self.assertEqual(mol.z[0], -1.0) + self.assertEqual(mol.x[1], 0.0) + self.assertEqual(mol.y[1], 0.0) + self.assertEqual(mol.z[1], 0.0) + + def test_metadata_xml(self): """Test the storage and loading of metadata into an XML state file."""