-
Notifications
You must be signed in to change notification settings - Fork 0
/
poolData.py
32 lines (25 loc) · 827 Bytes
/
poolData.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
import pandas as pd
import numpy as np
import scipy.io as sio
import time
def poolData(yin, polyorder, usesine):
n = yin.shape[0]
nVars = yin.shape[1]
yout = [np.ones((n, 1))]
for i in range(nVars):
yout.append(yin[:, i].reshape(-1, 1))
if polyorder >= 2:
for i in range(nVars):
for j in range(i, nVars):
yout.append((yin[:, i] * yin[:, j]).reshape(-1, 1))
if polyorder >= 3:
for i in range(nVars):
for j in range(i, nVars):
for k in range(j, nVars):
yout.append((yin[:, i] * yin[:, j] * yin[:, k]).reshape(-1, 1))
if usesine:
for k in range(1):
yout.append(np.sin(k * yin))
yout.append(np.cos(k * yin))
yout = np.concatenate(yout, axis=1)
return yout