Skip to content
Snippets Groups Projects
Commit f75db665 authored by Raymond Chia's avatar Raymond Chia
Browse files

create_features update

parent ca6c4281
No related merge requests found
File deleted
......@@ -214,34 +214,15 @@ def arg_parser():
return win_size
if __name__ == '__main__':
# window_sizes = [5, 7, 10, 12]
# window_sizes = [15, 17, 20]
window_sizes = arg_parser()
print(window_sizes)
# TODO
window_sizes = [5, 7, 10, 12, 15, 17, 20, 22, 25, 27, 30]
window_shifts = [0.2, 0.5, 1.0]
fs = IMU_FS
subjects = ['S'+str(i).zfill(2) for i in range(12,31)] # mars13
# subjects = ['S'+str(i).zfill(2) for i in range(21,31)] # mars13
conditions = ['M', 'R'] + ['L'+str(i) for i in range(0,4)]
# conditions = ['R'] + ['L'+str(i) for i in range(0,4)]
window_size = WINDOW_SIZE
window_shift = WINDOW_SHIFT
tlx_df = pd.read_csv('seated_nasa_tlx.csv', index_col=[0]).T
subjects = ['Pilot'+str(i).zfill(2) for i in range(2,4)] # mars13
for window_shift in window_shifts:
for window_size in window_sizes:
func = partial(map_imu_tsfresh_subject,
tlx_df=tlx_df,
conditions=conditions,
for subject in subjects:
map_imu_tsfresh_subject(subject,
window_size=window_size,
window_shift=window_shift)
# gen = map(func, subjects)
# for i, x in enumerate(gen):
# print(i/len(subjects)*100)
with Pool(cpu_count()) as p:
p.map(func, subjects)
print("completed for window sizes: ", window_sizes)
......@@ -589,7 +589,7 @@ def load_and_sync_xsens(subject, sens_list:list=['imu', 'bvp']):
return xsens_df
def load_tsfresh(xsens_df, project_dir,
def load_tsfresh(xsens_df, home_dir,
sens_list:list=['imu', 'bvp'],
window_size=12, window_shift=0.2, fs=IMU_FS,
overwrite=False, data_cols=None):
......@@ -607,13 +607,16 @@ def load_tsfresh(xsens_df, project_dir,
pd.DataFrame
"""
# raise NotImplementedError("To be implemented")
raise NotImplementedError("To be implemented")
# make home directory
assert data_cols is not None, "invalid selection for data columns"
pkl_file = join(project_dir, 'tsfresh.pkl')
if exists(pkl_file) and not overwrite:
return pd.read_pickle(pkl_file)
ipdb.set_trace()
x_df, y_df = get_df_windows(xsens_df,
df_win_task,
window_size=window_size,
......
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