Author: bugman Date: Fri Jul 25 15:26:45 2014 New Revision: 24753 URL: http://svn.gna.org/viewcvs/relax?rev=24753&view=rev Log: Merged revisions 24739-24743,24751-24752 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r24739 | bugman | 2014-07-25 12:14:00 +0200 (Fri, 25 Jul 2014) | 21 lines Reverted r24024, the deletion of the Relax_disp.test_hansen_cpmg_data_to_lm63_3site system test. See the thread at http://thread.gmane.org/gmane.science.nmr.relax.scm/21774/focus=6300 for the request that this deletion be reverted. This is the only system test for the 'LM63 3-site' dispersion model using real data. Having this test allows for better coverage of the code. The command used was: svn merge -r24024:r24023 . ..... r24024 | tlinnet | 2014-06-17 12:32:34 +0200 (Tue, 17 Jun 2014) | 4 lines Changed paths: M /trunk/test_suite/system_tests/relax_disp.py Removed systemtest test_hansen_cpmg_data_to_lm63_3site. This was a temporary implementation and has been replaced with systemtest: Relax_disp.test_lm63_3site_synthetic ..... ........ r24740 | bugman | 2014-07-25 12:14:44 +0200 (Fri, 25 Jul 2014) | 5 lines Updated the Relax_disp.test_hansen_cpmg_data_to_lm63_3site system test. This is for the changes to the optimisation user functions. ........ r24741 | bugman | 2014-07-25 12:18:44 +0200 (Fri, 25 Jul 2014) | 6 lines Updated the checks in the Relax_disp.test_hansen_cpmg_data_to_lm63_3site system test. The values were incorrect due to a bug in relax and a non-optimal minfx setting (https://gna.org/bugs/?22210 and https://gna.org/bugs/?22211). ........ r24742 | bugman | 2014-07-25 13:35:34 +0200 (Fri, 25 Jul 2014) | 7 lines Fix for a fatal bug for the prompt UI on MS Windows. The improvements in the tab completion support for the prompt UI on Mac OS X systems (r24421) was fatal for certain Python readline modules on MS Windows, as readline.__doc__ can be None. This is now correctly handled. ........ r24743 | bugman | 2014-07-25 13:39:33 +0200 (Fri, 25 Jul 2014) | 16 lines Reverted r24736 as this was fatal for the relax information printout - the modules are required. The command used was: svn merge -r24736:r24735 . ..... r24736 | bugman | 2014-07-25 11:20:21 +0200 (Fri, 25 Jul 2014) | 5 lines Changed paths: M /trunk/dep_check.py Clean up of the dep_check module - all imported and unused modules are now deleted as well. This cleans up the module namespace of the unused imports. ..... ........ r24751 | bugman | 2014-07-25 15:08:57 +0200 (Fri, 25 Jul 2014) | 5 lines Decreased the precision the Relax_disp.test_hansen_cpmg_data_to_lm63_3site system test. This is to allow the test to pass on Mac OS X systems. ........ r24752 | bugman | 2014-07-25 15:13:11 +0200 (Fri, 25 Jul 2014) | 7 lines Unit test fix for Mac OS X. This is for the test_ns_mmq_2site_korzhnev_2005_15n_dq_data_complex128 test of test_suite.unit_tests._lib._dispersion.test_matrix_exponential.Test_matrix_exponential. The tests no longer check for exact values, but use the assertAlmostEqual() calls instead. ........ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/dep_check.py branches/frame_order_cleanup/prompt/interpreter.py branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py branches/frame_order_cleanup/test_suite/unit_tests/_lib/_dispersion/test_matrix_exponential.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Jul 25 15:26:45 2014 @@ -1 +1 @@ -/trunk:1-24737 +/trunk:1-24752 Modified: branches/frame_order_cleanup/dep_check.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/dep_check.py?rev=24753&r1=24752&r2=24753&view=diff ============================================================================== --- branches/frame_order_cleanup/dep_check.py (original) +++ branches/frame_order_cleanup/dep_check.py Fri Jul 25 15:26:45 2014 @@ -40,7 +40,6 @@ if float(numpy.version.version[:3]) < 1.6: sys.stderr.write("Version %s of the 'numpy' dependency is not supported, numpy >= 1.6 is required.\n" % numpy.version.version) sys.exit() - del numpy except ImportError: sys.stderr.write("The dependency 'numpy' has not been installed.\n") sys.exit() @@ -48,7 +47,6 @@ # Command line option parser. try: import optparse - del optparse except ImportError: sys.stderr.write("The dependency 'Optik' has not been installed.\n") sys.exit() @@ -56,7 +54,6 @@ # Minfx python package check. try: import minfx - del minfx except ImportError: sys.stderr.write("The dependency 'minfx' has not been installed (see https://gna.org/projects/minfx/).\n") sys.exit() @@ -66,7 +63,6 @@ # Bmrblib python package check. try: import bmrblib - del bmrblib bmrblib_module = True except ImportError: bmrblib_module = False @@ -74,7 +70,6 @@ # wx module. try: import wx - del wx wx_module = True except ImportError: wx_module = False @@ -84,7 +79,6 @@ # epydoc module. try: import epydoc - del epydoc epydoc_module = True except ImportError: epydoc_module = False @@ -95,8 +89,6 @@ if 'TERM' in os.environ and os.environ['TERM'] == 'xterm': os.environ['TERM'] = 'linux' import readline - del os - del readline readline_module = True except ImportError: readline_module = False @@ -104,7 +96,6 @@ # matplotlib module. try: import matplotlib - del matplotlib matplotlib_module = True except ImportError: matplotlib_module = False @@ -112,7 +103,6 @@ # runpy module. try: import runpy - del runpy runpy_module = True except ImportError: runpy_module = False @@ -120,7 +110,6 @@ # profile module (python development packages required). try: import profile - del profile profile_module = True except ImportError: profile_module = False @@ -128,7 +117,6 @@ # profile C module (python development packages required). try: import cProfile - del cProfile cprofile_module = True except ImportError: cprofile_module = False @@ -136,7 +124,6 @@ # BZ2 compression module. try: import bz2 - del bz2 bz2_module = True except ImportError: message = sys.exc_info()[1] @@ -146,7 +133,6 @@ # Gzip compression module. try: import gzip - del gzip gzip_module = True except ImportError: message = sys.exc_info()[1] @@ -156,7 +142,6 @@ # IO module. try: import io - del io io_module = True except ImportError: message = sys.exc_info()[1] @@ -166,7 +151,6 @@ # Scipy import. try: import scipy - del scipy scipy_module = True except: scipy_module = False @@ -182,7 +166,6 @@ # mpi4py. try: import mpi4py - del mpi4py mpi4py_module = True except ImportError: message = sys.exc_info()[1] @@ -201,7 +184,6 @@ # PyMOL. try: import pymol - del pymol pymol_module = True except ImportError: message = sys.exc_info()[1] @@ -225,12 +207,10 @@ else: xml_version = '' xml_type = '' - del xml # subprocess module. try: import subprocess - del subprocess subprocess_module = True except ImportError: message = sys.exc_info()[1] @@ -240,7 +220,6 @@ # ctypes module. try: import ctypes - del ctypes ctypes_module = True except ImportError: message = sys.exc_info()[1] @@ -248,7 +227,6 @@ ctypes_module_message = message.args[0] try: from ctypes import Structure - del Structure ctypes_structure_module = True except ImportError: message = sys.exc_info()[1] @@ -265,7 +243,6 @@ try: from target_functions import relax_fit from target_functions.relax_fit import setup - del relax_fit del setup C_module_exp_fn = True except ImportError: Modified: branches/frame_order_cleanup/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/prompt/interpreter.py?rev=24753&r1=24752&r2=24753&view=diff ============================================================================== --- branches/frame_order_cleanup/prompt/interpreter.py (original) +++ branches/frame_order_cleanup/prompt/interpreter.py Fri Jul 25 15:26:45 2014 @@ -264,7 +264,7 @@ if dep_check.readline_module: readline.set_completer(Tab_completion(name_space=locals()).finish) readline.set_completer_delims(' \t\n`~!@#$%^&*()=+{}\\|;:",<>/?') - if 'libedit' in readline.__doc__: + if readline.__doc__ != None and 'libedit' in readline.__doc__: readline.parse_and_bind("bind ^I rl_complete") else: readline.parse_and_bind("tab: complete") Modified: branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py?rev=24753&r1=24752&r2=24753&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py (original) +++ branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py Fri Jul 25 15:26:45 2014 @@ -3011,6 +3011,70 @@ self.assertAlmostEqual(spin71.phi_ex, 0.0553787825650613, 5) self.assertAlmostEqual(spin71.kex/1000, 2781.72292994154/1000, 5) self.assertAlmostEqual(spin71.chi2, 17.0776399916287, 5) + + + def test_hansen_cpmg_data_to_lm63_3site(self): + """Optimisation of Dr. Flemming Hansen's CPMG data to the LM63 dispersion model. + + This uses the data from Dr. Flemming Hansen's paper at http://dx.doi.org/10.1021/jp074793o. This is CPMG data with a fixed relaxation time period. + """ + + # Base data setup. + self.setup_hansen_cpmg_data(model='LM63 3-site') + + # Alias the spins. + spin70 = return_spin(":70") + spin71 = return_spin(":71") + + # The R20 keys. + r20_key1 = generate_r20_key(exp_type=EXP_TYPE_CPMG_SQ, frq=500e6) + r20_key2 = generate_r20_key(exp_type=EXP_TYPE_CPMG_SQ, frq=800e6) + + ## Set the initial parameter values. + spin70.r2 = {r20_key1: 7.570370921220954, r20_key2: 8.694446951909107} + spin70.phi_ex_B = 0.14872003058250227 + spin70.phi_ex_C = 0.1319419923472704 + spin70.kB = 4103.672910444741 + spin70.kC = 7029.001690726248 + spin71.r2 = {r20_key1: 5.1347793381636, r20_key2: 7.156573986051575} + spin71.phi_ex_B = 0.04013553485505605 + spin71.phi_ex_C = 0.020050748406928887 + spin71.kB = 4045.3007136121364 + spin71.kC = 3586.38798270774 + + #self.interpreter.relax_disp.r20_from_min_r2eff(force=False) + #self.interpreter.minimise.grid_search(lower=None, upper=None, inc=41, constraints=True, verbosity=1) + + # Low precision optimisation. + self.interpreter.minimise.execute(min_algor='simplex', line_search=None, hessian_mod=None, hessian_type=None, func_tol=1e-25, grad_tol=None, max_iter=10000000, constraints=True, scaling=True, verbosity=1) + + # Printout. + print("\n\nOptimised parameters:\n") + print("%-20s %-20s %-20s" % ("Parameter", "Value (:70)", "Value (:71)")) + print("%-20s %20.15g %20.15g" % ("R2 (500 MHz)", spin70.r2[r20_key1], spin71.r2[r20_key1])) + print("%-20s %20.15g %20.15g" % ("R2 (800 MHz)", spin70.r2[r20_key2], spin71.r2[r20_key2])) + print("%-20s %20.15g %20.15g" % ("phi_ex_B", spin70.phi_ex_B, spin71.phi_ex_B)) + print("%-20s %20.15g %20.15g" % ("phi_ex_C", spin70.phi_ex_C, spin71.phi_ex_C)) + print("%-20s %20.15g %20.15g" % ("kB", spin70.kB, spin71.kB)) + print("%-20s %20.15g %20.15g" % ("kC", spin70.kC, spin71.kC)) + print("%-20s %20.15g %20.15g\n" % ("chi2", spin70.chi2, spin71.chi2)) + + # Checks for residue :70. + self.assertAlmostEqual(spin70.r2[r20_key1], 6.7436230253685, 5) + self.assertAlmostEqual(spin70.r2[r20_key2], 6.57406813008828, 6) + self.assertAlmostEqual(spin70.phi_ex_B, 0.206304023079778, 5) + self.assertAlmostEqual(spin70.phi_ex_C, 0.106428983339627, 5) + self.assertAlmostEqual(spin70.kB/1000, 4723.09897652589/1000, 6) + self.assertAlmostEqual(spin70.kC/1000, 4723.09876196409/1000, 6) + self.assertAlmostEqual(spin70.chi2, 363.534044873483, 5) + + # Checks for residue :71. + self.assertAlmostEqual(spin71.r2[r20_key1], 4.96612095596752, 5) + self.assertAlmostEqual(spin71.phi_ex_B, 0.00398262266512895, 5) + self.assertAlmostEqual(spin71.phi_ex_C, 0.0555791581291262, 5) + self.assertAlmostEqual(spin71.kB/1000, 1323.33195689832/1000, 5) + self.assertAlmostEqual(spin71.kC/1000, 3149.58971568059/1000, 5) + self.assertAlmostEqual(spin71.chi2, 16.2620934464368) def test_hansen_cpmg_data_to_ns_cpmg_2site_3D(self): Modified: branches/frame_order_cleanup/test_suite/unit_tests/_lib/_dispersion/test_matrix_exponential.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/unit_tests/_lib/_dispersion/test_matrix_exponential.py?rev=24753&r1=24752&r2=24753&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/unit_tests/_lib/_dispersion/test_matrix_exponential.py (original) +++ branches/frame_order_cleanup/test_suite/unit_tests/_lib/_dispersion/test_matrix_exponential.py Fri Jul 25 15:26:45 2014 @@ -238,7 +238,7 @@ diff_A_neg_imag_sum = sum(diff_A_neg_imag) # Test that the sum difference is zero. - self.assertEqual(diff_A_pos_real_sum , 0.0) - self.assertEqual(diff_A_pos_imag_sum , 0.0) - self.assertEqual(diff_A_neg_real_sum , 0.0) - self.assertEqual(diff_A_neg_imag_sum , 0.0) + self.assertAlmostEqual(diff_A_pos_real_sum, 0.0) + self.assertAlmostEqual(diff_A_pos_imag_sum, 0.0) + self.assertAlmostEqual(diff_A_neg_real_sum, 0.0) + self.assertAlmostEqual(diff_A_neg_imag_sum, 0.0)