From 1c8f4dafddcbaac124fabee4aa2e8ed1d67f81c4 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 19 Nov 2012 07:35:48 -0500 Subject: [PATCH] Convert "NaN" -> "nan" to catch up with Numpy 1.6 This changed with Numpy commit: commit 1985497ddd1c179d5ae4b7ba061a8b8c5540f543 Author: Pauli Virtanen Date: Sun Jul 18 17:17:58 2010 +0000 BUG: core: format 'nan' and 'inf' also in array repr by default (#1050) --- hooke/util/si.py | 2 +- test/polymer_fit.py | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hooke/util/si.py b/hooke/util/si.py index 9d6e910..67366c1 100644 --- a/hooke/util/si.py +++ b/hooke/util/si.py @@ -109,7 +109,7 @@ def ppSI(value, unit='', decimals=None, power=None, pad=False): if value == 0: return '0' if value == None or isnan(value): - return 'NaN' + return 'nan' if power == None: # auto-detect power power = get_power(value) diff --git a/test/polymer_fit.py b/test/polymer_fit.py index 39d7839..67128c7 100644 --- a/test/polymer_fit.py +++ b/test/polymer_fit.py @@ -77,22 +77,22 @@ Check the results. 'polymer peak 0 (N)', 'polymer peak 1 (N)', 'polymer peak 2 (N)', 'polymer peak 3 (N)', 'polymer peak 4 (N)', 'polymer peak 5 (N)'] >>> retract[:5,-2:] -Data([[ NaN, NaN], - [ NaN, NaN], - [ NaN, NaN], - [ NaN, NaN], - [ NaN, NaN]]) +Data([[ nan, nan], + [ nan, nan], + [ nan, nan], + [ nan, nan], + [ nan, nan]]) >>> retract[1097:1103,-2:] # doctest: +ELLIPSIS -Data([[ NaN, 5.2...e-10], - [ NaN, 5...e-10], - [ NaN, 6.1...e-10], - [ NaN, 6.2...e-10], - [ NaN, 7...e-10], - [ NaN, NaN]]) +Data([[ nan, 5.2...e-10], + [ nan, 5...e-10], + [ nan, 6.1...e-10], + [ nan, 6.2...e-10], + [ nan, 7...e-10], + [ nan, nan]]) >>> retract[-5:,-2:] -Data([[ NaN, NaN], - [ NaN, NaN], - [ NaN, NaN], - [ NaN, NaN], - [ NaN, NaN]]) +Data([[ nan, nan], + [ nan, nan], + [ nan, nan], + [ nan, nan], + [ nan, nan]]) """ -- 2.26.2