mailRe: r26946 - /branches/nmrglue/test_suite/system_tests/nmrglue.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on December 03, 2014 - 22:26:
Hi Troels,

I really wonder if we can use a matplotlib function like savefig() and
then check the resultant file?  Maybe it could be output as PNG and
the hashlib library used to make an md5sum hash of the resultant file,
and then the test checks the md5sum to be sure the figure was
correctly created.  This would require first looking at the PNG file
to make sure it is what you expect, and then permanently lock in the
behaviour with the hash check (updating the test and md5sum as
required).

Regards,

Edward



On 3 December 2014 at 22:00,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Wed Dec  3 22:00:46 2014
New Revision: 26946

URL: http://svn.gna.org/viewcvs/relax?rev=26946&view=rev
Log:
Split the systemtest Nmrglue.xtest_plot_contour_cpmg into a setup, test and 
plot test.

Task #7873 (https://gna.org/task/index.php?7873): Write wrapper function to 
nmrglue, to read .ft2 files and process them.
Homepage: http://www.nmrglue.com/
Link to nmrglue discussion: 
https://groups.google.com/forum/#!forum/nmrglue-discuss
The code is develop at Github: https://github.com/jjhelmus/nmrglue/
Documentation: http://nmrglue.readthedocs.org/en/latest/index.html

Modified:
    branches/nmrglue/test_suite/system_tests/nmrglue.py

Modified: branches/nmrglue/test_suite/system_tests/nmrglue.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/nmrglue/test_suite/system_tests/nmrglue.py?rev=26946&r1=26945&r2=26946&view=diff
==============================================================================
--- branches/nmrglue/test_suite/system_tests/nmrglue.py (original)
+++ branches/nmrglue/test_suite/system_tests/nmrglue.py Wed Dec  3 22:00:46 
2014
@@ -63,6 +63,21 @@
         plt.show()


+    def plot_plot_contour_cpmg(self, show=False):
+        """Tetst the plot_contour function in pipe_control.
+        This is from the 
U{tutorial<http://jjhelmus.github.io/nmrglue/current/examples/plot_2d_spectrum.html>}.
+
+        The data is from systemtest -s Relax_disp.test_repeat_cpmg
+        U{task #7826<https://gna.org/task/index.php?7826>}. Write an 
python class for the repeated analysis of dispersion data.
+        """
+
+        # Call setup function.
+        self.setup_plot_contour_cpmg(show=False)
+
+        # Now show
+        plt.show()
+
+
     def setUp(self):
         """Set up for all the functional tests."""

@@ -87,6 +102,33 @@

         # Call the pipe_control function and get the return axis.
         ds.ax = plot_contour(spectrum_id=sp_id, ppm=True, show=show)
+
+
+    def setup_plot_contour_cpmg(self, show=False):
+        """Setup the plot_contour function in pipe_control.
+        This is from the 
U{tutorial<http://jjhelmus.github.io/nmrglue/current/examples/plot_2d_spectrum.html>}.
+
+        The data is from systemtest -s Relax_disp.test_repeat_cpmg
+        U{task #7826<https://gna.org/task/index.php?7826>}. Write an 
python class for the repeated analysis of dispersion data.
+        """
+
+        # Define base path to files.
+        base_path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'repeated_analysis'+sep+'SOD1'
+
+        # Define folder to all ft files.
+        ft2_folder_1 = base_path +sep+ 'cpmg_disp_sod1d90a_060518' +sep+ 
'cpmg_disp_sod1d90a_060518_normal.fid' +sep+ 'ft2_data'
+        ft2_folder_2 = base_path +sep+ 'cpmg_disp_sod1d90a_060521' +sep+ 
'cpmg_disp_sod1d90a_060521_normal.fid' +sep+ 'ft2_data'
+
+        # Read the spectrum.
+        fname = '128_0_FT.ft2'
+        sp_id = file_root(fname)
+        self.interpreter.spectrum.nmrglue_read(file=fname, 
dir=ft2_folder_1, spectrum_id=sp_id)
+
+        # Call the pipe_control function and get the return axis.
+        ds.ax = plot_contour(spectrum_id=sp_id, contour_start=200000., 
contour_num=20, contour_factor=1.20, ppm=True, show=show)
+
+        # Set a new title.
+        ds.ax.set_title("CPMG Spectrum")


     def test_nmrglue_read(self):
@@ -161,6 +203,18 @@
         self.setup_plot_contour(show=False)


+    def test_plot_contour_cpmg(self, show=False):
+        """Tetst the plot_contour function in pipe_control.
+        This is from the 
U{tutorial<http://jjhelmus.github.io/nmrglue/current/examples/plot_2d_spectrum.html>}.
+
+        The data is from systemtest -s Relax_disp.test_repeat_cpmg
+        U{task #7826<https://gna.org/task/index.php?7826>}. Write an 
python class for the repeated analysis of dispersion data.
+        """
+
+        # Call setup function.
+        self.setup_plot_contour_cpmg(show=False)
+
+
     def test_version(self):
         """Test version of nmrglue."""

@@ -170,37 +224,6 @@

         # Assert the version to be 0.4.
         self.assertEqual(ng_vers, '0.4')
-
-
-    def xtest_plot_contour_cpmg(self):
-        """Test the plot_contour function in pipe_control.
-        This is from the 
U{tutorial<http://jjhelmus.github.io/nmrglue/current/examples/plot_2d_spectrum.html>}.
-
-        The data is from systemtest -s Relax_disp.test_repeat_cpmg
-        U{task #7826<https://gna.org/task/index.php?7826>}. Write an 
python class for the repeated analysis of dispersion data.
-        """
-
-        # Define base path to files.
-        base_path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'repeated_analysis'+sep+'SOD1'
-
-        # Define folder to all ft files.
-        ft2_folder_1 = base_path +sep+ 'cpmg_disp_sod1d90a_060518' +sep+ 
'cpmg_disp_sod1d90a_060518_normal.fid' +sep+ 'ft2_data'
-        ft2_folder_2 = base_path +sep+ 'cpmg_disp_sod1d90a_060521' +sep+ 
'cpmg_disp_sod1d90a_060521_normal.fid' +sep+ 'ft2_data'
-
-        # Read the spectrum.
-        fname = '128_0_FT.ft2'
-        sp_id = file_root(fname)
-        self.interpreter.spectrum.nmrglue_read(file=fname, 
dir=ft2_folder_1, spectrum_id=sp_id)
-
-        # Call the pipe_control function and get the return axis.
-        ax = plot_contour(spectrum_id=sp_id, contour_start=200000., 
contour_num=20, contour_factor=1.20, ppm=True, show=False)
-
-        # Set a new title.
-        ax.set_title("CPMG Spectrum")
-
-        # Now show
-        import matplotlib.pyplot as plt
-        plt.show()


     def xtest_plot_hist_cpmg(self):


_______________________________________________
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



Related Messages


Powered by MHonArc, Updated Thu Dec 04 09:40:08 2014