restored functionalitity for adding list.
got accidently lost
This commit is contained in:
parent
d8b4b7e0f5
commit
acbb564afc
|
@ -303,8 +303,16 @@ class Rotation:
|
||||||
|
|
||||||
|
|
||||||
def append(self,other):
|
def append(self,other):
|
||||||
"""Extend rotation array along first dimension with other array."""
|
"""
|
||||||
return self.copy(rotation=np.vstack((self.quaternion,other.quaternion)))
|
Extend rotation array along first dimension with other array(s).
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
other : Rotation or list of Rotations.
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.copy(rotation=np.vstack(tuple(map(lambda x:x.quaternion,
|
||||||
|
[self]+other if isinstance(other,list) else [self,other]))))
|
||||||
|
|
||||||
|
|
||||||
def flatten(self,order = 'C'):
|
def flatten(self,order = 'C'):
|
||||||
|
|
|
@ -817,6 +817,14 @@ class TestRotation:
|
||||||
print(f'append 2x {shape} --> {s.shape}')
|
print(f'append 2x {shape} --> {s.shape}')
|
||||||
assert np.logical_and(s[0,...] == r[0,...], s[-1,...] == p[-1,...]).all()
|
assert np.logical_and(s[0,...] == r[0,...], s[-1,...] == p[-1,...]).all()
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('shape',[None,1,(1,),(4,2),(3,3,2)])
|
||||||
|
def test_append_list(self,shape):
|
||||||
|
r = Rotation.from_random(shape=shape)
|
||||||
|
p = Rotation.from_random(shape=shape)
|
||||||
|
s = r.append([r,p])
|
||||||
|
print(f'append 3x {shape} --> {s.shape}')
|
||||||
|
assert np.logical_and(s[0,...] == r[0,...], s[-1,...] == p[-1,...]).all()
|
||||||
|
|
||||||
@pytest.mark.parametrize('quat,standardized',[
|
@pytest.mark.parametrize('quat,standardized',[
|
||||||
([-1,0,0,0],[1,0,0,0]),
|
([-1,0,0,0],[1,0,0,0]),
|
||||||
([-0.5,-0.5,-0.5,-0.5],[0.5,0.5,0.5,0.5]),
|
([-0.5,-0.5,-0.5,-0.5],[0.5,0.5,0.5,0.5]),
|
||||||
|
|
Loading…
Reference in New Issue