Commit fde07d4a authored by Pierre Paleo's avatar Pierre Paleo

Fix loading only one value giving a scalar with np.loadtxt

parent 0f729002
Pipeline #37569 passed with stages
in 4 minutes and 57 seconds
......@@ -31,7 +31,7 @@ def get_values_from_file(fname, n_values=None, shape=None, sep=None, any_size=Fa
if not(any_size) and not((n_values is not None) ^ (shape is not None)):
raise ValueError("Please provide either n_values or shape")
arr = np.loadtxt(fname)
arr = np.loadtxt(fname, ndmin=1)
if (n_values is not None) and (arr.shape[0] != n_values):
raise ValueError("Expected %d values, but could get %d values" % (n_values, arr.shape[0]))
if (shape is not None) and (arr.shape != shape):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment