Package test_suite :: Package system_tests :: Module dasha
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.dasha

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008 Sebastien Morin                                          # 
  4  # Copyright (C) 2010-2012 Edward d'Auvergne                                   # 
  5  #                                                                             # 
  6  # This file is part of the program relax.                                     # 
  7  #                                                                             # 
  8  # relax is free software; you can redistribute it and/or modify               # 
  9  # it under the terms of the GNU General Public License as published by        # 
 10  # the Free Software Foundation; either version 2 of the License, or           # 
 11  # (at your option) any later version.                                         # 
 12  #                                                                             # 
 13  # relax is distributed in the hope that it will be useful,                    # 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 16  # GNU General Public License for more details.                                # 
 17  #                                                                             # 
 18  # You should have received a copy of the GNU General Public License           # 
 19  # along with relax; if not, write to the Free Software                        # 
 20  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 21  #                                                                             # 
 22  ############################################################################### 
 23   
 24  # Python module imports. 
 25  from os import sep 
 26  import sys 
 27  from tempfile import mkdtemp 
 28   
 29  # relax module imports. 
 30  from base_classes import SystemTestCase 
 31  from data import Relax_data_store; ds = Relax_data_store() 
 32  from generic_fns.mol_res_spin import spin_loop 
 33  from relax_io import test_binary 
 34  from status import Status; status = Status() 
 35   
 36   
37 -class Dasha(SystemTestCase):
38 """Class for testing various aspects specific to model-free analysis using the program 'Dasha'.""" 39
40 - def setUp(self):
41 """Set up for all the functional tests.""" 42 43 # Create the data pipe. 44 self.interpreter.pipe.create('dasha', 'mf') 45 46 # Create a temporary directory for Dasha outputs. 47 ds.tmpdir = mkdtemp()
48 49
50 - def test_dasha(self):
51 """Test a complete model-free analysis using the program 'Dasha'.""" 52 53 # Test for the presence of the Dasha binary (skip the test if not present). 54 try: 55 test_binary('dasha') 56 except: 57 return 58 59 # Execute the script. 60 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'dasha.py') 61 62 # Check the global data. 63 self.assertEqual(len(cdp.ri_ids), 3) 64 for ri_id in cdp.ri_ids: 65 self.assertEqual(cdp.frq[ri_id], 600000000.0) 66 self.assertEqual(cdp.ri_type['R1_600'], 'R1') 67 self.assertEqual(cdp.ri_type['R2_600'], 'R2') 68 self.assertEqual(cdp.ri_type['NOE_600'], 'NOE') 69 70 # The spin data. 71 select = [True, True, False, False] 72 fixed = [None, None, None, None] 73 proton_type = [None, None, None, None] 74 heteronuc_type = ['15N', '15N', '15N', '15N'] 75 attached_proton = [None, None, None, None] 76 model = ['m3', 'm3', 'm3', 'm3'] 77 equation = ['mf_orig', 'mf_orig', 'mf_orig', 'mf_orig'] 78 params = [['s2', 'rex'], ['s2', 'rex'], ['s2', 'rex'], ['s2', 'rex']] 79 xh_vect = [None, None, None, None] 80 s2 = [0.71510, 0.64359, None, None] 81 s2f = [None, None, None, None] 82 s2s = [None, None, None, None] 83 local_tm = [None, None, None, None] 84 te = [None, None, None, None] 85 tf = [None, None, None, None] 86 ts = [None, None, None, None] 87 rex = [4.32701, 4.29432, None, None] 88 r = [1.02e-10, 1.02e-10, 1.02e-10, 1.02e-10] 89 csa = [-172e-6, -172e-6, -172e-6, -172e-6] 90 chi2 = [1.9657, 0.63673, None, None] 91 ri_data = [{'R1_600': 1.0, 'R2_600': 15.0, 'NOE_600': 0.9}, 92 {'R1_600': 0.9, 'R2_600': 13.9, 'NOE_600': 0.79}, 93 {'R2_600': 12.0, 'NOE_600': 0.6}, 94 {'R1_600': None, 'R2_600': None, 'NOE_600': None}] 95 ri_data_err = [{'R1_600': 0.05, 'R2_600': 0.5, 'NOE_600': 0.05}, 96 {'R1_600': 0.05, 'R2_600': 0.8, 'NOE_600': 0.05}, 97 {'R2_600': 0.5, 'NOE_600': 0.05}, 98 {'R1_600': None, 'R2_600': None, 'NOE_600': None}] 99 100 # Check the spin data. 101 i = 0 102 for spin in spin_loop(): 103 # Check the data. 104 self.assertEqual(spin.select, select[i]) 105 self.assertEqual(spin.fixed, fixed[i]) 106 self.assertEqual(spin.proton_type, proton_type[i]) 107 self.assertEqual(spin.heteronuc_type, heteronuc_type[i]) 108 self.assertEqual(spin.attached_proton, attached_proton[i]) 109 self.assertEqual(spin.model, model[i]) 110 self.assertEqual(spin.equation, equation[i]) 111 self.assertEqual(spin.params, params[i]) 112 self.assertEqual(spin.xh_vect, xh_vect[i]) 113 self.assertEqual(spin.s2, s2[i]) 114 self.assertEqual(spin.s2f, s2f[i]) 115 self.assertEqual(spin.s2s, s2s[i]) 116 self.assertEqual(spin.local_tm, local_tm[i]) 117 self.assertEqual(spin.te, te[i]) 118 self.assertEqual(spin.tf, tf[i]) 119 self.assertEqual(spin.ts, ts[i]) 120 self.assertEqual(spin.rex, rex[i]) 121 self.assertAlmostEqual(spin.r, r[i]) 122 self.assertAlmostEqual(spin.csa, csa[i]) 123 self.assertEqual(spin.chi2, chi2[i]) 124 for ri_id in cdp.ri_ids: 125 if ri_id in ri_data[i].keys(): 126 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id]) 127 128 # Increment the spin index. 129 i += 1
130