fix: fix functionality of mfcc table func
This commit is contained in:
parent
1ff4f76bb9
commit
31cf8a110d
@ -574,22 +574,27 @@ class DL_data_handler:
|
||||
|
||||
self.samples_per_subject[subject_nr+1] = subj_samples
|
||||
|
||||
def make_mfcc_table_of_emglist(self, emg_list, df_original):
|
||||
samplerate = get_samplerate(df_original)
|
||||
signal = get_xory_from_df('y', emg_list[0])
|
||||
mfcc_0 = mfcc_custom(signal, samplerate, MFCC_WINDOWSIZE, MFCC_STEPSIZE, NR_COEFFICIENTS, NR_MEL_BINS)
|
||||
df = DataFrame(mfcc_0)
|
||||
def make_mfcc_df_from_session_df(self, session_df):
|
||||
session_df.rename(columns={0:'timestamp'}, inplace=True)
|
||||
samplerate = get_samplerate(session_df)
|
||||
#attach_func = lambda list_1, list_2: list_1.tolist().extend(list_2.tolist())
|
||||
attach_func = lambda list_1, list_2: list_1.extend(list_2)
|
||||
|
||||
for i in range(15):
|
||||
signal = get_xory_from_df('y', emg_list[i+1])
|
||||
mfcc_i = mfcc_custom(signal, samplerate, MFCC_WINDOWSIZE, MFCC_STEPSIZE, NR_COEFFICIENTS, NR_MEL_BINS)
|
||||
mfcc_i = DataFrame(mfcc_i)
|
||||
df.combine(mfcc_i, attach_func)
|
||||
|
||||
return df
|
||||
signal = session_df[1]
|
||||
mfcc_0 = mfcc_custom(signal, samplerate, MFCC_WINDOWSIZE, MFCC_STEPSIZE, NR_COEFFICIENTS, NR_MEL_BINS)
|
||||
df = DataFrame(mfcc_0).dropna()
|
||||
df['combined'] = df.values.tolist()
|
||||
result_df = df['combined']
|
||||
#print(result_df)
|
||||
|
||||
pass
|
||||
for i in range(2, 17):
|
||||
signal_i = session_df[i]
|
||||
mfcc_i = mfcc_custom(signal_i, samplerate, MFCC_WINDOWSIZE, MFCC_STEPSIZE, NR_COEFFICIENTS, NR_MEL_BINS)
|
||||
mfcc_i = DataFrame(mfcc_i).dropna()
|
||||
mfcc_i['combined'] = mfcc_i.values.tolist()
|
||||
df = result_df.combine(mfcc_i['combined'], attach_func)
|
||||
|
||||
return result_df
|
||||
|
||||
def store_mfcc_samples(self):
|
||||
for subject_nr in range(5):
|
||||
|
@ -221,19 +221,13 @@ def main():
|
||||
csv_handler = CSV_handler()
|
||||
csv_handler.load_data('soft')
|
||||
dl_data_handler = DL_data_handler(csv_handler)
|
||||
dl_data_handler.store_samples(5)
|
||||
dict = dl_data_handler.samples_per_subject
|
||||
#print(dict.get(1)[2][0], dict.get(1)[10][1])
|
||||
#print(dict.get(1)[15][0], dict.get(1)[10][1])
|
||||
#print(dict.get(1))
|
||||
'''
|
||||
print(len(dict.get(1)))
|
||||
print(len(dict.get(2)))
|
||||
print(len(dict.get(3)))
|
||||
print(len(dict.get(4)))
|
||||
print(len(dict.get(5)))
|
||||
'''
|
||||
dl_data_handler.save_mfcc()
|
||||
emg_list = dl_data_handler.get_emg_list(1, 1)
|
||||
session_df = dl_data_handler.make_subj_sample(emg_list)
|
||||
print(session_df)
|
||||
df = dl_data_handler.make_mfcc_df_from_session_df(session_df)
|
||||
print(df)
|
||||
print(len(df.iloc[0]))
|
||||
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user