Author: bugman Date: Wed Jan 12 17:03:09 2011 New Revision: 12254 URL: http://svn.gna.org/viewcvs/relax?rev=12254&view=rev Log: Simplified the 3 system tests based on the model-free tm2 grid by shifting all the code to the script. Added: 1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py - copied, changed from r12252, 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py Removed: 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py Modified: 1.3/test_suite/system_tests/model_free.py Modified: 1.3/test_suite/system_tests/model_free.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/model_free.py?rev=12254&r1=12253&r2=12254&view=diff ============================================================================== --- 1.3/test_suite/system_tests/model_free.py (original) +++ 1.3/test_suite/system_tests/model_free.py Wed Jan 12 17:03:09 2011 @@ -340,105 +340,23 @@ def test_m2_grid(self): """Test the optimisation of the m2 model-free model against the tm2 parameter grid.""" + # Initialise. + cdp._model = 'm2' + cdp._value_test = self.value_test + # Setup the data pipe for optimisation. - self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_tm2_grid.py') - - # Select the model-free model. - self.interpreter.model_free.select_model(model='m2') - - # The model-free parameters. - tm = [2e-9, 10e-9, 21e-9] - s2 = [0.2, 0.8, 0.95] - te = [2e-12, 40e-12, 1e-9] - - # Deselect all spins. - self.interpreter.deselect.spin() - - # Residue index. - res_index = 0 - - # Loop over te. - for te_index in range(3): - # Loop over s2. - for s2_index in range(3): - # Loop over tm. - for tm_index in range(3): - # Alias the relevent spin container. - spin = cdp.mol[0].res[res_index].spin[0] - - # Select the spin. - spin.select = True - - # Set up the diffusion tensor. - if res_index: - self.interpreter.diffusion_tensor.delete() - self.interpreter.diffusion_tensor.init(tm[tm_index]) - - # Set up the initial model-free parameter values (bypass the grid search for speed). - spin.s2 = s2[s2_index] - spin.te = te[te_index] - - # Minimise. - self.interpreter.minimise('newton', 'gmw', 'back') - - # Check the values. - self.value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, chi2=0.0) - - # Increment the residue index and deselect the spin. - res_index += 1 - spin.select = False + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py') def test_m2_grid_vs_m3(self): """Test the optimisation of the m3 model-free model against the tm2 parameter grid.""" + # Initialise. + cdp._model = 'm3' + cdp._value_test = self.value_test + # Setup the data pipe for optimisation. - self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_tm2_grid.py') - - # Select the model-free model. - self.interpreter.model_free.select_model(model='m3') - - # The model-free parameters. - tm = [2e-9, 10e-9, 21e-9] - s2 = [0.2, 0.8, 0.95] - te = [2e-12, 40e-12, 1e-9] - - # Deselect all spins. - self.interpreter.deselect.spin() - - # Residue index. - res_index = 0 - - # Loop over te. - for te_index in range(3): - # Loop over s2. - for s2_index in range(3): - # Loop over tm. - for tm_index in range(3): - # Alias the relevent spin container. - spin = cdp.mol[0].res[res_index].spin[0] - - # Select the spin. - spin.select = True - - # Set up the diffusion tensor. - if res_index: - self.interpreter.diffusion_tensor.delete() - self.interpreter.diffusion_tensor.init(tm[tm_index]) - - # Set up the initial model-free parameter values (bypass the grid search for speed). - spin.s2 = s2[s2_index] - spin.te = te[te_index] - - # Minimise. - self.interpreter.minimise('newton', 'gmw', 'back') - - # Check the values. - self.value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, rex=0.0, chi2=0.0) - - # Increment the residue index and deselect the spin. - res_index += 1 - spin.select = False + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py') def test_omp_analysis(self): @@ -2176,49 +2094,12 @@ def test_tm2_grid(self): """Test the optimisation of the tm2 model-free parameter grid.""" + # Initialise. + cdp._model = 'tm2' + cdp._value_test = self.value_test + # Setup the data pipe for optimisation. - self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_tm2_grid.py') - - # Select the model-free model. - self.interpreter.model_free.select_model(model='tm2') - - # The model-free parameters. - tm = [2e-9, 10e-9, 21e-9] - s2 = [0.2, 0.8, 0.95] - te = [2e-12, 40e-12, 1e-9] - - # Deselect all spins. - self.interpreter.deselect.spin() - - # Residue index. - res_index = 0 - - # Loop over te. - for te_index in range(3): - # Loop over s2. - for s2_index in range(3): - # Loop over tm. - for tm_index in range(3): - # Alias the relevent spin container. - spin = cdp.mol[0].res[res_index].spin[0] - - # Select the spin. - spin.select = True - - # Set up the initial model-free parameter values (bypass the grid search for speed). - spin.local_tm = tm[tm_index] - spin.s2 = s2[s2_index] - spin.te = te[te_index] - - # Minimise. - self.interpreter.minimise('newton', 'gmw', 'back') - - # Check the values. - self.value_test(spin, local_tm=tm[tm_index]*1e9, s2=s2[s2_index], te=te[te_index]*1e12, chi2=0.0) - - # Increment the residue index and deselect the spin. - res_index += 1 - spin.select = False + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py') def test_tylers_peptide(self): Removed: 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py?rev=12253&view=auto ============================================================================== --- 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py (original) +++ 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py (removed) @@ -1,34 +1,0 @@ -"""Script for setting up the data pipe for testing optimisation.""" - -# Python module imports. -from os import sep - -# relax module imports. -from status import Status; status = Status() - - -# Create a data pipe. -pipe.create('tm2_grid', 'mf') - -# Path of the files. -path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'tm2_grid' - -# Create the sequence. -molecule.create(mol_name='Polycarbonate') -for i in range(3*3*3): - spin.create(spin_num=1, spin_name='C1', res_num=i+1, res_name='Bisphenol_A', mol_name='Polycarbonate') - -# The proton frequencies in MHz. -frq = ['400', '500', '600', '700', '800', '900', '1000'] - -# Load the relaxation data. -for i in range(len(frq)): - relax_data.read('NOE', frq[i], float(frq[i])*1e6, 'noe.%s.out' % frq[i], dir=path, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, data_col=6, error_col=7) - relax_data.read('R1', frq[i], float(frq[i])*1e6, 'r1.%s.out' % frq[i], dir=path, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, data_col=6, error_col=7) - relax_data.read('R2', frq[i], float(frq[i])*1e6, 'r2.%s.out' % frq[i], dir=path, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5, data_col=6, error_col=7) - -# Setup other values. -value.set(1.20 * 1e-10, 'bond_length') -value.set(200 * 1e-6, 'csa') -value.set('13C', 'heteronucleus') -value.set('1H', 'proton') Copied: 1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py (from r12252, 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py) URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py?p2=1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py&p1=1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py&r1=12252&r2=12254&rev=12254&view=diff ============================================================================== --- 1.3/test_suite/system_tests/scripts/model_free/opt_setup_tm2_grid.py (original) +++ 1.3/test_suite/system_tests/scripts/model_free/opt_tm2_grid.py Wed Jan 12 17:03:09 2011 @@ -6,9 +6,6 @@ # relax module imports. from status import Status; status = Status() - -# Create a data pipe. -pipe.create('tm2_grid', 'mf') # Path of the files. path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'tm2_grid' @@ -32,3 +29,59 @@ value.set(200 * 1e-6, 'csa') value.set('13C', 'heteronucleus') value.set('1H', 'proton') + +# Select the model-free model. +model_free.select_model(model=cdp._model) + +# The model-free parameters. +tm = [2e-9, 10e-9, 21e-9] +s2 = [0.2, 0.8, 0.95] +te = [2e-12, 40e-12, 1e-9] + +# Deselect all spins. +deselect.spin() + +# Residue index. +res_index = 0 + +# Loop over te. +for te_index in range(3): + # Loop over s2. + for s2_index in range(3): + # Loop over tm. + for tm_index in range(3): + # Alias the relevent spin container. + spin = cdp.mol[0].res[res_index].spin[0] + + # Select the spin. + spin.select = True + + # Set up the diffusion tensor. + if res_index: + diffusion_tensor.delete() + diffusion_tensor.init(tm[tm_index]) + + # Set up the initial model-free parameter values (bypass the grid search for speed). + if cdp._model in ['tm2']: + spin.local_tm = tm[tm_index] + if cdp._model in ['m2', 'm3']: + spin.s2 = s2[s2_index] + if cdp._model in ['m2', 'm3']: + spin.te = te[te_index] + if cdp._model in ['m3']: + spin.rex = 0.0 + + # Minimise. + minimise('newton', 'gmw', 'back') + + # Check the values. + if cdp._model == 'm2': + cdp._value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, chi2=0.0) + elif cdp._model == 'm3': + cdp._value_test(spin, s2=s2[s2_index], te=te[te_index]*1e12, rex=0.0, chi2=0.0) + elif cdp._model == 'tm2': + cdp._value_test(spin, local_tm=tm[tm_index]*1e9, s2=s2[s2_index], te=te[te_index]*1e12, chi2=0.0) + + # Increment the residue index and deselect the spin. + res_index += 1 + spin.select = False