-
Notifications
You must be signed in to change notification settings - Fork 45
/
xtest_view.py
49 lines (38 loc) · 1.25 KB
/
xtest_view.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
This file has been removed from the "tests" collection, so that
tests can be run automatically (without GUI-interruption)
author: thomas haslwanter
date: nov-2018
"""
import sys
import os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(myPath, '..', '..'))
import unittest
import numpy as np
from time import sleep
from skinematics import view, quat
class TestSequenceFunctions(unittest.TestCase):
def test_view_ts(self):
t = np.arange(0,10,0.1)
x = np.sin(t) + 0.2*np.random.randn(len(t))
data = np.random.randn(100,3)
view.ts(x)
view.ts(locals())
def test_view_orientation(self):
omega = np.r_[0, 10, 10] # [deg/s]
duration = 2
rate = 100
q0 = [1, 0, 0, 0]
out_file = 'demo_patch.mp4'
title_text = 'Rotation Demo'
## Calculate the orientation
dt = 1./rate
num_rep = duration*rate
omegas = np.tile(omega, [num_rep, 1])
quaternion = quat.calc_quat(omegas, q0, rate, 'sf')
view.orientation(quaternion, out_file, 'Well done!')
if __name__ == '__main__':
unittest.main()
print('Thanks for using programs from Thomas!')
sleep(2)