Author: tlinnet Date: Wed Dec 3 23:28:59 2014 New Revision: 26954 URL: http://svn.gna.org/viewcvs/relax?rev=26954&view=rev Log: Added systemtest Nmrglue.test_save_state, which fails. This is to test saving a state after reading nmrglue data, and then reset and restore the state. This failure shows, that data cannot be saved as Class instances. 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=26954&r1=26953&r2=26954&view=diff ============================================================================== --- branches/nmrglue/test_suite/system_tests/nmrglue.py (original) +++ branches/nmrglue/test_suite/system_tests/nmrglue.py Wed Dec 3 23:28:59 2014 @@ -345,6 +345,42 @@ self.setup_plot_hist_cpmg_several(show=False) + def test_save_state(self): + """Test saving a state with numpy arrays, reset relax, and read the state again.""" + + # Read the spectrum. + fname = 'freq_real.ft2' + sp_id = 'test' + self.interpreter.spectrum.nmrglue_read(file=fname, dir=ds.ng_test, spectrum_id=sp_id) + + # Test that the spectrum id has been stored. + self.assertEqual(cdp.spectrum_ids[0], sp_id) + + # Extract the data. + dic = cdp.ngdata[sp_id].dic + udic = cdp.ngdata[sp_id].udic + data = cdp.ngdata[sp_id].data + + # Store the directory path, before reset of the controller. + dirpath = ds.tmpdir + + cdp.hello = "HELLO WORLD" + print(cdp) + print(type(cdp.ngdata)) + print(type(cdp.ngdata[sp_id])) + + # Save the results. + self.interpreter.state.save('state', dir=dirpath, compress_type=1, force=True) + + # Reset of the controller. + self.interpreter.reset() + + # Load the state again. + self.interpreter.state.load(dirpath+sep+'state') + + print(cdp.hello) + + def test_version(self): """Test version of nmrglue."""