Changeset 4551 for anuga_core/source/anuga/utilities
- Timestamp:
- Jun 20, 2007, 6:34:00 PM (18 years ago)
- Location:
- anuga_core/source/anuga/utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/numerical_tools.py
r4341 r4551 246 246 If not, an attempt is made to convert it to a Numeric 247 247 array 248 A: Scalar. Return 0-dimensional array of length 1, containing that value 249 A: String. Array of ASCII values 248 250 typecode: Numeric type. If specified, use this in the conversion. 249 251 If not, let Numeric decide -
anuga_core/source/anuga/utilities/test_numerical_tools.py
r3849 r4551 77 77 def test_ensure_numeric(self): 78 78 from numerical_tools import ensure_numeric 79 from Numeric import ArrayType, Float, array79 from Numeric import ArrayType, Float, Int, array 80 80 81 81 A = [1,2,3,4] … … 122 122 assert A is not B #Not the same object 123 123 124 # Check scalars 125 A = 1 126 B = ensure_numeric(A, Float) 127 #print A, B[0], len(B), type(B) 128 #print B.shape 129 assert A == B 130 131 B = ensure_numeric(A, Int) 132 #print A, B 133 #print B.shape 134 assert A == B 135 136 # Error situation 137 138 B = ensure_numeric('hello', Int) 139 assert allclose(B, [104, 101, 108, 108, 111]) 124 140 125 141 def test_gradient(self):
Note: See TracChangeset
for help on using the changeset viewer.