Open PascalLesage opened 5 years ago
Passing indices with faulty keys results in a ValueError: setting an array element with a sequence..
ValueError: setting an array element with a sequence.
_, _ = presamples.create_presamples_package(matrix_data=[(samples, bad_indices, 'technosphere')])
Yields:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-82-5166baacb765> in <module>() 1 _, _ = presamples.create_presamples_package( presamples.create_presamples_package(matrix_data=[(samples, bad_indices, 'technosphere')]) C:\mypy\anaconda\envs\bw\lib\site-packages\presamples\packaging.py in create_presamples_package(matrix_data, parameter_data, name, id_, overwrite, dirpath, seed) 295 "{} and {}".format(samples.shape[1], num_iterations)) 296 --> 297 indices, metadata = format_matrix_data(indices, kind, *other) 298 299 if samples.shape[0] != indices.shape[0]: C:\mypy\anaconda\envs\bw\lib\site-packages\presamples\packaging.py in format_matrix_data(indices, kind, dtype, row_formatter, metadata) 203 if dtype is None and row_formatter is None and metadata is None: 204 try: --> 205 return FORMATTERS[kind](indices) 206 except KeyError: 207 raise KeyError("Can't find formatter for {}".format(kind)) C:\mypy\anaconda\envs\bw\lib\site-packages\presamples\packaging.py in format_technosphere_presamples(indices) 101 TYPE_DICTIONARY.get(row[2], row[2]) 102 ) --> 103 return format_matrix_data(indices, 'technosphere', dtype, func, metadata) 104 105 C:\mypy\anaconda\envs\bw\lib\site-packages\presamples\packaging.py in format_matrix_data(indices, kind, dtype, row_formatter, metadata) 213 array = np.zeros(len(indices), dtype=dtype) 214 for index, row in enumerate(indices): --> 215 array[index] = row_formatter(row) 216 217 return array, metadata ValueError: setting an array element with a sequence.
Include an exception in the validator with a better error message.
Passing indices with faulty keys results in a
ValueError: setting an array element with a sequence.
.Yields:
Include an exception in the validator with a better error message.