mailr19719 - in /branches/relax_disp/test_suite/gui_tests: __init__.py relax_disp.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 23, 2013 - 19:24:
Author: bugman
Date: Thu May 23 19:24:10 2013
New Revision: 19719

URL: http://svn.gna.org/viewcvs/relax?rev=19719&view=rev
Log:
Created the Relax_disp.test_hansen_trunc_data GUI test for checking the GUI 
dispersion auto-analysis.

This checks the full operation of the relaxation dispersion GUI analysis, 
without checking the final
results (to be added later).


Added:
    branches/relax_disp/test_suite/gui_tests/relax_disp.py
Modified:
    branches/relax_disp/test_suite/gui_tests/__init__.py

Modified: branches/relax_disp/test_suite/gui_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/gui_tests/__init__.py?rev=19719&r1=19718&r2=19719&view=diff
==============================================================================
--- branches/relax_disp/test_suite/gui_tests/__init__.py (original)
+++ branches/relax_disp/test_suite/gui_tests/__init__.py Thu May 23 19:24:10 
2013
@@ -42,6 +42,7 @@
 from test_suite.gui_tests.n_state_model import N_state_model
 from test_suite.gui_tests.noe import Noe
 from test_suite.gui_tests.pipes import Pipes
+from test_suite.gui_tests.relax_disp import Relax_disp
 from test_suite.gui_tests.rx import Rx
 from test_suite.gui_tests.state import State
 from test_suite.gui_tests.test_user_functions import User_functions
@@ -123,6 +124,7 @@
             
suite_array.append(TestLoader().loadTestsFromTestCase(N_state_model))
             suite_array.append(TestLoader().loadTestsFromTestCase(Noe))
             suite_array.append(TestLoader().loadTestsFromTestCase(Pipes))
+            
suite_array.append(TestLoader().loadTestsFromTestCase(Relax_disp))
             suite_array.append(TestLoader().loadTestsFromTestCase(Rx))
             suite_array.append(TestLoader().loadTestsFromTestCase(State))
             
suite_array.append(TestLoader().loadTestsFromTestCase(User_functions))

