Closed jdpatt closed 2 years ago
Note another developer found from the numpy docs that it fills differently which may make this a non-starter for chaco like it did our application.
If the new array is larger than the original array, then the new array is filled with repeated copies of a. Note that this behavior is different from a.resize(new_shape) which fills with zeros instead of repeated copies of a.
https://numpy.org/doc/stable/reference/generated/numpy.resize.html
Thanks for raising this.
Yes, repeating the array won't work here. I think that the way this is being used to flow a list of components into a grid:
If the initial array repeated then there wouldn't be any empty cells.
The solution is probably not to be quite so clever:
When working on an application that uses traitsui/chaco, I'm unable to use a visual debugger such as vscode or pycharm. Instead, chaco raises the following exception.
Following numpy's suggestion of changing to
np.resize(grid, self.shape)
was enough to start using a debugger with this application. Looking at the codebase for\.resize\(.+\)
this was the only instance of using resize from the numpy library.