mailr8023 - /branches/spectral_errors/generic_fns/grace.py


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

Header


Content

Posted by edward on November 25, 2008 - 15:17:
Author: bugman
Date: Tue Nov 25 15:17:22 2008
New Revision: 8023

URL: http://svn.gna.org/viewcvs/relax?rev=8023&view=rev
Log:
Added a catch for missing data in the grace.write() user function back end.

A RelaxWarning is now thrown saying that an empty file will be created.


Modified:
    branches/spectral_errors/generic_fns/grace.py

Modified: branches/spectral_errors/generic_fns/grace.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spectral_errors/generic_fns/grace.py?rev=8023&r1=8022&r2=8023&view=diff
==============================================================================
--- branches/spectral_errors/generic_fns/grace.py (original)
+++ branches/spectral_errors/generic_fns/grace.py Tue Nov 25 15:17:22 2008
@@ -27,6 +27,7 @@
 from numpy import array
 from os import system
 from re import match
+from warnings import warn
 
 # relax module imports.
 import generic_fns
@@ -34,6 +35,7 @@
 from generic_fns import pipes
 from relax_errors import RelaxError, RelaxNoSequenceError, RelaxNoSimError, 
RelaxRegExpError
 from relax_io import get_file_path, open_write_file, test_binary
+from relax_warnings import RelaxWarning
 from specific_fns.setup import get_specific_fn
 
 
@@ -306,6 +308,12 @@
 
     # Get the data.
     data = get_data(spin_id, x_data_type=x_data_type, 
y_data_type=y_data_type, plot_data=plot_data)
+
+    # No data, so close the empty file and exit.
+    if data == None or data == []:
+        warn(RelaxWarning("No data can be found, creating an empty file."))
+        file.close()
+        return
 
     # Determine the graph type (ie xy, xydy, xydx, or xydxdy).
     graph_type = determine_graph_type(data, x_data_type=x_data_type, 
plot_data=plot_data)




Related Messages


Powered by MHonArc, Updated Tue Nov 25 15:20:03 2008