-
Notifications
You must be signed in to change notification settings - Fork 2
/
lindsaysim.py
32 lines (29 loc) · 1.1 KB
/
lindsaysim.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
# -*- coding: utf-8 -*-
"""
Created on Mon May 25 15:04:53 2015
@author: Administrator
"""
from simulation import SimFiber
import numpy as np
from scipy.io import savemat
from constants import DT
if __name__ == '__main__':
control_list = ['Force', 'Displ']
lindsaySimDict = {}
for control in control_list:
lindsaySimDict[control] = SimFiber('Lindsay', '', control)
buffer_time = 0.175
buffer_pts = int(buffer_time / DT)
for control, lindsaySim in lindsaySimDict.items():
for traces in lindsaySim.traces:
for key, item in traces.items():
if key != 'max_index' and key != 'time':
traces[key] = np.r_[item[0] * np.ones(buffer_pts), item]
elif key == 'time':
traces[key] = np.arange(0, item[-1] + buffer_time, DT)
elif key == 'max_index':
traces[key] = item + buffer_pts
data = {}
for control, lindsaySim in lindsaySimDict.items():
data[control.lower() + '_control'] = lindsaySim.traces
savemat('./pickles/lindsaysim.mat', data, do_compression=True)