mailr2550 - in /branches/nan_catch_test: float.py relax specific_fns/model_free.py


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

Header


Content

Posted by edward on September 03, 2006 - 08:06:
Author: bugman
Date: Sun Sep  3 08:06:12 2006
New Revision: 2550

URL: http://svn.gna.org/viewcvs/relax?rev=2550&view=rev
Log:
Added a skeleton for the isnan() and isinf() functions.  Two dummy functions 
have been created and
the code in 'specific_fns/model_free.py' now points to these.


Added:
    branches/nan_catch_test/float.py
Modified:
    branches/nan_catch_test/relax
    branches/nan_catch_test/specific_fns/model_free.py

Added: branches/nan_catch_test/float.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/float.py?rev=2550&view=auto
==============================================================================
--- branches/nan_catch_test/float.py (added)
+++ branches/nan_catch_test/float.py Sun Sep  3 08:06:12 2006
@@ -1,0 +1,38 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2006 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax.                                    
 #
+#                                                                            
 #
+# relax is free software; you can redistribute it and/or modify              
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation; either version 2 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# relax is distributed in the hope that it will be useful,                   
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with relax; if not, write to the Free Software                       
 #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
+#                                                                            
 #
+###############################################################################
+
+
+class Float:
+    def __init__(self):
+        """Class of floating point number operations."""
+
+
+    def isinf(self, num):
+        """Function for identifying infinite floating point numbers by bit 
pattern."""
+
+        raise RelaxError, "not implemented yet."
+
+
+    def isnan(self, num):
+        """Function for identifying NaN floating point numbers by bit 
pattern."""
+
+        raise RelaxError, "not implemented yet."

Modified: branches/nan_catch_test/relax
URL: 
http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/relax?rev=2550&r1=2549&r2=2550&view=diff
==============================================================================
--- branches/nan_catch_test/relax (original)
+++ branches/nan_catch_test/relax Sun Sep  3 08:06:12 2006
@@ -67,6 +67,7 @@
 from colour import Colour
 from data import Data
 from errors import RelaxErrors
+from float import Float
 from io import IO
 from generic_fns.main import Generic
 from prompt.gpl import gpl
@@ -110,6 +111,9 @@
         # File operation functions.
         self.IO = IO(self)
 
+        # Floating point number functions.
+        self.float = Float()
+
         # Colour operations.
         self.colour = Colour()
 

Modified: branches/nan_catch_test/specific_fns/model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/nan_catch_test/specific_fns/model_free.py?rev=2550&r1=2549&r2=2550&view=diff
==============================================================================
--- branches/nan_catch_test/specific_fns/model_free.py (original)
+++ branches/nan_catch_test/specific_fns/model_free.py Sun Sep  3 08:06:12 
2006
@@ -2375,11 +2375,11 @@
             self.h_count = self.h_count + hc
 
             # Catch infinite chi-squared values.
-            if self.func == float('inf'):
+            if self.relax.float.isinf(self.func):
                 raise RelaxInfError, 'chi-squared'
 
             # Catch chi-squared values of NaN.
-            if isnan(self.func):
+            if self.relax.float.isnan(self.func):
                 raise RelaxNaNError, 'chi-squared'
 
             # Scaling.




Related Messages


Powered by MHonArc, Updated Sun Sep 03 09:00:08 2006