Author: varioustoxins Date: Thu Oct 12 16:19:00 2006 New Revision: 2636 URL: http://svn.gna.org/viewcvs/relax?rev=2636&view=rev Log: changes to correct unicode errors from float.py and include nan and inf checks in model free calculations bug #6503 Uncaught nan in xh_vect from bugman task #3621 overview: NaN catching function. Modified: 1.2/float.py 1.2/relax 1.2/specific_fns/model_free.py Modified: 1.2/float.py URL: http://svn.gna.org/viewcvs/relax/1.2/float.py?rev=2636&r1=2635&r2=2636&view=diff ============================================================================== --- 1.2/float.py (original) +++ 1.2/float.py Thu Oct 12 16:19:00 2006 @@ -30,9 +30,9 @@ ieee-74 uses special bit patterns to represent the following states or classes of ieee floating point numbers (ieee-class) - nan - not a number (e.g. 0.0/0.0) - âinf - positive or negative infinity (1.0/0.0) - âzero - zero maybe positive or negative under ieee-754 + +-nan - not a number (e.g. 0.0/0.0) + inf - positive or negative infinity (1.0/0.0) + +-zero - zero maybe positive or negative under ieee-754 this module provides functions for working with python floats and their special values, if they contain ieee-754 formatted values. Specifically @@ -48,7 +48,7 @@ neg-zero,...) - check that the current python float implmentations uses ieee-754 doubles - It also provides constants containg specific bit patterns for nan and âinf as + It also provides constants containg specific bit patterns for nan and +-inf as these values cannot be generated from strings via the constructor float(x) with some compiler implementations (typically older microsoft windows compilers) @@ -518,7 +518,7 @@ return manNan def isInf(obj): - ''' check to see if a python float is an infinity (âinf) + ''' check to see if a python float is an infinity the check returns true for either positive or negative infinities Modified: 1.2/relax URL: http://svn.gna.org/viewcvs/relax/1.2/relax?rev=2636&r1=2635&r2=2636&view=diff ============================================================================== --- 1.2/relax (original) +++ 1.2/relax Thu Oct 12 16:19:00 2006 @@ -69,7 +69,6 @@ from colour import Colour from data import Data from errors import RelaxErrors, RelaxWarnings -from float import Float from io import IO from generic_fns.main import Generic from prompt.gpl import gpl @@ -121,9 +120,6 @@ # File operation functions. self.IO = IO(self) - - # Floating point number functions. - self.float = Float() # Colour operations. self.colour = Colour() Modified: 1.2/specific_fns/model_free.py URL: http://svn.gna.org/viewcvs/relax/1.2/specific_fns/model_free.py?rev=2636&r1=2635&r2=2636&view=diff ============================================================================== --- 1.2/specific_fns/model_free.py (original) +++ 1.2/specific_fns/model_free.py Thu Oct 12 16:19:00 2006 @@ -31,6 +31,7 @@ from base_class import Common_functions from maths_fns.mf import Mf from minimise.generic import generic_minimise +from float import isNaN,isInf class Model_free(Common_functions): @@ -2376,12 +2377,12 @@ self.h_count = self.h_count + hc # Catch infinite chi-squared values. - #if self.relax.float.isinf(self.func): - # raise RelaxInfError, 'chi-squared' + if isInf(self.func): + raise RelaxInfError, 'chi-squared' # Catch chi-squared values of NaN. - #if self.relax.float.isnan(self.func): - # raise RelaxNaNError, 'chi-squared' + if isNaN(self.func): + raise RelaxNaNError, 'chi-squared' # Scaling. if scaling: