We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e962538 commit b307d6bCopy full SHA for b307d6b
yt/funcs.py
@@ -86,15 +86,7 @@ def ensure_numpy_array(obj):
86
This function ensures that *obj* is a numpy array. Typically used to
87
convert scalar, list or tuple argument passed to functions using Cython.
88
"""
89
- if isinstance(obj, np.ndarray):
90
- if obj.shape == ():
91
- return np.array([obj])
92
- # We cast to ndarray to catch ndarray subclasses
93
- return np.array(obj)
94
- elif isinstance(obj, (list, tuple)):
95
- return np.asarray(obj)
96
- else:
97
- return np.asarray([obj])
+ return np.atleast_1d(np.asarray(obj, copy=True))
98
99
100
def read_struct(f, fmt):
0 commit comments