1   
 2   
 3   
 4   
 5   
 6   
 7   
 8   
 9   
10   
11   
12   
13   
14   
15   
16   
17   
18   
19   
20   
21   
22   
23   
24  from os import sep 
25   
26   
27  from base_classes import SystemTestCase 
28  from data import Relax_data_store; ds = Relax_data_store() 
29  from generic_fns import pipes 
30  from status import Status; status = Status() 
31   
32   
34      """Class for testing model selection.""" 
35   
37          """AIC model selection between two diffusion tensors.""" 
38   
39           
40          pipe_list = ['sphere', 'spheroid'] 
41          tensors = [1e-9, (1e-9, 0, 0, 0)] 
42   
43           
44          path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 
45   
46           
47          for i in xrange(2): 
48               
49              self.interpreter.pipe.create(pipe_list[i], 'mf') 
50   
51               
52              self.interpreter.sequence.read(file='r1.600.out', dir=path, res_num_col=1, res_name_col=2) 
53   
54               
55              self.interpreter.model_free.select_model(model='m4') 
56   
57               
58              self.interpreter.relax_data.read(ri_id='R1_600',  ri_type='R1',  frq=600.0*1e6, file='r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 
59              self.interpreter.relax_data.read(ri_id='R2_600',  ri_type='R2',  frq=600.0*1e6, file='r2.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 
60              self.interpreter.relax_data.read(ri_id='NOE_600', ri_type='NOE', frq=600.0*1e6, file='noe.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 
61              self.interpreter.relax_data.read(ri_id='R1_500',  ri_type='R1',  frq=500.0*1e6, file='r1.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 
62              self.interpreter.relax_data.read(ri_id='R2_500',  ri_type='R2',  frq=500.0*1e6, file='r2.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 
63              self.interpreter.relax_data.read(ri_id='NOE_500', ri_type='NOE', frq=500.0*1e6, file='noe.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 
64   
65               
66              self.interpreter.diffusion_tensor.init(tensors[i], fixed=False) 
67   
68           
69          dp_sphere = pipes.get_pipe('sphere') 
70          dp_spheroid = pipes.get_pipe('spheroid') 
71   
72           
73          dp_sphere.chi2 = 200 
74          dp_spheroid.chi2 = 0 
75   
76           
77          self.interpreter.model_selection(method='AIC', modsel_pipe='aic') 
78   
79           
80          dp_aic = pipes.get_pipe('aic') 
81   
82           
83          self.assert_(hasattr(dp_aic, 'diff_tensor')) 
84          self.assertEqual(dp_aic.diff_tensor.type, 'spheroid') 
  85