trimesh
trimesh copied to clipboard
[3.5.23] test failures: TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
While updating the Fedora package, I see quite a few tests failing with this error:
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
The failed "scratch build" is here: https://koji.fedoraproject.org/koji/taskinfo?taskID=40470914 Since the build will be trashed in a few days, I've attached the complete build logs here:
trimesh-3.5.14-build-fail.txt trimesh-3.5.14-build-fail-state.txt trimesh-3.5.14-build-fail-hw.txt
It seems to be arch specific. If I force the build to run on an x86_64 builder, I only get two failed tests:
=================================== FAILURES ===================================
____________________________ ExportTest.test_layer _____________________________
self = <tests.test_svg.ExportTest testMethod=test_layer>
def test_layer(self):
from shapely.geometry import Point
# create two disjoint circles and apply layers
a = g.trimesh.load_path(Point([0, 0]).buffer(1))
a.apply_layer('ACIRCLE')
b = g.trimesh.load_path(Point([2, 0]).buffer(1))
b.apply_layer('BCIRCLE')
# combine two circles
c = a + b
# should be combined
assert g.np.isclose(c.area, a.area + b.area)
# export C with just layer of A
aX = g.trimesh.load(g.io_wrap(
c.export(file_type='svg',
layers=['ACIRCLE'])),
file_type='svg')
# export C with all layers
cX = g.trimesh.load(g.io_wrap(
c.export(file_type='svg',
layers=None)),
file_type='svg')
> assert len(cX.entities) == len(c.entities)
E AssertionError: assert 1 == 2
E -1
E +2
../tests/test_svg.py:59: AssertionError
_____________________________ ExportTest.test_svg ______________________________
self = <tests.test_svg.ExportTest testMethod=test_svg>
def test_svg(self):
for d in g.get_2D():
# export as svg string
exported = d.export(file_type='svg')
# load the exported SVG
stream = g.trimesh.util.wrap_as_stream(exported)
if g.np.isclose(d.area, 0.0):
continue
loaded = g.trimesh.load(stream, file_type='svg')
# we only have line and arc primitives as SVG
# export and import
if all(i.__class__.__name__ in ['Line', 'Arc']
for i in d.entities):
# perimeter should stay the same-ish
# on export/import
> assert g.np.isclose(d.length,
loaded.length,
rtol=.01)
E AssertionError: assert False
E + where False = <function isclose at 0x7f5cb37e0f70>(15.16883270309641, 10.88659282532712, rtol=0.01)
E + where <function isclose at 0x7f5cb37e0f70> = <module 'numpy' from '/usr/lib64/python3.8/site-packages/numpy/__init__.py'>.isclose
E + where <module 'numpy' from '/usr/lib64/python3.8/site-packages/numpy/__init__.py'> = g.np
E + and 15.16883270309641 = <trimesh.Path2D(vertices.shape=(4, 2), len(entities)=4)>.length
E + and 10.88659282532712 = <trimesh.Path2D(vertices.shape=(4, 2), len(entities)=1)>.length
../tests/test_svg.py:27: AssertionError
=============================== warnings summary ===============================
/usr/lib/python3.8/site-packages/svg/path/path.py:3
/usr/lib/python3.8/site-packages/svg/path/path.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import MutableSequence
tests/test_normals.py::NormalsTest::test_weighted_vertex_normals
/builddir/build/BUILD/trimesh-3.5.14/trimesh/triangles.py:109: RuntimeWarning: invalid value encountered in true_divide
u /= util.row_norm(u).reshape((-1, 1))
tests/test_triangles.py::TrianglesTest::test_zero_angle
/builddir/build/BUILD/trimesh-3.5.14/trimesh/triangles.py:111: RuntimeWarning: invalid value encountered in true_divide
w /= util.row_norm(w).reshape((-1, 1))
-- Docs: https://docs.pytest.org/en/latest/warnings.html
====== 2 failed, 324 passed, 12 deselected, 3 warnings in 219.35 seconds =======
The logs from this build are here: https://koji.fedoraproject.org/koji/taskinfo?taskID=40471476
trimesh-3.5.14-build-fail-2.txt trimesh-3.5.14-build-fail-hw-2.txt trimesh-3.5.14-build-fail-state-2.txt
Cheers,
Oh interesting, thanks for the report! The second log makes me deeply suspicious of the GEOS/Shapely build on different architectures and I might punt on that one as "upstream." The TypeError issue however is also taking out our windows tests, and in both cases looks localized to test_voxels.
Oh interesting, thanks for the report! The second log makes me deeply suspicious of the GEOS/Shapely build on different architectures and I might punt on that one as "upstream."
I had a quick look, and at least on Fedora, all the shapely tests pass an all architectures. I don't know how exhaustive their tests are but this would indicate that it's built properly as far as upstream are concerned? If you could help me gather more information on the shapely issue, I'd be happy to file bugs with them too.
- builds: https://koji.fedoraproject.org/koji/packageinfo?packageID=11270
- spec file: https://src.fedoraproject.org/rpms/python-shapely/blob/master/f/python-shapely.spec
The
TypeErrorissue however is also taking out our windows tests, and in both cases looks localized totest_voxels.
Ah, that's a known issue then. Great :)
Saw another build fail with a lot of these again:
_____________________ BinvoxTest.test_load_save_invariance _____________________
obj = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32)
method = 'take', args = (array([0, 2, 1], dtype=int64),)
kwds = {'axis': -1, 'mode': 'raise', 'out': None}
bound = <built-in method take of numpy.ndarray object at 0xaa829b88>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <trimesh.voxel.encoding.TransposedEncoding object at 0xaaafd358>
base_indices = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32)
def _from_base_indices(self, base_indices):
try:
> return np.take(base_indices, self._inv_perm, axis=-1)
trimesh/voxel/encoding.py:839:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2...,
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32), array([0, 2, 1], dtype=int64))
kwargs = {'axis': -1}
relevant_args = (array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2..., 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32), None)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32)
indices = array([0, 2, 1], dtype=int64), axis = -1, out = None, mode = 'raise'
@array_function_dispatch(_take_dispatcher)
def take(a, indices, axis=None, out=None, mode='raise'):
"""
Take elements from an array along an axis.
When axis is not None, this function does the same thing as "fancy"
indexing (indexing arrays using arrays); however, it can be easier to use
if you need elements along a given axis. A call such as
``np.take(arr, indices, axis=3)`` is equivalent to
``arr[:,:,:,indices,...]``.
Explained without fancy indexing, this is equivalent to the following use
of `ndindex`, which sets each of ``ii``, ``jj``, and ``kk`` to a tuple of
indices::
Ni, Nk = a.shape[:axis], a.shape[axis+1:]
Nj = indices.shape
for ii in ndindex(Ni):
for jj in ndindex(Nj):
for kk in ndindex(Nk):
out[ii + jj + kk] = a[ii + (indices[jj],) + kk]
Parameters
----------
a : array_like (Ni..., M, Nk...)
The source array.
indices : array_like (Nj...)
The indices of the values to extract.
.. versionadded:: 1.8.0
Also allow scalars for indices.
axis : int, optional
The axis over which to select values. By default, the flattened
input array is used.
out : ndarray, optional (Ni..., Nj..., Nk...)
If provided, the result will be placed in this array. It should
be of the appropriate shape and dtype. Note that `out` is always
buffered if `mode='raise'`; use other modes for better performance.
mode : {'raise', 'wrap', 'clip'}, optional
Specifies how out-of-bounds indices will behave.
* 'raise' -- raise an error (default)
* 'wrap' -- wrap around
* 'clip' -- clip to the range
'clip' mode means that all indices that are too large are replaced
by the index that addresses the last element along that axis. Note
that this disables indexing with negative numbers.
Returns
-------
out : ndarray (Ni..., Nj..., Nk...)
The returned array has the same type as `a`.
See Also
--------
compress : Take elements using a boolean mask
ndarray.take : equivalent method
take_along_axis : Take elements by matching the array and the index arrays
Notes
-----
By eliminating the inner loop in the description above, and using `s_` to
build simple slice objects, `take` can be expressed in terms of applying
fancy indexing to each 1-d slice::
Ni, Nk = a.shape[:axis], a.shape[axis+1:]
for ii in ndindex(Ni):
for kk in ndindex(Nj):
out[ii + s_[...,] + kk] = a[ii + s_[:,] + kk][indices]
For this reason, it is equivalent to (but faster than) the following use
of `apply_along_axis`::
out = np.apply_along_axis(lambda a_1d: a_1d[indices], axis, a)
Examples
--------
>>> a = [4, 3, 5, 7, 6, 8]
>>> indices = [0, 1, 4]
>>> np.take(a, indices)
array([4, 3, 6])
In this example if `a` is an ndarray, "fancy" indexing can be used.
>>> a = np.array(a)
>>> a[indices]
array([4, 3, 6])
If `indices` is not one dimensional, the output also has these dimensions.
>>> np.take(a, [[0, 1], [2, 3]])
array([[4, 3],
[5, 7]])
"""
> return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32)
method = 'take', args = (array([0, 2, 1], dtype=int64),)
kwds = {'axis': -1, 'mode': 'raise', 'out': None}
bound = <built-in method take of numpy.ndarray object at 0xaa829b88>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int32)
method = 'take', args = (array([0, 2, 1], dtype=int64),)
kwds = {'axis': -1, 'mode': 'raise', 'out': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xaa829b88>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int64)
method = 'take', args = (array([0, 2, 1], dtype=int64),)
kwds = {'axis': -1, 'mode': 'raise', 'out': None}
bound = <built-in method take of numpy.ndarray object at 0xaa829c50>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_binvox.BinvoxTest testMethod=test_load_save_invariance>
def test_load_save_invariance(self):
np = g.np
n = 4
dense = np.random.uniform(size=(n,) * 3) > 0.8
dense[0, 0, 0] = dense[-1, -1, -1] = 1 # ensure extent test works
shape = dense.shape
rl_data = rl.dense_to_rle(dense.flatten(), dtype=np.uint8)
translate = np.array([2, 5, 10], dtype=np.float32)
scale = 5.
base = binvox.voxel_from_binvox(
rl_data, shape, translate, scale, axis_order='xzy')
s = scale / (n - 1)
np.testing.assert_equal(base.transform, np.array([
[s, 0, 0, 2],
[0, s, 0, 5],
[0, 0, s, 10],
[0, 0, 0, 1]
]))
dense = dense.transpose((0, 2, 1))
> np.testing.assert_allclose(base.bounds, [translate, translate + scale])
tests/test_binvox.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/base.py:144: in bounds
points = self.points
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/base.py:281: in points
self.sparse_indices.astype(float))
trimesh/voxel/base.py:286: in sparse_indices
return self.encoding.sparse_indices
trimesh/voxel/encoding.py:690: in sparse_indices
return self._from_base_indices(self._data.sparse_indices)
trimesh/voxel/encoding.py:842: in _from_base_indices
return np.take(base_indices.astype(np.int64),
<__array_function__ internals>:5: in take
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:194: in take
return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([[0, 0, 0],
[0, 2, 3],
[0, 3, 1],
[1, 1, 0],
[1, 1, 1],
[2, 3, 1],
[2,... [2, 3, 3],
[3, 0, 3],
[3, 2, 0],
[3, 2, 2],
[3, 3, 1],
[3, 3, 3]], dtype=int64)
method = 'take', args = (array([0, 2, 1], dtype=int64),)
kwds = {'axis': -1, 'mode': 'raise', 'out': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xaa829c50>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
_________________________ EncodingTest.test_composite __________________________
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xb2d9ad80>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = TrackedArray([ 0, 4, 1, 1, 0, 2, 1, 3, 0, 6, 1, 1, 0, 3, 1,
1, 0, 3, 1, 4, 0, 24, 1... 0, 3, 1, 2, 0, 11, 1, 1, 0, 4, 1, 1, 0, 7, 1,
1, 0, 10, 1, 1, 0, 7], dtype=int64)
dtype = <class 'bool'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...1, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64))
kwargs = {}
relevant_args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...lse, True, False, True, False, True, False, True,
False, True, False, True, False, True, False]),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
repeats = TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, 1...11, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xb2d9ad80>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xb2d9ad80>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xb2d9a7d0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_encoding.EncodingTest testMethod=test_composite>
def test_composite(self):
for encoding in encodings:
> self._test_composite(encoding, dense_data)
tests/test_encoding.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_encoding.py:71: in _test_composite
check()
tests/test_encoding.py:67: in check
self._test_dense(encoding, data)
tests/test_encoding.py:31: in _test_dense
np.testing.assert_equal(encoding.dense, data)
trimesh/voxel/encoding.py:848: in dense
return self._data.dense.transpose(self._perm)
trimesh/voxel/encoding.py:785: in dense
return self._data.dense.reshape(self.shape)
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/encoding.py:517: in dense
return rl.rle_to_dense(self._data, dtype=self._dtype)
trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xb2d9a7d0>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
___________________________ EncodingTest.test_dense ____________________________
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88dda70>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = TrackedArray([ 0, 4, 1, 1, 0, 2, 1, 3, 0, 6, 1, 1, 0, 3, 1,
1, 0, 3, 1, 4, 0, 24, 1... 0, 3, 1, 2, 0, 11, 1, 1, 0, 4, 1, 1, 0, 7, 1,
1, 0, 10, 1, 1, 0, 7], dtype=int64)
dtype = <class 'bool'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...1, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64))
kwargs = {}
relevant_args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...lse, True, False, True, False, True, False, True,
False, True, False, True, False, True, False]),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
repeats = TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, 1...11, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88dda70>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa88dda70>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88ddfb0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_encoding.EncodingTest testMethod=test_dense>
def test_dense(self):
for encoding in encodings:
> self._test_dense(encoding, dense_data)
tests/test_encoding.py:94:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_encoding.py:31: in _test_dense
np.testing.assert_equal(encoding.dense, data)
trimesh/voxel/encoding.py:785: in dense
return self._data.dense.reshape(self.shape)
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/encoding.py:517: in dense
return rl.rle_to_dense(self._data, dtype=self._dtype)
trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa88ddfb0>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
____________________________ EncodingTest.test_flat ____________________________
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa7157a70>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = TrackedArray([ 0, 4, 1, 1, 0, 2, 1, 3, 0, 6, 1, 1, 0, 3, 1,
1, 0, 3, 1, 4, 0, 24, 1... 0, 3, 1, 2, 0, 11, 1, 1, 0, 4, 1, 1, 0, 7, 1,
1, 0, 10, 1, 1, 0, 7], dtype=int64)
dtype = <class 'bool'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...1, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64))
kwargs = {}
relevant_args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...lse, True, False, True, False, True, False, True,
False, True, False, True, False, True, False]),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
repeats = TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, 1...11, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa7157a70>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa7157a70>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa7157c68>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_encoding.EncodingTest testMethod=test_flat>
def test_flat(self):
for encoding in encodings:
> self._test_dense(encoding.flat, dense_data.reshape((-1,)))
tests/test_encoding.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_encoding.py:31: in _test_dense
np.testing.assert_equal(encoding.dense, data)
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/encoding.py:517: in dense
return rl.rle_to_dense(self._data, dtype=self._dtype)
trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa7157c68>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
__________________________ EncodingTest.test_flipped ___________________________
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa7157450>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = TrackedArray([ 0, 4, 1, 1, 0, 2, 1, 3, 0, 6, 1, 1, 0, 3, 1,
1, 0, 3, 1, 4, 0, 24, 1... 0, 3, 1, 2, 0, 11, 1, 1, 0, 4, 1, 1, 0, 7, 1,
1, 0, 10, 1, 1, 0, 7], dtype=int64)
dtype = <class 'bool'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...1, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64))
kwargs = {}
relevant_args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...lse, True, False, True, False, True, False, True,
False, True, False, True, False, True, False]),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
repeats = TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, 1...11, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa7157450>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa7157450>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa7157610>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_encoding.EncodingTest testMethod=test_flipped>
def test_flipped(self):
axes = (
0, 1, 2,
(0,),
(0, 1),
(0, 2),
(1, 2),
(0, 1, 2),
)
for encoding in encodings:
for ax in axes:
> self._test_flipped(encoding, dense_data, ax)
tests/test_encoding.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_encoding.py:61: in _test_flipped
self._test_dense(encoding.flip(axes), data)
tests/test_encoding.py:31: in _test_dense
np.testing.assert_equal(encoding.dense, data)
trimesh/voxel/encoding.py:910: in dense
dense = self._data.dense
trimesh/voxel/encoding.py:785: in dense
return self._data.dense.reshape(self.shape)
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/encoding.py:517: in dense
return rl.rle_to_dense(self._data, dtype=self._dtype)
trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa7157610>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
__________________________ EncodingTest.test_reshape ___________________________
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88c43e0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = TrackedArray([ 0, 4, 1, 1, 0, 2, 1, 3, 0, 6, 1, 1, 0, 3, 1,
1, 0, 3, 1, 4, 0, 24, 1... 0, 3, 1, 2, 0, 11, 1, 1, 0, 4, 1, 1, 0, 7, 1,
1, 0, 10, 1, 1, 0, 7], dtype=int64)
dtype = <class 'bool'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...1, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64))
kwargs = {}
relevant_args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...lse, True, False, True, False, True, False, True,
False, True, False, True, False, True, False]),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
repeats = TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, 1...11, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88c43e0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa88c43e0>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88c4488>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_encoding.EncodingTest testMethod=test_reshape>
def test_reshape(self):
shapes = (
(10, 10, 10),
(5, 20, 10),
(50, 4, 5),
(-1, 4, 5)
)
for encoding in encodings:
for shape in shapes:
> self._test_dense(
encoding.reshape(shape), dense_data.reshape(shape))
tests/test_encoding.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_encoding.py:31: in _test_dense
np.testing.assert_equal(encoding.dense, data)
trimesh/voxel/encoding.py:785: in dense
return self._data.dense.reshape(self.shape)
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/encoding.py:517: in dense
return rl.rle_to_dense(self._data, dtype=self._dtype)
trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa88c4488>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
_________________________ EncodingTest.test_transpose __________________________
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88c4ed0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = TrackedArray([ 0, 4, 1, 1, 0, 2, 1, 3, 0, 6, 1, 1, 0, 3, 1,
1, 0, 3, 1, 4, 0, 24, 1... 0, 3, 1, 2, 0, 11, 1, 1, 0, 4, 1, 1, 0, 7, 1,
1, 0, 10, 1, 1, 0, 7], dtype=int64)
dtype = <class 'bool'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...1, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64))
kwargs = {}
relevant_args = (TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False...lse, True, False, True, False, True, False, True,
False, True, False, True, False, True, False]),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
repeats = TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, 1...11, 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88c4ed0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([False, True, False, True, False, True, False, True,
False, True, False, True, False,...False, True, False, True, False, True, False, True,
False, True, False, True, False, True, False])
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa88c4ed0>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of TrackedArray object at 0xa88ddd48>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_encoding.EncodingTest testMethod=test_transpose>
def test_transpose(self):
perms = (
(0, 2, 1),
(0, 1, 2),
(2, 1, 0),
)
for encoding in encodings:
for perm in perms:
> self._test_transpose(encoding, dense_data, perm)
tests/test_encoding.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_encoding.py:45: in _test_transpose
self._test_dense(encoding, data)
tests/test_encoding.py:31: in _test_dense
np.testing.assert_equal(encoding.dense, data)
trimesh/voxel/encoding.py:848: in dense
return self._data.dense.transpose(self._perm)
trimesh/voxel/encoding.py:785: in dense
return self._data.dense.reshape(self.shape)
trimesh/caching.py:103: in get_cached
value = function(*args, **kwargs)
trimesh/voxel/encoding.py:517: in dense
return rl.rle_to_dense(self._data, dtype=self._dtype)
trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = TrackedArray([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ..., 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], dtype=int64)
method = 'repeat'
args = (TrackedArray([ 4, 1, 2, 3, 6, 1, 3, 1, 3, 4, 24, 1, 5, 1, 2,
1, 3, 1, 8, 1, 1, 1, ..., 1, 4, 1, 5, 1, 6, 1, 1, 1, 1, 3,
3, 2, 11, 1, 4, 1, 7, 1, 10, 1, 7], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of TrackedArray object at 0xa88ddd48>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
_______________________ RleTest.test_brle_encode_decode ________________________
obj = array([False, True, False]), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xa70b2228>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_runlength.RleTest testMethod=test_brle_encode_decode>
def test_brle_encode_decode(self):
small = np.array(
[False] * 500 + [True] * 1000 + [False], dtype=np.bool)
rand = np.random.uniform(size=(10000,)) > 0.05
for original in [small, rand]:
for dtype in [np.uint8, np.int64]:
enc = rl.dense_to_brle(original, dtype=dtype)
> dec = rl.brle_to_dense(enc)
../tests/test_runlength.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../trimesh/voxel/runlength.py:233: in brle_to_dense
return np.repeat(ft[:len(brle_data)], brle_data).flatten()
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([False, True, False]), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xa70b2228>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
___________________________ RleTest.test_brle_length ___________________________
obj = array([False, True, False, True, False, True, False, True, False,
True, False, True, False, True, False, True, False, True,
False, True])
method = 'repeat'
args = (array([236, 157, 217, 54, 116, 63, 212, 143, 119, 134, 129, 15, 86,
224, 197, 169, 113, 138, 78, 193], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xa71c7908>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_runlength.RleTest testMethod=test_brle_length>
def test_brle_length(self):
enc = random_brle_encoding(dtype=np.int64)
> dec = rl.brle_to_dense(enc)
../tests/test_runlength.py:174:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../trimesh/voxel/runlength.py:233: in brle_to_dense
return np.repeat(ft[:len(brle_data)], brle_data).flatten()
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([False, True, False, True, False, True, False, True, False,
True, False, True, False, True, False, True, False, True,
False, True])
method = 'repeat'
args = (array([236, 157, 217, 54, 116, 63, 212, 143, 119, 134, 129, 15, 86,
224, 197, 169, 113, 138, 78, 193], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xa71c7908>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
________________________ RleTest.test_brle_logical_not _________________________
obj = array([False, True, False, True, False, True, False, True, False,
True, False, True, False, True, False, True, False, True,
False, True, False, True])
method = 'repeat'
args = (array([ 0, 253, 131, 238, 208, 10, 224, 176, 30, 117, 208, 35, 133,
36, 90, 202, 170, 84, 75, 18, 185, 0], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xaaa0ea20>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_runlength.RleTest testMethod=test_brle_logical_not>
def test_brle_logical_not(self):
original = random_brle_encoding(dtype=np.int64)
notted = rl.brle_logical_not(original)
> dense_notted = rl.brle_to_dense(notted)
../tests/test_runlength.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../trimesh/voxel/runlength.py:233: in brle_to_dense
return np.repeat(ft[:len(brle_data)], brle_data).flatten()
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([False, True, False, True, False, True, False, True, False,
True, False, True, False, True, False, True, False, True,
False, True, False, True])
method = 'repeat'
args = (array([ 0, 253, 131, 238, 208, 10, 224, 176, 30, 117, 208, 35, 133,
36, 90, 202, 170, 84, 75, 18, 185, 0], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xaaa0ea20>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
__________________________ RleTest.test_brle_to_dense __________________________
obj = array([False, True, False, True]), method = 'repeat'
args = (array([ 300, 200, 1000, 0], dtype=int64),), kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xb31b6f70>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_runlength.RleTest testMethod=test_brle_to_dense>
def test_brle_to_dense(self):
np.testing.assert_equal(
> rl.brle_to_dense(np.array([300, 200, 1000, 0], dtype=np.int64)),
[False] * 300 + [True] * 200 + [False] * 1000)
../tests/test_runlength.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../trimesh/voxel/runlength.py:233: in brle_to_dense
return np.repeat(ft[:len(brle_data)], brle_data).flatten()
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([False, True, False, True]), method = 'repeat'
args = (array([ 300, 200, 1000, 0], dtype=int64),), kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xb31b6f70>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
___________________________ RleTest.test_brle_to_rle ___________________________
obj = array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64)
method = 'repeat'
args = (array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xaa923228>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = array([ 0, 125, 1, 50, 0, 146, 1, 204, 0, 142, 1, 135, 0,
146, 1, 9, 0, 48, 1, 82, 0,..., 1, 101, 0, 179,
1, 7, 0, 26, 1, 170, 0, 136, 1, 184, 0, 189, 1,
18], dtype=int64)
dtype = <class 'numpy.int64'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
../trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64), array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64))
kwargs = {}
relevant_args = (array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64)
repeats = array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64)
axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64)
method = 'repeat'
args = (array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xaa923228>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64)
method = 'repeat'
args = (array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xaa923228>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64)
method = 'repeat'
args = (array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64),)
kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xa876fb10>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_runlength.RleTest testMethod=test_brle_to_rle>
def test_brle_to_rle(self):
brle_data = random_brle_encoding()
brle_dense = rl.brle_to_dense(brle_data)
rle_data = rl.brle_to_rle(brle_data)
> rle_dense = rl.rle_to_dense(rle_data)
../tests/test_runlength.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
dtype=int64)
method = 'repeat'
args = (array([125, 50, 146, 204, 142, 135, 146, 9, 48, 82, 205, 101, 179,
7, 26, 170, 136, 184, 189, 18], dtype=int64),)
kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xa876fb10>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
________________________ RleTest.test_rle_encode_decode ________________________
obj = array([3, 5, 2], dtype=int64), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xa88e8e80>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
rle_data = array([ 3, 500, 5, 1000, 2, 1], dtype=int64)
dtype = <class 'numpy.int64'>
def rle_to_dense(rle_data, dtype=np.int64):
"""Get the dense decoding of the associated run length encoded data."""
values, counts = np.split(np.reshape(rle_data, (-1, 2)), 2, axis=-1)
if dtype is not None:
values = np.asanyarray(values, dtype=dtype)
try:
> result = np.repeat(np.squeeze(values, axis=-1),
np.squeeze(counts, axis=-1))
../trimesh/voxel/runlength.py:242:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (array([3, 5, 2], dtype=int64), array([ 500, 1000, 1], dtype=int64))
kwargs = {}, relevant_args = (array([3, 5, 2], dtype=int64),)
> ???
<__array_function__ internals>:5:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([3, 5, 2], dtype=int64)
repeats = array([ 500, 1000, 1], dtype=int64), axis = None
@array_function_dispatch(_repeat_dispatcher)
def repeat(a, repeats, axis=None):
"""
Repeat elements of an array.
Parameters
----------
a : array_like
Input array.
repeats : int or array of ints
The number of repetitions for each element. `repeats` is broadcasted
to fit the shape of the given axis.
axis : int, optional
The axis along which to repeat values. By default, use the
flattened input array, and return a flat output array.
Returns
-------
repeated_array : ndarray
Output array which has the same shape as `a`, except along
the given axis.
See Also
--------
tile : Tile an array.
Examples
--------
>>> np.repeat(3, 4)
array([3, 3, 3, 3])
>>> x = np.array([[1,2],[3,4]])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>> np.repeat(x, 3, axis=1)
array([[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4]])
>>> np.repeat(x, [1, 2], axis=0)
array([[1, 2],
[3, 4],
[3, 4]])
"""
> return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([3, 5, 2], dtype=int64), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xa88e8e80>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
return bound(*args, **kwds)
except TypeError:
# A TypeError occurs if the object does have such a method in its
# class, but its signature is not identical to that of NumPy's. This
# situation has occurred in the case of a downstream library like
# 'pandas'.
#
# Call _wrapit from within the except clause to ensure a potential
# exception has a traceback chain.
> return _wrapit(obj, method, *args, **kwds)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([3, 5, 2], dtype=int64), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xa88e8e80>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
During handling of the above exception, another exception occurred:
obj = array([3, 5, 2], dtype=int64), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
bound = <built-in method repeat of numpy.ndarray object at 0xa88e87a0>
def _wrapfunc(obj, method, *args, **kwds):
bound = getattr(obj, method, None)
if bound is None:
return _wrapit(obj, method, *args, **kwds)
try:
> return bound(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:61: TypeError
During handling of the above exception, another exception occurred:
self = <tests.test_runlength.RleTest testMethod=test_rle_encode_decode>
def test_rle_encode_decode(self):
small = np.array([3] * 500 + [5] * 1000 + [2], dtype=np.uint8)
rand = (np.random.uniform(size=(10000,)) > 0.05).astype(np.uint8)
for original in [small, rand]:
for dtype in [np.uint8, np.int64]:
enc = rl.dense_to_rle(original, dtype=dtype)
> dec = rl.rle_to_dense(enc)
../tests/test_runlength.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../trimesh/voxel/runlength.py:246: in rle_to_dense
result = np.repeat(np.squeeze(values.astype(np.int64), axis=-1),
<__array_function__ internals>:5: in repeat
???
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:482: in repeat
return _wrapfunc(a, 'repeat', repeats, axis=axis)
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:70: in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = array([3, 5, 2], dtype=int64), method = 'repeat'
args = (array([ 500, 1000, 1], dtype=int64),), kwds = {'axis': None}
wrap = <built-in method __array_wrap__ of numpy.ndarray object at 0xa88e87a0>
def _wrapit(obj, method, *args, **kwds):
try:
wrap = obj.__array_wrap__
except AttributeError:
wrap = None
> result = getattr(asarray(obj), method)(*args, **kwds)
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
/usr/lib/python3.8/site-packages/numpy/core/fromnumeric.py:47: TypeError
=============================== warnings summary ===============================
An initial look seems like builds on 32bit architectures fail. On 64 bits, the build seems fine.
I am attaching an updated log of test failures that seem to be due to 32-bit architecture issues in 3.9.20.
All of the failures are still due to:
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
The list of failing tests is:
BinvoxTest.test_load_save_invariance
BoundsTest.test_bounding_egg
EncodingTest.test_composite
EncodingTest.test_dense
EncodingTest.test_flat
EncodingTest.test_flipped
EncodingTest.test_reshape
EncodingTest.test_transpose
PrimitiveTest.test_cyl_buffer
NearestTest.test_coplanar_signed_distance
RleTest.test_brle_encode_decode
RleTest.test_brle_length
RleTest.test_brle_logical_not
RleTest.test_brle_to_dense
RleTest.test_brle_to_rle
RleTest.test_brle_encode_decode
ContainsTest.test_inside
VoxelGridTest.test_local
Updated for 3.9.34, on a machine that is actually x86_64, in an i686 chroot, with gobs of memory:
The aforementioned TypeError—the good news is there now now seem to be fewer of these:
RayTests.test_contains
RayTests.test_on_edge
RayTests.test_on_vertex
RleTest.test_rle_encode_decode
Now there are a number of tests that produce a MemoryError, or a numpy.core._exceptions._ArrayMemoryError—note that this environment has lots and lots of memory, and if a test is out of memory here it will never succeed on a 32-bit platform:
GLTFTest.test_merge_buffers
MutateTests.test_not_mutated_cube
RayTests.test_contain_single
SubDivideTest.test_subdivide
SceneTests.test_scene
Detailed log of test failures.
On Fedora’s i686 builders, which have 16GB RAM on a 64-bit hardware, the results match the above. (I think they’re running a PAE kernel.)
On the armv7hl builders, which have 4GB RAM and are real bare-metal 32-bit hardware, the situation is much worse, with the following additional tests producing MemoryError or numpy.core._exceptions._ArrayMemoryError:
ExportTest::test_svg
GLTFTest::test_basic
IdentifierTest::test_scene_id
IntegralMeanCurvatureTest::test_IMCcapsule
LoaderTest::test_fileobj
MedialTests::test_medial
MeshTests::test_meshes
MinimalTest::test_load
MutateTests::test_not_mutated_bunny
MutateTests::test_not_mutated_teapot
MutateTests::test_not_mutated_torus
NSphereTest::test_minball
NearestTest::test_helper
NearestTest::test_naive
OBJTest::test_export_path
OBJTest::test_scene
OpTest::test_add
PermutateTest::test_base
PermutateTest::test_permutate
PermutateTest::test_tesselation
PrimitiveTest::test_primitives
RasterTest::test_rasterize
RayTests::test_box
RayTests::test_multiple_hits
RayTests::test_rays
RayTests::test_rps
RenderTest::test_args
RepairTests::test_fix_normals
SampleTest::test_sample
SampleTest::test_weights
SceneTests::test_doubling
SceneTests::test_scaling
SceneTests::test_tri
SplitTest::test_split
SubDivideTest::test_sub
SubDivideTest::test_uv
TextureTest::test_fuze
TransformTest::test_tiny
TrianglesTest::test_barycentric
UnitsTest::test_conversion
UnitsTest::test_path
VectorTests::test_color
VectorTests::test_discrete
VectorTests::test_poly
VectorTests::test_text
VerticesTest::test_vertex_faces
VoxelGridTest::test_voxel
SceneTests::test_empty
There are also some additional errors (XML syntax error or scipy-related ImportError) that I haven’t looked at very closely yet, and for which the responsibility might lie elsewhere.
I was missing some TypeErrors. After skipping the ones mentioned in my previous comment, there remain the following:
BinvoxTest::test_load_save_invariance
BoundsTest::test_bounding_egg
ContainsTest::test_inside
EncodingTest::test_composite
EncodingTest::test_dense
EncodingTest::test_flat
EncodingTest::test_flipped
EncodingTest::test_reshape
EncodingTest::test_transpose
NearestTest::test_coplanar_signed_distance
PrimitiveTest::test_cyl_buffer
RleTest::test_brle_encode_decode
RleTest::test_brle_length
RleTest::test_brle_logical_not
RleTest::test_brle_to_dense
RleTest::test_brle_to_rle
VoxelGridTest::test_local
Of these, PrimitiveTest::test_cyl_buffer and ContainsTest::test_inside seem to happen on i686 but not on armv7hl.
All are still of the form
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
On the
armv7hlbuilders, which have 4GB RAM and are real bare-metal 32-bit hardware, the situation is much worse, with the following additional tests producingMemoryErrorornumpy.core._exceptions._ArrayMemoryError:
That particular list of failures went away when I tried again with 3.9.36 just now. It’s not clear if the change was in trimesh or in the 32-bit ARM builders themselves.
PrimitiveTest::test_cyl_buffer, which was previously failing only on i*86, is now failing on 32-bit ARM as well.
Support for 32-bit ARM in Fedora will end after Fedora 36. 32-bit x86 builds will stick around for multilib on x86_64, although there is no full 32-bit x86 version of the distribution anymore.
A new failure has appeared in 3.17.0, similar to the existing 32-bit failures:
_______________________ SubDivideTest.test_loop_correct ________________________
self = <tests.test_remesh.SubDivideTest testMethod=test_loop_correct>
def test_loop_correct(self):
box = g.trimesh.creation.box()
big_sphere = g.trimesh.creation.icosphere(radius=0.5)
small_sphere = g.trimesh.creation.icosphere(radius=0.4)
sub = box.subdivide_loop(iterations=2)
# smaller than 0.5 sphere
> assert big_sphere.contains(sub.vertices).all()
/builddir/build/BUILD/trimesh-3.17.0/tests/test_remesh.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/builddir/build/BUILD/trimesh-3.17.0/trimesh/base.py:2887: in contains
return self.ray.contains_points(points)
/builddir/build/BUILD/trimesh-3.17.0/trimesh/ray/ray_triangle.py:191: in contains_points
return contains_points(self, points)
/builddir/build/BUILD/trimesh-3.17.0/trimesh/constants.py:146: in timed
result = method(*args, **kwargs)
/builddir/build/BUILD/trimesh-3.17.0/trimesh/ray/ray_util.py:76: in contains_points
bi_hits = np.bincount(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (array([ 41, 94, 106, 56, 80, 188, 81, 57, 33, 118, 150, 74, 157,
89, 171, 77, 137, 79, 110, 54, 121... 45, 25, 131, 101,
117, 103, 2, 46, 43, 95, 10, 168, 194, 60, 141, 167, 23,
175], dtype=int64),)
kwargs = {'minlength': 196}
relevant_args = (array([ 41, 94, 106, 56, 80, 188, 81, 57, 33, 118, 150, 74, 157,
89, 171, 77, 137, 79, 110, 54, 121... 25, 131, 101,
117, 103, 2, 46, 43, 95, 10, 168, 194, 60, 141, 167, 23,
175], dtype=int64), None)
> ???
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
<__array_function__ internals>:180: TypeError
One new failure:
=================================== FAILURES ===================================
________________________ SampleTest.test_sample_volume _________________________
[gw4] linux -- Python 3.11.3 /usr/bin/python3
self = <tests.test_sample.SampleTest testMethod=test_sample_volume>
def test_sample_volume(self):
m = g.trimesh.creation.icosphere()
> samples = g.trimesh.sample.volume_mesh(mesh=m, count=100)
tests/test_sample.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
trimesh/sample.py:127: in volume_mesh
contained = mesh.contains(points)
trimesh/base.py:2942: in contains
return self.ray.contains_points(points)
trimesh/ray/ray_triangle.py:191: in contains_points
return contains_points(self, points)
trimesh/constants.py:146: in timed
result = method(*args, **kwargs)
trimesh/ray/ray_util.py:76: in contains_points
bi_hits = np.bincount(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (array([140, 22, 98, 2, 11, 186, 138, 195, 19, 157, 124, 76, 176,
10, 179, 33, 54, 72, 199, 64, 171..., 14, 17, 105, 110, 121, 14, 58, 128,
101, 28, 61, 179, 130, 177, 133, 27, 119, 180, 84], dtype=int64),)
kwargs = {'minlength': 200}
relevant_args = (array([140, 22, 98, 2, 11, 186, 138, 195, 19, 157, 124, 76, 176,
10, 179, 33, 54, 72, 199, 64, 171..., 17, 105, 110, 121, 14, 58, 128,
101, 28, 61, 179, 130, 177, 133, 27, 119, 180, 84], dtype=int64), None)
> ???
E TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'
<__array_function__ internals>:200: TypeError
I've ran into the same issues while introducing the module into Debian.
My workaround so far is this patch: https://salsa.debian.org/3dprinting-team/trimesh/-/blob/master/debian/patches/02-array-index-32bit-architectures.patch
I also reported potential issues with the documentation of the affected functions to the numpy developers: https://github.com/numpy/numpy/pull/23552
According to feedback in the numpy PR, this patch will not be appropriate for 64-bit Windows, because the int type is also 32 bits wide there and cause undesired narrowing of the data. While this doesn't affect the unit tests (there's no test for arrays larger than 2^31 elements), it adds additional overhead and my have unexpected effects on real use cases.
On Linux, it will work fine though, because Python int equals to C long, which matches the native integer type (32/64 bits depending on architecture).
According to the numpy devs, the "correct" type is np.intp, which always matches the native integer type, even on Windows.
In Fedora Linux, we haven’t had an i686 version of the distribution for some time. Instead, i686 is for multilib support on x86_64, primarily to keep the dependencies for Steam and 32-bit Wine around. We now have https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval, and we’ve almost dropped i686 support in all the packages that depend on python-trimesh, so we’ll stop building it on i686 soon too.
We already retired 32-bit ARM, https://fedoraproject.org/wiki/Changes/RetireARMv7, and the last version of Fedora to support it has reached end-of-life.
Accordingly, @sanjayankur31 and I won’t be reporting any more issues related to 32-bit architectures.
Here’s an updated summary of what I see on 4.0.2. We have all of the optional dependencies packaged except embreex, glooey, meshio, pymeshlab, python-fcl, and xatlas.
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe':
FAILED tests/test_binvox.py::BinvoxTest::test_load_save_invariance - TypeErro...
FAILED tests/test_bounds.py::BoundsTest::test_bounding_egg - TypeError: Canno...
FAILED tests/test_encoding.py::EncodingTest::test_composite - TypeError: Cann...
FAILED tests/test_encoding.py::EncodingTest::test_dense - TypeError: Cannot c...
FAILED tests/test_encoding.py::EncodingTest::test_flat - TypeError: Cannot ca...
FAILED tests/test_encoding.py::EncodingTest::test_flipped - TypeError: Cannot...
FAILED tests/test_encoding.py::EncodingTest::test_reshape - TypeError: Cannot...
FAILED tests/test_encoding.py::EncodingTest::test_transpose - TypeError: Cann...
FAILED tests/test_primitives.py::PrimitiveTest::test_cyl_buffer - TypeError: ...
FAILED tests/test_proximity.py::NearestTest::test_coplanar_signed_distance - ...
FAILED tests/test_ray.py::RayTests::test_contain_single - TypeError: Cannot c...
FAILED tests/test_ray.py::RayTests::test_contains - TypeError: Cannot cast ar...
FAILED tests/test_ray.py::RayTests::test_on_edge - TypeError: Cannot cast arr...
FAILED tests/test_ray.py::RayTests::test_on_vertex - TypeError: Cannot cast a...
FAILED tests/test_remesh.py::SubDivideTest::test_loop_correct - TypeError: Ca...
FAILED tests/test_runlength.py::RleTest::test_brle_encode_decode - TypeError:...
FAILED tests/test_runlength.py::RleTest::test_brle_length - TypeError: Cannot...
FAILED tests/test_runlength.py::RleTest::test_brle_logical_not - TypeError: C...
FAILED tests/test_runlength.py::RleTest::test_brle_to_dense - TypeError: Cann...
FAILED tests/test_runlength.py::RleTest::test_brle_to_rle - TypeError: Cannot...
FAILED tests/test_runlength.py::RleTest::test_rle_encode_decode - TypeError: ...
FAILED tests/test_sample.py::SampleTest::test_sample_volume - TypeError: Cann...
FAILED tests/test_util.py::ContainsTest::test_inside - TypeError: Cannot cast...
FAILED tests/test_voxel.py::VoxelGridTest::test_local - TypeError: Cannot cas...
FAILED tests/test_voxel.py::VoxelGridTest::test_roundtrip - TypeError: Cannot...
In previous versions, I saw MemoryError or numpy.core._exceptions._ArrayMemoryError in GLTFTest::test_basic, GLTFTest::test_merge_buffers, MutateTests::test_not_mutated_cube, SubDivideTest::test_subdivide, and SceneTests::test_scene. I wasn’t able to reproduce these in 4.0.2.
In previous versions, DecompositionTest::test_convex_decomposition and URDFTest::test_export segfaulted. I wasn’t able to reproduce these in 4.0.2, either.
Since i686 is so unimportant to us now, I haven’t tested @onitake’s patch. Thanks for offering it, though!