Author: tlinnet
Date: Sat Dec 6 14:45:18 2014
New Revision: 26976
URL: http://svn.gna.org/viewcvs/relax?rev=26976&view=rev
Log:
Added systemtest Spectrum.test_grace_int, to test plotting the intensity
per residue.
This is to prepare for a grace plotting of the signaÃl to noise level per
residue.
Also added additional tests for signal to noise ratio calculation in the
systemtest Spectrum.test_signal_noise_ratio.
Modified:
trunk/test_suite/system_tests/spectrum.py
Modified: trunk/test_suite/system_tests/spectrum.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/spectrum.py?rev=26976&r1=26975&r2=26976&view=diff
==============================================================================
--- trunk/test_suite/system_tests/spectrum.py (original)
+++ trunk/test_suite/system_tests/spectrum.py Sat Dec 6 14:45:18 2014
@@ -23,6 +23,8 @@
# Python module imports.
from os import sep
+from os.path import basename, dirname
+from tempfile import mkdtemp, NamedTemporaryFile
# relax module imports.
from data_store import Relax_data_store; ds = Relax_data_store()
@@ -35,6 +37,13 @@
class Spectrum(SystemTestCase):
"""TestCase class for the functional tests for the support of
different spectrum intensity calculation or errors, signal to noise and
plotting."""
+
+ def setUp(self):
+ """Set up for all the functional tests."""
+
+ # Create a temporary directory for dumping files.
+ ds.tmpdir = mkdtemp()
+ self.tmpdir = ds.tmpdir
def setup_signal_noise_ratio(self):
"""Setup intensity data.
@@ -126,7 +135,8 @@
# Setup data.
self.setup_signal_noise_ratio()
- # Test
+ # Test the signal to noise ratio calculation.
+ self.interpreter.spectrum.sn_ratio()
# Assign counter
i = 0
@@ -138,14 +148,49 @@
for j in range(17):
# Test intensity.
data_int = ds.data[i][j+7] * ds.data[i][5]
- self.assertEqual(cur_spin.peak_intensity['Z_A%i'%j],
data_int)
+ pint = cur_spin.peak_intensity['Z_A%i'%j]
+ self.assertEqual(pint, data_int)
# Test baseplane_rmsd.
- self.assertEqual(cur_spin.baseplane_rmsd['Z_A%i'%j],
ds.rmsd[j])
+ data_rmsd = ds.rmsd[j]
+ self.assertEqual(cur_spin.baseplane_rmsd['Z_A%i'%j],
data_rmsd)
# Test the calculated peak_intensity_err.
# Since we have measured intensity height, and have not
specified replications, this is the same as rmsd.
- self.assertEqual(cur_spin.peak_intensity_err['Z_A%i'%j],
ds.rmsd[j])
+ pint_err = cur_spin.peak_intensity_err['Z_A%i'%j]
+ self.assertEqual(pint_err, ds.rmsd[j])
+
+ # Test the signal to noise ratio.
+ sn_ratio = data_int / data_rmsd
+ self.assertEqual(cur_spin.sn_ratio['Z_A%i'%j], sn_ratio)
+ self.assertEqual(cur_spin.sn_ratio['Z_A%i'%j],
pint/pint_err)
# Add to counter
- i += 1
+ i += 1
+
+
+ def test_grace_int(self):
+ """Test grace plotting function for plotting the intensities per
residue.
+ """
+
+
+ # Setup data.
+ self.setup_signal_noise_ratio()
+
+ # Deselect spin with negative intensity.
+ self.interpreter.deselect.spin(spin_id=':4@N', boolean='AND',
change_all=False)
+
+ # Test show grace. If showing, the temporary directory created,
should not be deleted.
+ show_grace = False
+ if show_grace:
+ outfile= NamedTemporaryFile(delete=False).name
+ filedir = dirname(outfile)
+ else:
+ filedir = self.tmpdir
+ outfile = 'int.agr'
+
+ self.interpreter.grace.write(x_data_type='res_num',
y_data_type='peak_intensity', file=outfile, dir=filedir, force=True)
+
+ # View the plotting.
+ if show_grace:
+ self.interpreter.grace.view(file=outfile, dir=filedir,
grace_exe='xmgrace')
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
relax-commits@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits