Author: bugman Date: Sun Jul 15 16:12:00 2007 New Revision: 3341 URL: http://svn.gna.org/viewcvs/relax?rev=3341&view=rev Log: Application of Sebastien Morin's docstring and comments patch. For the patch, see the post at https://mail.gna.org/public/relax-devel/2007-07/msg00038.html. This patch (patch_consistency_tests__l1.2_r3340__docstrings_and_comments) corrects docstrings and comments errors which were remnants of the jw_mapping code from which the consistency_tests code was inspired. Also, this patch adds docstrings and comments to the code for making it easier for users to understand what the code actually does. Modified: branches/consistency_tests_1.2/maths_fns/consistency_tests.py branches/consistency_tests_1.2/prompt/consistency_tests.py branches/consistency_tests_1.2/sample_scripts/consistency_tests.py branches/consistency_tests_1.2/specific_fns/consistency_tests.py branches/consistency_tests_1.2/test_suite/consistency_tests.py Modified: branches/consistency_tests_1.2/maths_fns/consistency_tests.py URL: http://svn.gna.org/viewcvs/relax/branches/consistency_tests_1.2/maths_fns/consistency_tests.py?rev=3341&r1=3340&r2=3341&view=diff ============================================================================== --- branches/consistency_tests_1.2/maths_fns/consistency_tests.py (original) +++ branches/consistency_tests_1.2/maths_fns/consistency_tests.py Sun Jul 15 16:12:00 2007 @@ -29,12 +29,23 @@ class Consistency: def __init__(self, frq=None, gx=None, gh=None, mu0=None, h_bar=None): - """Consistency tests for data acquired at different magnetic fields.""" + """Consistency tests for data acquired at different magnetic fields. + + These three tests are used to assess the consistency of datasets aquired at different + magnetic fields. Inconsistency can affect extracted information from experimental data and + can be caused by variations in temperature, concentration, pH, water suppression, etc. + + This code calculates three functions for each residue. When comparing datasets from + different magnetic field, the value should be the same for each function as these are field + field independent. The J(0) function is the spectral density at the zero frequency and is + obtained using a reduced spectral density approach. The F_eta and F_R2 functions are the + consistency functions proposed by Fushman D. et al. (1998) JACS, 120: 10947-10952. + """ # Initialise the data container. self.data = Data() - # Add the initial data to self.data + # Add the initial data to self.data. self.data.gx = gx self.data.gh = gh self.data.mu0 = mu0 @@ -96,18 +107,27 @@ jwx = 1.0 / (3.0*d + c) * (r1 - 1.4*sigma_noe) # Calculate P_2. + # p_2 is a second rank Legendre polynomial as p_2(x) = 0.5 * (3 * (x ** 2) -1) + # where x is the cosine of the angle Theta when expressed in radians. p_2 = 0.5 * ((3.0 * (cos(orientation * pi / 180)) ** 2) -1) # Calculate eta. + # eta is the cross-correlation rate between 15N CSA and 15N-1H dipolar interaction. It is + # expressed here as proposed in Fushman D. & Cowburn D. (1998) JACS, 120: 7109-7110. eta = ((d * c) ** 0.5) * (4.0 * j0 + 3.0 * jwx) * p_2 # Calculate F_eta. + # F_eta is independent of the magnetic field for residues with local mobility f_eta = eta * self.data.gh / (self.data.frq_list[0, 3] * (4.0 + 3.0 / (1 + (self.data.frq_list[0, 1] * tc) ** 2))) # Calculate P_HF. + # P_HF is the contribution to R2 from high frequency motions. + # P_HF = 0.5 * d * [J(wH-wN) + 6 * J(wH) + 6 * J(wH+wN)]. + # Here, P_HF is described using a reduced spectral density approach. p_hf = 1.3 * (self.data.gx / self.data.gh) * (1.0 - noe) * r1 # Calculate F_R2. + # F_R2 tests the consistency of the transverse relaxation data. f_r2 = (r2 - p_hf) / ((4.0 + 3.0 / (1 + (self.data.frq_list[0, 1] * tc) ** 2)) * (d + c/3.0)) # Return the three values. Modified: branches/consistency_tests_1.2/prompt/consistency_tests.py URL: http://svn.gna.org/viewcvs/relax/branches/consistency_tests_1.2/prompt/consistency_tests.py?rev=3341&r1=3340&r2=3341&view=diff ============================================================================== --- branches/consistency_tests_1.2/prompt/consistency_tests.py (original) +++ branches/consistency_tests_1.2/prompt/consistency_tests.py Sun Jul 15 16:12:00 2007 @@ -1,7 +1,7 @@ ############################################################################### # # # Copyright (C) 2004-2005 Edward d'Auvergne # -# Copyright (C) 2007 Sebastien Morin <sebastien.morin.1 at ulaval.ca> +# Copyright (C) 2007 Sebastien Morin <sebastien.morin.1 at ulaval.ca> # # # # This file is part of the program relax. # # # @@ -49,6 +49,7 @@ frq: The spectrometer frequency in Hz. + Description ~~~~~~~~~~~ Modified: branches/consistency_tests_1.2/sample_scripts/consistency_tests.py URL: http://svn.gna.org/viewcvs/relax/branches/consistency_tests_1.2/sample_scripts/consistency_tests.py?rev=3341&r1=3340&r2=3341&view=diff ============================================================================== --- branches/consistency_tests_1.2/sample_scripts/consistency_tests.py (original) +++ branches/consistency_tests_1.2/sample_scripts/consistency_tests.py Sun Jul 15 16:12:00 2007 @@ -25,7 +25,7 @@ # Set the approximate correlation time. value.set(name, 13 * 1e-9, 'tc') -# Select the frequency. +# Set the frequency. consistency_tests.set_frq(name, frq=600.0 * 1e6) # Consistency tests. Modified: branches/consistency_tests_1.2/specific_fns/consistency_tests.py URL: http://svn.gna.org/viewcvs/relax/branches/consistency_tests_1.2/specific_fns/consistency_tests.py?rev=3341&r1=3340&r2=3341&view=diff ============================================================================== --- branches/consistency_tests_1.2/specific_fns/consistency_tests.py (original) +++ branches/consistency_tests_1.2/specific_fns/consistency_tests.py Sun Jul 15 16:12:00 2007 @@ -96,7 +96,7 @@ if frq_index == None: continue - # Set the r1, r2, and NOE to None. + # Set the R1, R2, and NOE to None. r1 = None r2 = None noe = None @@ -149,7 +149,7 @@ data.f_eta_sim = [] data.f_r2_sim = [] - # Reduced spectral density values. + # Consistency tests values. data.j0_sim.append(j0) data.f_eta_sim.append(f_eta) data.f_r2_sim.append(f_r2) @@ -189,11 +189,11 @@ tc: Correlation time. - j0: Spectral density value at 0 MHz. - - f_eta: Eta test. - - f_r2: R2 test. + j0: Spectral density value at the zero frequency. + + f_eta: Eta-test (from Fushman D. et al. (1998) JACS, 120: 10947-10952). + + f_r2: R2-test (from Fushman D. et al. (1998) JACS, 120: 10947-10952). """ # Initialise. @@ -215,8 +215,8 @@ def default_value(self, param): """ - Reduced spectral density mapping default values - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Consistency testing default values + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________________________________________________ | | | | @@ -287,7 +287,7 @@ def return_conversion_factor(self, stat_type): - """Dummy function for returning 1.0.""" + """Dummy function for returning 1.0. This function is essential when writing grace files""" return 1.0 Modified: branches/consistency_tests_1.2/test_suite/consistency_tests.py URL: http://svn.gna.org/viewcvs/relax/branches/consistency_tests_1.2/test_suite/consistency_tests.py?rev=3341&r1=3340&r2=3341&view=diff ============================================================================== --- branches/consistency_tests_1.2/test_suite/consistency_tests.py (original) +++ branches/consistency_tests_1.2/test_suite/consistency_tests.py Sun Jul 15 16:12:00 2007 @@ -39,7 +39,7 @@ # The test. self.test = self.set_value - # Spectral density calculation test. + # Consistency tests calculation test. if test_name == 'calc': # The name of the test. @@ -58,7 +58,7 @@ # Setup. self.calc_setup() - # Try the reduced spectral density mapping. + # Try the consistency testing. self.relax.interpreter._Minimisation.calc(self.run) # Success. @@ -66,6 +66,7 @@ def calc_integrity(self): + """The consistency tests calculation sub-routine.""" # Correct consistency functions values: j0 = [4.0958793960056238e-09, 3.7976266046729745e-09] @@ -103,6 +104,7 @@ def calc_setup(self): """Setup for the calculation test.""" + # Locate and describe the data. dir = sys.path[-1] + '/test_suite/data/jw_mapping/' dataPaths = [dir + 'noe.dat', @@ -136,7 +138,7 @@ # Set the approximate correlation time. self.relax.interpreter._Value.set(self.run, 13 * 1e-9, 'tc') - # Select the frequency. + # Set the frequency. self.relax.interpreter._Consistency_tests.set_frq(self.run, frq=600.0 * 1e6)