[Scipy-svn] r2431 - trunk/Lib/sandbox/models
scipy-svn at scipy.org
scipy-svn at scipy.org
Sun Dec 17 19:25:25 EST 2006
Author: timl
Date: 2006-12-17 18:25:20 -0600 (Sun, 17 Dec 2006)
New Revision: 2431
Modified:
trunk/Lib/sandbox/models/formula.py
Log:
fix undefined variable bug
Modified: trunk/Lib/sandbox/models/formula.py
===================================================================
--- trunk/Lib/sandbox/models/formula.py 2006-12-15 21:33:36 UTC (rev 2430)
+++ trunk/Lib/sandbox/models/formula.py 2006-12-18 00:25:20 UTC (rev 2431)
@@ -337,7 +337,7 @@
Create (transpose) of the design matrix of the formula within
namespace. Extra arguments are passed to each term instance. If
the formula just contains an intercept, then the keyword
- argument 'n' indicates the number of rows (observations).
+ argument 'nrow' indicates the number of rows (observations).
"""
if 'namespace' in kw:
@@ -375,6 +375,7 @@
except:
pass
else:
+ nrow = kw.get('nrow', -1)
if allvals != []:
if interceptindex > 0:
n = allvals[0].shape[1]
@@ -382,10 +383,10 @@
n = allvals[1].shape[1]
allvals[interceptindex] = N.ones((1,n), N.float64)
allvals = N.concatenate(allvals)
- elif nrow <= 1: # FIXME: nrow is undefined here
+ elif nrow <= 1:
raise ValueError, 'with only intercept in formula, keyword \'nrow\' argument needed'
else:
- allvals = I(nrow=nrow) # ... and here
+ allvals = I(nrow=nrow)
allvals.shape = (1,) + allvals.shape
return allvals
More information about the Scipy-svn
mailing list