Author: bugman Date: Mon Jan 10 15:07:29 2011 New Revision: 12175 URL: http://svn.gna.org/viewcvs/relax?rev=12175&view=rev Log: Implemented a system test to catch a bug in the use of volumes for relaxation curve-fitting. This bug was identified by Maddy Strickland <M.Strickland att bristol dott ac dot uk> in the post Message-id: <55870.137.222.43.71.1294412799.squirrel@xxxxxxxxxxxxxxxxxx> https://mail.gna.org/public/relax-users/2011-01/msg00007.html. Modified: 1.3/test_suite/system_tests/relax_fit.py 1.3/test_suite/system_tests/scripts/relax_fit.py Modified: 1.3/test_suite/system_tests/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/relax_fit.py?rev=12175&r1=12174&r2=12175&view=diff ============================================================================== --- 1.3/test_suite/system_tests/relax_fit.py (original) +++ 1.3/test_suite/system_tests/relax_fit.py Mon Jan 10 15:07:29 2011 @@ -59,37 +59,8 @@ ds.__reset__() - def test_bug_12670_12679(self): - """Test the relaxation curve fitting, replicating bug #12670 and bug #12679.""" - - # Execute the script. - self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'1UBQ_relax_fit.py') - - # Open the intensities.agr file. - file = open(ds.tmpdir + sep + 'intensities.agr') - lines = file.readlines() - file.close() - - # Loop over all lines. - for i in xrange(len(lines)): - # Find the "@target G0.S0" line. - if search('@target', lines[i]): - index = i + 2 - - # Split up the lines. - lines[i] = split(lines[i]) - - # Check some of the Grace data. - self.assertEqual(len(lines[index]), 2) - self.assertEqual(lines[index][0], '0.004') - self.assertEqual(lines[index][1], '487178.0') - - - def test_curve_fitting(self): - """Test the relaxation curve fitting C modules.""" - - # Execute the script. - self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_fit.py') + def check_curve_fitting(self): + """Check the results of the curve-fitting.""" # Data. relax_times = [0.0176, 0.0176, 0.0352, 0.0704, 0.0704, 0.1056, 0.1584, 0.1584, 0.1936, 0.1936] @@ -123,6 +94,58 @@ i = i + 1 if i >= 12: break + + + def test_bug_12670_12679(self): + """Test the relaxation curve fitting, replicating bug #12670 and bug #12679.""" + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'1UBQ_relax_fit.py') + + # Open the intensities.agr file. + file = open(ds.tmpdir + sep + 'intensities.agr') + lines = file.readlines() + file.close() + + # Loop over all lines. + for i in xrange(len(lines)): + # Find the "@target G0.S0" line. + if search('@target', lines[i]): + index = i + 2 + + # Split up the lines. + lines[i] = split(lines[i]) + + # Check some of the Grace data. + self.assertEqual(len(lines[index]), 2) + self.assertEqual(lines[index][0], '0.004') + self.assertEqual(lines[index][1], '487178.0') + + + def test_curve_fitting_height(self): + """Test the relaxation curve fitting C modules.""" + + # The intensity type. + ds.int_type = 'height' + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_fit.py') + + # Check the curve-fitting results. + self.check_curve_fitting() + + + def test_curve_fitting_volume(self): + """Test the relaxation curve fitting C modules.""" + + # The intensity type. + ds.int_type = 'volume' + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_fit.py') + + # Check the curve-fitting results. + self.check_curve_fitting() def test_read_sparky(self): Modified: 1.3/test_suite/system_tests/scripts/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/relax_fit.py?rev=12175&r1=12174&r2=12175&view=diff ============================================================================== --- 1.3/test_suite/system_tests/scripts/relax_fit.py (original) +++ 1.3/test_suite/system_tests/scripts/relax_fit.py Mon Jan 10 15:07:29 2011 @@ -5,7 +5,13 @@ import sys # relax module imports. +from data import Relax_data_store; ds = Relax_data_store() from status import Status; status = Status() + + +# Missing intensity type (allow this script to run outside of the system test framework). +if not hasattr(ds, 'int_type'): + ds.int_type = 'height' # Create the data pipe. @@ -51,7 +57,7 @@ # Loop over the spectra. for i in xrange(len(names)): # Load the peak intensities. - spectrum.read_intensities(file=names[i]+'.list', dir=data_path, spectrum_id=names[i], int_method='height') + spectrum.read_intensities(file=names[i]+'.list', dir=data_path, spectrum_id=names[i], int_method=ds.int_type) # Set the relaxation times. relax_fit.relax_time(time=times[i], spectrum_id=names[i])