1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23   
 24   
 25  from os import sep 
 26  import sys 
 27  from tempfile import mkdtemp 
 28   
 29   
 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   
 41          """Set up for all the functional tests.""" 
 42   
 43           
 44          self.interpreter.pipe.create('dasha', 'mf') 
 45   
 46           
 47          ds.tmpdir = mkdtemp() 
  48   
 49   
 51          """Test a complete model-free analysis using the program 'Dasha'.""" 
 52   
 53           
 54          try: 
 55              test_binary('dasha') 
 56          except: 
 57              return 
 58   
 59           
 60          self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'dasha.py') 
 61   
 62           
 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           
 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          nucleus = [None, None, None, None] 
 77          model = ['m3', 'm3', 'm3', 'm3'] 
 78          equation = ['mf_orig', 'mf_orig', 'mf_orig', 'mf_orig'] 
 79          params = [['s2', 'rex'], ['s2', 'rex'], ['s2', 'rex'], ['s2', 'rex']] 
 80          xh_vect = [None, None, None, None] 
 81          s2 = [0.71510, 0.64359, None, None] 
 82          s2f = [None, None, None, None] 
 83          s2s = [None, None, None, None] 
 84          local_tm = [None, None, None, None] 
 85          te = [None, None, None, None] 
 86          tf = [None, None, None, None] 
 87          ts = [None, None, None, None] 
 88          rex = [4.32701, 4.29432, None, None] 
 89          r = [1.02e-10, 1.02e-10, 1.02e-10, 1.02e-10] 
 90          csa = [-172e-6, -172e-6, -172e-6, -172e-6] 
 91          chi2 = [1.9657, 0.63673, None, None] 
 92          ri_data = [{'R1_600': 1.0, 'R2_600': 15.0, 'NOE_600': 0.9}, 
 93                     {'R1_600': 0.9, 'R2_600': 13.9, 'NOE_600': 0.79}, 
 94                     {'R2_600': 12.0, 'NOE_600': 0.6}, 
 95                     {'R1_600': None, 'R2_600': None, 'NOE_600': None}] 
 96          ri_data_err = [{'R1_600': 0.05, 'R2_600': 0.5, 'NOE_600': 0.05}, 
 97                         {'R1_600': 0.05, 'R2_600': 0.8, 'NOE_600': 0.05}, 
 98                         {'R2_600': 0.5, 'NOE_600': 0.05}, 
 99                         {'R1_600': None, 'R2_600': None, 'NOE_600': None}] 
100   
101           
102          i = 0 
103          for spin in spin_loop(): 
104               
105              self.assertEqual(spin.select, select[i]) 
106              self.assertEqual(spin.fixed, fixed[i]) 
107              self.assertEqual(spin.proton_type, proton_type[i]) 
108              self.assertEqual(spin.heteronuc_type, heteronuc_type[i]) 
109              self.assertEqual(spin.attached_proton, attached_proton[i]) 
110              self.assertEqual(spin.nucleus, nucleus[i]) 
111              self.assertEqual(spin.model, model[i]) 
112              self.assertEqual(spin.equation, equation[i]) 
113              self.assertEqual(spin.params, params[i]) 
114              self.assertEqual(spin.xh_vect, xh_vect[i]) 
115              self.assertEqual(spin.s2, s2[i]) 
116              self.assertEqual(spin.s2f, s2f[i]) 
117              self.assertEqual(spin.s2s, s2s[i]) 
118              self.assertEqual(spin.local_tm, local_tm[i]) 
119              self.assertEqual(spin.te, te[i]) 
120              self.assertEqual(spin.tf, tf[i]) 
121              self.assertEqual(spin.ts, ts[i]) 
122              self.assertEqual(spin.rex, rex[i]) 
123              self.assertAlmostEqual(spin.r, r[i]) 
124              self.assertAlmostEqual(spin.csa, csa[i]) 
125              self.assertEqual(spin.chi2, chi2[i]) 
126              for ri_id in cdp.ri_ids: 
127                  if ri_id in ri_data[i].keys(): 
128                      self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id]) 
129   
130               
131              i += 1 
  132