🐛 Describe the bug
The code np.array(data) in method _get_variable in file binout.py leads to a ValueError if tuples in data have different lengths and numpy version >= 2.0, e.g.
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (26,) + inhomogeneous part.
This problem was already raised in issue #62, but now the dependency is numpy>2.2.
🔢 To Reproduce
Read e.g. stresses or strains from binout of model with eroded elements with numpy version >= 2.0
🖥️ Setup
- lasso-python version: development
- numpy version: 2.3.4
Possible Solutions
Would the numpy 1.x behavior be replicated if one used np.array(data, dtype=object) if the tuples have different lengths (either by explicitly checking or using a try except block)?
Another possibility would be to fill the missing values with e.g. np.nans but one would probably need to check the element IDs to fill in the correct columns.
In issue #62 there is a reply containing some code showing how the issue could be handled. If I understand it correctly, it just pads the missing values with zeros but does not take into account which elements were deleted.