In [1]:
import os
import numpy as np
import Quaternions

x = np.array([12.1, 2.2, 3.3])
#x = [12.1, 2.2, 3.3]
Quaternions.QuaternionArray([x,])
print('HALP')


---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
/Users/boyle/.continuum/anaconda/lib/python2.7/codeop.pyc in __call__(self, source, filename, symbol)
    131 
    132     def __call__(self, source, filename, symbol):
--> 133         codeob = compile(source, filename, symbol, self.flags, 1)
    134         for feature in _features:
    135             if codeob.co_flags & feature.compiler_flag:

SystemError: Objects/listobject.c:169: bad argument to internal function

In [1]:
import numpy as np
import Quaternions
Quaternions.QuaternionArray([np.array([12.1, 2.2, 3.3]),])
print('HALP')


---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
/Users/boyle/.continuum/anaconda/lib/python2.7/codeop.pyc in __call__(self, source, filename, symbol)
    131 
    132     def __call__(self, source, filename, symbol):
--> 133         codeob = compile(source, filename, symbol, self.flags, 1)
    134         for feature in _features:
    135             if codeob.co_flags & feature.compiler_flag:

SystemError: Objects/listobject.c:169: bad argument to internal function

In [2]:
Quaternions.QuaternionArray([[12.1, 2.2, 3.3],])
print('HALP')


HALP

In [8]:
tmp2 = Quaternions.QuaternionArray([[12.1, 2.2, 3.3],])
print('Yep')
tmp1 = Quaternions.QuaternionArray([np.array([12.1, 2.2, 3.3]),])


Yep
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
SystemError: Objects/listobject.c:169: bad argument to internal function

In [6]:
print(tmp1.dtype, tmp2.dtype)


(dtype('O'), dtype('O'))

In [9]:
tmp1


Out[9]:
array([Quaternion(0, 12.1, 2.2, 3.3)], dtype=object)

In [10]:
tmp2


Out[10]:
array([Quaternion(0, 12.1, 2.2, 3.3)], dtype=object)

In [ ]:


In [5]:
import Quaternions
display(Quaternions.QuaternionArray([[0,0,0,1.], [1.,0,0,0]]))
display(Quaternions.QuaternionArray([[2.8,0,1.], [5.,4,31.]]))


array([Quaternion(0, 0, 0, 1), Quaternion(1, 0, 0, 0)], dtype=object)
array([Quaternion(0, 2.8, 0, 1), Quaternion(0, 5, 4, 31)], dtype=object)

In [7]:
t = [0., 1.0, 2., 3.]
v = Quaternions.QuaternionArray([[0,0,1.], [1.,0,0], [0,1.,0], [0,0,1.]])
v


Out[7]:
array([Quaternion(0, 0, 0, 1), Quaternion(0, 1, 0, 0),
       Quaternion(0, 0, 1, 0), Quaternion(0, 0, 0, 1)], dtype=object)

In [8]:
y = Quaternions.FrameFromZ(v, t)
y


Out[8]:
array([Quaternion(1, 0, 0, 0),
       Quaternion(0.695238273413558, 0.129010632046104, 0.695238273413558, 0.129010632046104),
       Quaternion(0.528896890850549, -0.528896890850549, 0.469327261991697, 0.469327261991697),
       Quaternion(0.614322309005436, 0, 0, 0.789055194937736)], dtype=object)

In [5]:
Quaternions.sqrtOfRotor(Quaternions.FrameFromZ(v, t))


Out[5]:
array([Quaternion(1, 0, 0, 0),
       Quaternion(0.920662335879327, 0.0700640327177528, 0.377575059997178, 0.0700640327177528),
       Quaternion(0.874327424610068, -0.302459282394365, 0.268393309406374, 0.268393309406374),
       Quaternion(0.898421479319544, 0, 0, 0.439134199872068)], dtype=object)

In [6]:
Quaternions.sqrtOfRotor(list(Quaternions.FrameFromZ(v, t)))


Out[6]:
array([Quaternion(1, 0, 0, 0),
       Quaternion(0.920662335879327, 0.0700640327177528, 0.377575059997178, 0.0700640327177528),
       Quaternion(0.874327424610068, -0.302459282394365, 0.268393309406374, 0.268393309406374),
       Quaternion(0.898421479319544, 0, 0, 0.439134199872068)], dtype=object)

In [9]:
v*y


Out[9]:
array([Quaternion(0, 0, 0, 1),
       Quaternion(-0.129010632046104, 0.695238273413558, -0.129010632046104, 0.695238273413558),
       Quaternion(-0.469327261991697, 0.469327261991697, 0.528896890850549, 0.528896890850549),
       Quaternion(-0.789055194937736, 0, 0, 0.614322309005436)], dtype=object)

In [10]:
v+y


Out[10]:
array([Quaternion(1, 0, 0, 1),
       Quaternion(0.695238273413558, 1.1290106320461, 0.695238273413558, 0.129010632046104),
       Quaternion(0.528896890850549, -0.528896890850549, 1.4693272619917, 0.469327261991697),
       Quaternion(0.614322309005436, 0, 0, 1.78905519493774)], dtype=object)

In [13]:
v*y[1]


Out[13]:
array([ Quaternion(-0.129010632046104, -0.695238273413558, 0.129010632046104, 0.695238273413558),
       Quaternion(-0.129010632046104, 0.695238273413558, -0.129010632046104, 0.695238273413558),
       Quaternion(-0.695238273413558, 0.129010632046104, 0.695238273413558, -0.129010632046104),
       Quaternion(-0.129010632046104, -0.695238273413558, 0.129010632046104, 0.695238273413558)], dtype=object)

In [14]:
y[1]*v


Out[14]:
array([ Quaternion(-0.129010632046104, 0.695238273413558, -0.129010632046104, 0.695238273413558),
       Quaternion(-0.129010632046104, 0.695238273413558, 0.129010632046104, -0.695238273413558),
       Quaternion(-0.695238273413558, -0.129010632046104, 0.695238273413558, 0.129010632046104),
       Quaternion(-0.129010632046104, 0.695238273413558, -0.129010632046104, 0.695238273413558)], dtype=object)

In [ ]: