We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e962538 commit ade7357Copy full SHA for ade7357
1 file changed
yt/funcs.py
@@ -85,16 +85,9 @@ def ensure_numpy_array(obj):
85
"""
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
+ Always return a copy of the input data.
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.array(obj))
98
99
100
def read_struct(f, fmt):
0 commit comments