mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-16 11:21:38 +08:00
Documentation, type(x) == np.ndarray --> isinstance(x,np.ndarray), and Model (untested.)
This commit is contained in:
@@ -140,14 +140,14 @@ def isScalar(f):
|
||||
scalarTypes = [float, int, long, np.float_, np.int_]
|
||||
if type(f) in scalarTypes:
|
||||
return True
|
||||
elif type(f) == np.ndarray and f.size == 1 and type(f[0]) in scalarTypes:
|
||||
elif isinstance(f, np.ndarray) and f.size == 1 and type(f[0]) in scalarTypes:
|
||||
return True
|
||||
return False
|
||||
|
||||
def asArray_N_x_Dim(pts, dim):
|
||||
if type(pts) == list:
|
||||
pts = np.array(pts)
|
||||
assert type(pts) == np.ndarray, "pts must be a numpy array"
|
||||
assert isinstance(pts, np.ndarray), "pts must be a numpy array"
|
||||
|
||||
if dim > 1:
|
||||
pts = np.atleast_2d(pts)
|
||||
|
||||
Reference in New Issue
Block a user