Author: bugman Date: Wed Nov 25 18:38:34 2015 New Revision: 28117 URL: http://svn.gna.org/viewcvs/relax?rev=28117&view=rev Log: Created the Structure.test_pca_observers system test.
This is for testing the new observer structures concept of the structure.pca user function. Added: trunk/test_suite/system_tests/scripts/structure/pca_observers.py Modified: trunk/test_suite/system_tests/structure.py Added: trunk/test_suite/system_tests/scripts/structure/pca_observers.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/scripts/structure/pca_observers.py?rev=28117&view=auto ============================================================================== --- trunk/test_suite/system_tests/scripts/structure/pca_observers.py (added) +++ trunk/test_suite/system_tests/scripts/structure/pca_observers.py Wed Nov 25 18:38:34 2015 @@ -0,0 +1,31 @@ +# Python module imports. +from os import sep + +# relax imports. +from data_store import Relax_data_store; ds = Relax_data_store() +from status import Status; status = Status() + + +# Missing temp directory (allow this script to run outside of the system test framework). +if not hasattr(ds, 'tmpdir'): + ds.tmpdir = 'temp_script' + +# Create a data pipe. +pipe.create('pca test', 'N-state') + +# Load the structures. +path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'pca' +structure.read_pdb('distribution.pdb', dir=path, read_mol=1, set_mol_name='CaM A') +structure.read_pdb('distribution.pdb', dir=path, read_mol=4, set_mol_name='CaM A', merge=True) + +# Create a reference structure. +pipe.create('ref', 'N-state') +structure.read_pdb('distribution.pdb', dir=path, read_mol=1, read_model=1, set_mol_name='CaM A') +structure.translate([10.0, 10.0, 10.0]) +pipe.switch('pca test') + +# PCA analysis. +structure.pca(pipes=['pca test', 'ref'], obs_pipes=['ref'], dir=ds.tmpdir) + +# Save the program state. +state.save(force=True, dir=ds.tmpdir) Modified: trunk/test_suite/system_tests/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=28117&r1=28116&r2=28117&view=diff ============================================================================== --- trunk/test_suite/system_tests/structure.py (original) +++ trunk/test_suite/system_tests/structure.py Wed Nov 25 18:38:34 2015 @@ -4161,6 +4161,37 @@ self.assertAlmostEqual(cdp.structure.pca_proj[mode, struct], proj[struct, mode], 4) + def test_pca_observers(self): + """Test the principle component analysis of the structure.pca user function while using observer molecules.""" + + # Execute the script. + self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'structure'+sep+'pca_observers.py') + + # The Gromacs values (converted from nm to Angstrom). + values = array([0.417808, 0.0164377, 0.000675256, 1.17952e-05], float64) * 100 + proj = array([ + [-0.38735, 0.21143, -0.02325, -0.00119], + [ 0.96087, 0.07893, 0.02651, 0.00209], + [-0.84236, -0.05173, 0.03651, -0.00140], + [-0.23302, -0.11191, -0.02209, 0.00530], + [ 0.50186, -0.12672, -0.01767, -0.00481] + ], float64) * 10 + + # Invert the 3rd and 4th Gromacs eigenvectors to match. + proj[:, 2] = -proj[:, 2] + proj[:, 3] = -proj[:, 3] + + # Checks. + self.assert_(hasattr(cdp.structure, 'pca_values')) + self.assert_(hasattr(cdp.structure, 'pca_vectors')) + self.assert_(hasattr(cdp.structure, 'pca_proj')) + self.assertEqual(len(cdp.structure.pca_values), 4) + for mode in range(4): + self.assertAlmostEqual(cdp.structure.pca_values[mode], values[mode], 5) + for struct in range(5): + self.assertAlmostEqual(cdp.structure.pca_proj[mode, struct], proj[struct, mode], 4) + + def test_pdb_combined_secondary_structure(self): """Test the handling of secondary structure metadata when combining multiple PDB structures.""" _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits