Commit 870fa62b authored by Lukas Wolf's avatar Lukas Wolf
Browse files

using polar coordinates as label

parent 382fe10b
......@@ -436,7 +436,8 @@ def get_fix_sacc_fix_data(verbose=True):
fix2_avg_y = fixation2[12]
dx = fix2_avg_x - fix1_avg_x
dy = fix2_avg_y - fix1_avg_y
y_datapoint = np.array([dx, dy])
rho, phi = cart2pol(dx, dy)
y_datapoint = np.array([rho, phi])
# Append to X and y
x_list.append([x_datapoint])
......@@ -492,4 +493,21 @@ def load_sEEG_data(abs_dir_path):
df = pd.DataFrame(sEEG[0])
data = df['data'][0].T # transpose to access time series
#print("EEG data shape: {}".format(data.shape))
return data # access the i-th recorded sample via data[i], recordings at 2ms intervals
\ No newline at end of file
return data # access the i-th recorded sample via data[i], recordings at 2ms intervals
def cart2pol(x, y):
"""
Transform cartesian to polar coordinates
"""
rho = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return rho, phi
def pol2cart(rho, phi):
"""
Transform polar to cartesian coordinates
"""
x = rho * np.cos(phi)
y = rho * np.sin(phi)
return x, y
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment