Author: bugman Date: Tue Nov 23 14:02:38 2010 New Revision: 11698 URL: http://svn.gna.org/viewcvs/relax?rev=11698&view=rev Log: Brought the relaxation dispersion branch into sync with the 1.3 line. There were many design changes within the 1.3 line that required that the old relaxation dispersion code be updated. Modified: branches/relax_disp/dep_check.py branches/relax_disp/prompt/relax_disp.py branches/relax_disp/specific_fns/relax_disp.py branches/relax_disp/specific_fns/relax_fit.py branches/relax_disp/test_suite/system_tests/relax_disp.py branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_fast.py branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_slow.py branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py Modified: branches/relax_disp/dep_check.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/dep_check.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/dep_check.py (original) +++ branches/relax_disp/dep_check.py Tue Nov 23 14:02:38 2010 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2008-2009 Edward d'Auvergne # +# Copyright (C) 2008-2010 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -173,7 +173,7 @@ try: from maths_fns.relax_fit import setup del setup - C_module_fit = True + C_module_exp_fn = True except ImportError, message: # The OS. system = platform.system() @@ -183,14 +183,14 @@ if system == 'Windows' or system == 'Microsoft': file = 'relax_fit.pyd' if not access('maths_fns' + sep + file, F_OK): - C_module_fit_mesg = "ImportError: relaxation curve fitting is unavailable, the corresponding C modules have not been compiled." + C_module_exp_fn_mesg = "ImportError: relaxation curve fitting is unavailable, the corresponding C modules have not been compiled." # Show the full error. else: - C_module_fit_mesg = "ImportError: " + message[0] + "\nRelaxation curve fitting is unavailable, try compiling the C modules." + C_module_exp_fn_mesg = "ImportError: " + message[0] + "\nRelaxation curve fitting is unavailable, try compiling the C modules." # Set the flag. - C_module_fit = False + C_module_exp_fn = False # Relaxation dispersion. try: Modified: branches/relax_disp/prompt/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/prompt/relax_disp.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/prompt/relax_disp.py (original) +++ branches/relax_disp/prompt/relax_disp.py Tue Nov 23 14:02:38 2010 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004-2008 Edward d'Auvergne # +# Copyright (C) 2004-2010 Edward d'Auvergne # # Copyright (C) 2009 Sebastien Morin # # # # This file is part of the program relax. # @@ -25,27 +25,14 @@ """Module containing the 'relax_disp' user function class.""" __docformat__ = 'plaintext' -# Python module imports. -import sys - # relax module imports. -import help +from base_class import User_fn_class from relax_errors import RelaxNoneNumError, RelaxNumError, RelaxStrError from specific_fns.setup import relax_disp_obj -class Relax_disp: - def __init__(self, relax): - # Help. - self.__relax_help__ = \ - """Class for relaxation dispersion curve fitting.""" - - # Add the generic help string. - self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help - - # Place relax in the class namespace. - self.__relax__ = relax - +class Relax_disp(User_fn_class): + """Class for relaxation dispersion user functions.""" def calc_r2eff(self, exp_type='cpmg', id=None, delayT=None, int_cpmg=1.0, int_ref=1.0): """Calculate the effective transversal relaxation rate from the peak intensities. @@ -89,8 +76,8 @@ """ # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_disp.calc_r2eff(" + if self._exec_info.intro: + text = self._exec_info.ps3 + "relax_disp.calc_r2eff(" text = text + "exp_type=" + `exp_type` text = text + ", id=" + `id` text = text + ", delayT=" + `delayT` @@ -149,8 +136,8 @@ """ # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "delayT(" + if self._exec_info.intro: + text = self._exec_info.ps3 + "delayT(" text = text + "id=" + `id` text = text + ", delayT=" + `delayT` + ")" print text @@ -201,8 +188,8 @@ """ # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_disp.cpmg_frq(" + if self._exec_info.intro: + text = self._exec_info.ps3 + "relax_disp.cpmg_frq(" text = text + ", cpmg_frq=" + `cpmg_frq` text = text + "spectrum_id=" + `spectrum_id` + ")" print text @@ -244,8 +231,8 @@ """ # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_disp.exp_type(" + if self._exec_info.intro: + text = self._exec_info.ps3 + "relax_disp.exp_type(" text = text + "exp_type=" + `exp_type` + ")" print text @@ -303,8 +290,8 @@ """ # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "relax_disp.select_model(" + if self._exec_info.intro: + text = self._exec_info.ps3 + "relax_disp.select_model(" text = text + "model=" + `model` + ")" print text Modified: branches/relax_disp/specific_fns/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_fns/relax_disp.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/specific_fns/relax_disp.py (original) +++ branches/relax_disp/specific_fns/relax_disp.py Tue Nov 23 14:02:38 2010 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004-2008 Edward d'Auvergne # +# Copyright (C) 2004-2010 Edward d'Auvergne # # Copyright (C) 2009 Sebastien Morin # # # # This file is part of the program relax. # @@ -30,8 +30,9 @@ from re import match, search # relax module imports. +from api_base import API_base +from api_common import API_common from dep_check import C_module_disp -from base_class import Common_functions from generic_fns import pipes from generic_fns.mol_res_spin import exists_mol_res_spin_data, generate_spin_id, return_spin, spin_loop from minfx.generic import generic_minimise @@ -42,7 +43,7 @@ from maths_fns.relax_disp import setup, func, dfunc, d2func, back_calc_I -class Relax_disp(Common_functions): +class Relax_disp(API_base, API_common): """Class containing functions for relaxation dispersion curve fitting.""" def assemble_param_vector(self, spin=None, sim_index=None): Modified: branches/relax_disp/specific_fns/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_fns/relax_fit.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/specific_fns/relax_fit.py (original) +++ branches/relax_disp/specific_fns/relax_fit.py Tue Nov 23 14:02:38 2010 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004-2009 Edward d'Auvergne # +# Copyright (C) 2004-2010 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -41,7 +41,7 @@ from relax_warnings import RelaxDeselectWarning # C modules. -if C_module_fit: +if C_module_exp_fn: from maths_fns.relax_fit import setup, func, dfunc, d2func, back_calc_I Modified: branches/relax_disp/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/relax_disp.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Tue Nov 23 14:02:38 2010 @@ -22,27 +22,24 @@ ############################################################################### # Python module imports. +import __main__ from os import sep from shutil import rmtree -from string import split -import sys from tempfile import mkdtemp -from unittest import TestCase # relax module imports. +from base_classes import SystemTestCase from data import Relax_data_store; ds = Relax_data_store() -from generic_fns.mol_res_spin import spin_index_loop -from generic_fns import pipes -class Relax_disp(TestCase): +class Relax_disp(SystemTestCase): """Class for testing various aspects specific to relaxation dispersion curve-fitting.""" def setUp(self): """Set up for all the functional tests.""" # Create the data pipe. - self.relax.interpreter._Pipe.create('relax_disp', 'relax_disp') + self.interpreter.pipe.create('relax_disp', 'relax_disp') # Create a temporary directory for dumping files. ds.tmpdir = mkdtemp() @@ -64,7 +61,7 @@ fast-exchange limit.""" # Execute the script. - self.relax.interpreter.run(script_file=sys.path[-1] + '/test_suite/system_tests/scripts/relax_disp_cpmg_fast.py') + self.interpreter.run(script_file=__main__.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_disp_cpmg_fast.py') def test_curve_fitting_cpmg_slow(self): @@ -72,22 +69,19 @@ slow-exchange limit.""" # Execute the script. - self.relax.interpreter.run(script_file=sys.path[-1] + '/test_suite/system_tests/scripts/relax_disp_cpmg_slow.py') + self.interpreter.run(script_file=__main__.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_disp_cpmg_slow.py') def test_read_r2eff(self): """Test the reading of a file containing r2eff values.""" - # Get the current data pipe. - cdp = pipes.get_pipe() - # Create the sequence data, and name the spins. - self.relax.interpreter._Residue.create(1, 'Gly') - self.relax.interpreter._Residue.create(2, 'Gly') - self.relax.interpreter._Residue.create(3, 'Gly') + self.interpreter.residue.create(1, 'Gly') + self.interpreter.residue.create(2, 'Gly') + self.interpreter.residue.create(3, 'Gly') # Read the file. - self.relax.interpreter._Relax_data.read('R2eff', '600', 600 * 1e6, 'r2eff.out', dir=sys.path[-1] + "/test_suite/shared_data/curve_fitting_disp/r2eff") + self.interpreter.relax_data.read('R2eff', '600', 600 * 1e6, 'r2eff.out', dir=__main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'curve_fitting_disp'+sep+'r2eff') # Test the data. Modified: branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_fast.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_fast.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_fast.py (original) +++ branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_fast.py Tue Nov 23 14:02:38 2010 @@ -1,17 +1,19 @@ # Script for CPMG relaxation dispersion curve fitting in the fast-exchange limit. -import sys +# Python module imports. +import __main__ +from os import sep # Create the data pipe. pipe.create('rex', 'relax_disp') # The path to the data files. -data_path_1 = sys.path[-1] + '/test_suite/shared_data/curve_fitting_disp/Hansen/500_MHz' -data_path_2 = sys.path[-1] + '/test_suite/shared_data/curve_fitting_disp/Hansen/800_MHz' +data_path1 = __main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'curve_fitting_disp'+sep+'Hansen'+sep+'500_MHz' +data_path2 = __main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'curve_fitting_disp'+sep+'Hansen'+sep+'800_MHz' # Load the sequence. -sequence.read('fake_sequence.in', dir=sys.path[-1] + '/test_suite/shared_data/curve_fitting_disp/Hansen') +sequence.read('fake_sequence.in', dir=__main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'curve_fitting_disp'+sep+'Hansen', res_num_col=1, res_name_col=2) # Name the spins so they can be matched to the assignments. spin.name(name='N') Modified: branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_slow.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_slow.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_slow.py (original) +++ branches/relax_disp/test_suite/system_tests/scripts/relax_disp_cpmg_slow.py Tue Nov 23 14:02:38 2010 @@ -1,16 +1,18 @@ # Script for CPMG relaxation dispersion curve fitting in the slow-exchange limit. -import sys +# Python module imports. +import __main__ +from os import sep # Create the data pipe. pipe.create('rex', 'relax_disp') # The path to the data files. -data_path = sys.path[-1] + '/test_suite/shared_data/curve_fitting_disp/Hansen/500_MHz' +data_path = __main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'curve_fitting_disp'+sep+'Hansen'+sep+'500_MHz' # Load the sequence. -sequence.read('fake_sequence.in', dir=sys.path[-1] + '/test_suite/shared_data/curve_fitting_disp/Hansen') +sequence.read('fake_sequence.in', dir=__main__.install_path + sep+'test_suite'+sep+'shared_data'+sep+'curve_fitting_disp'+sep+'Hansen', res_num_col=1, res_name_col=2) # Name the spins so they can be matched to the assignments. spin.name(name='N') Modified: branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py?rev=11698&r1=11697&r2=11698&view=diff ============================================================================== --- branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py (original) +++ branches/relax_disp/test_suite/unit_tests/_prompt/test_relax_disp.py Tue Nov 23 14:02:38 2010 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2008 Edward d'Auvergne # +# Copyright (C) 2008-2010 Edward d'Auvergne # # Copyright (C) 2009 Sebastien Morin # # # # This file is part of the program relax. # @@ -30,14 +30,13 @@ # Unit test imports. from data_types import DATA_TYPES -import fake_relax class Test_relax_disp(TestCase): """Unit tests for the functions of the 'prompt.relax_disp' module.""" # Instantiate the user function class. - relax_disp_fns = Relax_disp(fake_relax.fake_instance()) + relax_disp_fns = Relax_disp() def test_relax_calc_r2eff_argfail_exp_type(self):