Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions yt/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,7 @@ def ensure_numpy_array(obj):
This function ensures that *obj* is a numpy array. Typically used to
convert scalar, list or tuple argument passed to functions using Cython.
"""
if isinstance(obj, np.ndarray):
if obj.shape == ():
return np.array([obj])
# We cast to ndarray to catch ndarray subclasses
return np.array(obj)
elif isinstance(obj, (list, tuple)):
return np.asarray(obj)
else:
return np.asarray([obj])
return np.atleast_1d(np.array(obj))


def read_struct(f, fmt):
Expand Down
Loading