Added: branches/relax_disp/test_suite/gui_tests/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/gui_tests/relax_disp.py?rev=19719&view=auto
==============================================================================
--- branches/relax_disp/test_suite/gui_tests/relax_disp.py (added)
+++ branches/relax_disp/test_suite/gui_tests/relax_disp.py Thu May 23 
19:24:10 2013
@@ -1,0 +1,226 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2013 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax (http://www.nmr-relax.com).         
 #
+#                                                                            
 #
+# This program is free software: you can redistribute it and/or modify       
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation, either version 3 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# This program is distributed in the hope that it will be useful,            
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""GUI tests for the relaxation dispersion analyses."""
+
+# Python module imports.
+from os import sep
+import wx
+
+# relax module imports.
+from data_store import Relax_data_store; ds = Relax_data_store()
+import dep_check
+from gui.interpreter import Interpreter; interpreter = Interpreter()
+from gui.string_conv import float_to_gui, str_to_gui
+from status import Status; status = Status()
+from test_suite.gui_tests.base_classes import GuiTestCase
+
+
+class Relax_disp(GuiTestCase):
+    """GUI test case class for testing various aspects of the relaxation 
dispersion analyses."""
+
+    def __init__(self, methodName='runTest'):
+        """Skip the tests if the C modules are non-functional or for 
wxPython bugs.
+
+        @keyword methodName:    The name of the test.
+        @type methodName:       str
+        """
+
+        # Execute the base class method.
+        super(Relax_disp, self).__init__(methodName)
+
+        # Missing module.
+        if not dep_check.C_module_exp_fn:
+            # Store in the status object. 
+            status.skipped_tests.append([methodName, 'Relax curve-fitting C 
module', self._skip_type])
+
+
+    def test_hansen_trunc_data(self):
+        """Test the GUI analysis with Flemming Hansen's CPMG data truncated 
to residues 70 and 71."""
+
+        # The paths to the data files.
+        data_path = status.install_path + sep + 'test_suite' + sep + 
'shared_data' + sep + 'dispersion' + sep + 'Hansen' + sep
+        data_path_500 = data_path + sep + '500_MHz' + sep
+        data_path_800 = data_path + sep + '800_MHz' + sep
+
+        # Simulate the new analysis wizard.
+        self.app.gui.analysis.menu_new(None)
+        page = self.app.gui.analysis.new_wizard.wizard.get_page(0)
+        page.select_disp(None)
+        self.app.gui.analysis.new_wizard.wizard._go_next(None)
+        page = self.app.gui.analysis.new_wizard.wizard.get_page(1)
+        self.app.gui.analysis.new_wizard.wizard._go_next(None)
+        self.app.gui.analysis.new_wizard.wizard._go_next(None)
+
+        # Get the data.
+        analysis_type, analysis_name, pipe_name, pipe_bundle, uf_exec = 
self.app.gui.analysis.new_wizard.get_data()
+
+        # Set up the analysis.
+        self.app.gui.analysis.new_analysis(analysis_type=analysis_type, 
analysis_name=analysis_name, pipe_name=pipe_name, pipe_bundle=pipe_bundle, 
uf_exec=uf_exec)
+
+        # Alias the analysis.
+        analysis = self.app.gui.analysis.get_page_from_name("Relaxation 
dispersion")
+
+        # Change the results directory.
+        analysis.field_results_dir.SetValue(str_to_gui(ds.tmpdir))
+
+        # Load the sequence.
+        file = data_path + 'fake_sequence.in_trunc'
+        self._execute_uf(uf_name='sequence.read', file=file, 
mol_name_col=None, res_num_col=1, res_name_col=2, spin_name_col=None, 
spin_num_col=None)
+
+        # Flush the interpreter in preparation for the synchronous user 
functions of the peak list wizard.
+        interpreter.flush()
+
+        # The spectral data - spectrum ID, peak list file name, CPMG 
frequency (Hz), spectrometer frequency in Hertz.
+        data = [
+            ['500_reference.in',    '500_MHz'+sep+'reference.in_trunc',      
     None,  500e6],
+            ['500_66.667.in',       '500_MHz'+sep+'66.667.in_trunc',         
  66.6666,  500e6],
+            ['500_133.33.in',       '500_MHz'+sep+'133.33.in_trunc',         
 133.3333,  500e6],
+            ['500_133.33.in.bis',   '500_MHz'+sep+'133.33.in.bis_trunc',     
 133.3333,  500e6],
+            ['500_200.in',          '500_MHz'+sep+'200.in_trunc',            
 200.0000,  500e6],
+            ['500_266.67.in',       '500_MHz'+sep+'266.67.in_trunc',         
 266.6666,  500e6],
+            ['500_333.33.in',       '500_MHz'+sep+'333.33.in_trunc',         
 333.3333,  500e6],
+            ['500_400.in',          '500_MHz'+sep+'400.in_trunc',            
 400.0000,  500e6],
+            ['500_466.67.in',       '500_MHz'+sep+'466.67.in_trunc',         
 466.6666,  500e6],
+            ['500_533.33.in',       '500_MHz'+sep+'533.33.in_trunc',         
 533.3333,  500e6],
+            ['500_533.33.in.bis',   '500_MHz'+sep+'533.33.in.bis_trunc',     
 533.3333,  500e6],
+            ['500_600.in',          '500_MHz'+sep+'600.in_trunc',            
 600.0000,  500e6],
+            ['500_666.67.in',       '500_MHz'+sep+'666.67.in_trunc',         
 666.6666,  500e6],
+            ['500_733.33.in',       '500_MHz'+sep+'733.33.in_trunc',         
 733.3333,  500e6],
+            ['500_800.in',          '500_MHz'+sep+'800.in_trunc',            
 800.0000,  500e6],
+            ['500_866.67.in',       '500_MHz'+sep+'866.67.in_trunc',         
 866.6666,  500e6],
+            ['500_933.33.in',       '500_MHz'+sep+'933.33.in_trunc',         
 933.3333,  500e6],
+            ['500_933.33.in.bis',   '500_MHz'+sep+'933.33.in.bis_trunc',     
 933.3333,  500e6],
+            ['500_1000.in',         '500_MHz'+sep+'1000.in_trunc',           
1000.0000,  500e6],
+            ['800_reference.in',    '800_MHz'+sep+'reference.in_trunc',      
     None,  800e6],
+            ['800_66.667.in',       '800_MHz'+sep+'66.667.in_trunc',         
  66.6666,  800e6],
+            ['800_133.33.in',       '800_MHz'+sep+'133.33.in_trunc',         
 133.3333,  800e6],
+            ['800_133.33.in.bis',   '800_MHz'+sep+'133.33.in.bis_trunc',     
 133.3333,  800e6],
+            ['800_200.in',          '800_MHz'+sep+'200.in_trunc',            
 200.0000,  800e6],
+            ['800_266.67.in',       '800_MHz'+sep+'266.67.in_trunc',         
 266.6666,  800e6],
+            ['800_333.33.in',       '800_MHz'+sep+'333.33.in_trunc',         
 333.3333,  800e6],
+            ['800_400.in',          '800_MHz'+sep+'400.in_trunc',            
 400.0000,  800e6],
+            ['800_466.67.in',       '800_MHz'+sep+'466.67.in_trunc',         
 466.6666,  800e6],
+            ['800_533.33.in',       '800_MHz'+sep+'533.33.in_trunc',         
 533.3333,  800e6],
+            ['800_533.33.in.bis',   '800_MHz'+sep+'533.33.in.bis_trunc',     
 533.3333,  800e6],
+            ['800_600.in',          '800_MHz'+sep+'600.in_trunc',            
 600.0000,  800e6],
+            ['800_666.67.in',       '800_MHz'+sep+'666.67.in_trunc',         
 666.6666,  800e6],
+            ['800_733.33.in',       '800_MHz'+sep+'733.33.in_trunc',         
 733.3333,  800e6],
+            ['800_800.in',          '800_MHz'+sep+'800.in_trunc',            
 800.0000,  800e6],
+            ['800_866.67.in',       '800_MHz'+sep+'866.67.in_trunc',         
 866.6666,  800e6],
+            ['800_933.33.in',       '800_MHz'+sep+'933.33.in_trunc',         
 933.3333,  800e6],
+            ['800_933.33.in.bis',   '800_MHz'+sep+'933.33.in.bis_trunc',     
 933.3333,  800e6],
+            ['800_1000.in',         '800_MHz'+sep+'1000.in_trunc',           
1000.0000,  800e6]
+        ]
+
+        # Replicated spectra.
+        replicated = [
+            ['500_133.33.in', '500_133.33.in.bis'],
+            ['500_533.33.in', '500_533.33.in.bis'],
+            ['500_933.33.in', '500_933.33.in.bis'],
+            ['800_133.33.in', '800_133.33.in.bis'],
+            ['800_533.33.in', '800_533.33.in.bis'],
+            ['800_933.33.in', '800_933.33.in.bis']
+        ]
+
+        # Set up the peak intensity wizard.
+        analysis.peak_wizard_launch(None)
+        wizard = analysis.peak_wizard
+
+        # Spin naming.
+        page = wizard.get_page(wizard.page_indices['name'])
+        page.uf_args['name'].SetValue(str_to_gui("N"))
+        page.uf_args['force'].SetValue(True)
+        wizard._go_next(None)
+
+        # The spectrum.
+        page = wizard.get_page(wizard.page_indices['read'])
+        for id, file, cpmg_frq, H_frq in data:
+            page.uf_args['file'].SetValue(str_to_gui("%s%s" % (data_path, 
file)))
+            page.uf_args['spectrum_id'].SetValue(str_to_gui(id))
+            page.uf_args['int_method'].SetValue(str_to_gui('height'))
+            wizard._apply(None)
+        wizard._skip(None)
+
+        # The error type.
+        page = wizard.get_page(wizard.page_indices['err_type'])
+        page.selection = 'repl'
+        wizard._go_next(None)
+
+        # Replicated spectra:
+        page = wizard.get_page(wizard.page_indices['repl'])
+        for id1, id2 in replicated:
+            page.uf_args['spectrum_ids'].SetValue(value=id1, index=0)
+            page.uf_args['spectrum_ids'].SetValue(value=id2, index=1)
+            wizard._apply(None)
+        wizard._skip(None)
+
+        # Set the spectrometer frequencies.
+        page = wizard.get_page(wizard.page_indices['frq_set'])
+        for id, file, cpmg_frq, H_frq in data:
+            page.uf_args['id'].SetValue(str_to_gui(id))
+            page.uf_args['frq'].SetValue(float_to_gui(H_frq))
+            wizard._apply(None)
+        wizard._skip(None)
+
+        # Set the relaxation time.
+        page = wizard.get_page(wizard.page_indices['relax_time'])
+        for id, file, cpmg_frq, H_frq in data:
+            page.uf_args['spectrum_id'].SetValue(str_to_gui(id))
+            page.uf_args['time'].SetValue(float_to_gui(0.03))
+            wizard._apply(None)
+        wizard._skip(None)
+
+        # Set the CPMG frequencies.
+        page = wizard.get_page(wizard.page_indices['cpmg_frq'])
+        for id, file, cpmg_frq, H_frq in data:
+            page.uf_args['spectrum_id'].SetValue(str_to_gui(id))
+            page.uf_args['cpmg_frq'].SetValue(float_to_gui(cpmg_frq))
+            wizard._apply(None)
+        wizard._skip(None)
+        wizard._go_next(None)    # Terminate the wizard.
+
+        # Set the number of MC sims.
+        analysis.mc_sim_num.SetValue(3)
+
+        # Execute relax.
+        analysis.execute(wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, 
analysis.button_exec_relax.GetId()))
+
+        # Wait for execution to complete.
+        analysis.thread.join()
+
+        # Flush all wx events.
+        wx.Yield()
+
+        # Exceptions in the thread.
+        self.check_exceptions()
+
+        # Check the relax controller.
+        # FIXME: skipping the checks for certain wxPython bugs.
+        if status.relax_mode != 'gui' and wx.version() != '2.9.4.1 gtk2 
(classic)':
+            self.assertEqual(self.app.gui.controller.mc_gauge_rx.GetValue(), 
100)
+            self.assertEqual(self.app.gui.controller.main_gauge.GetValue(), 
100)
+
+        # Check the data pipe.
+        self.assertEqual(cdp_name(), ds.relax_gui.analyses[0].pipe_name)
+
+




Related Messages


Powered by MHonArc, Updated Thu May 23 19:40:02 2013