fix: sort out the fft_prep
This commit is contained in:
parent
85dbab5561
commit
2afad7f87c
@ -101,7 +101,7 @@ def prep_df_for_trans(df:DataFrame):
|
|||||||
sample_rate = SAMPLE_RATE
|
sample_rate = SAMPLE_RATE
|
||||||
min, duration = Handler.get_min_max_timestamp(df)
|
min, duration = Handler.get_min_max_timestamp(df)
|
||||||
x = np.linspace(0, duration, SAMPLE_RATE * duration, endpoint=False)
|
x = np.linspace(0, duration, SAMPLE_RATE * duration, endpoint=False)
|
||||||
y = np.array(df.iloc(1))
|
y = df.iloc[:,1].to_numpy()
|
||||||
return x, y, duration
|
return x, y, duration
|
||||||
|
|
||||||
def normalize_wave(y_values):
|
def normalize_wave(y_values):
|
||||||
@ -125,7 +125,7 @@ def plot_fft(x_f, y_f):
|
|||||||
plt.plot(x_f, np.abs(y_f))
|
plt.plot(x_f, np.abs(y_f))
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
#'''
|
||||||
handler = Handler.CSV_handler()
|
handler = Handler.CSV_handler()
|
||||||
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
||||||
df = handler.get_time_emg_table(file, 1)
|
df = handler.get_time_emg_table(file, 1)
|
||||||
@ -133,3 +133,4 @@ df = handler.get_time_emg_table(file, 1)
|
|||||||
trans_df = DataFrame(transformed_df(df))
|
trans_df = DataFrame(transformed_df(df))
|
||||||
#print(trans_df.info)
|
#print(trans_df.info)
|
||||||
plot_fft(trans_df)
|
plot_fft(trans_df)
|
||||||
|
#'''
|
@ -1,6 +1,6 @@
|
|||||||
from Handle_emg_data import CSV_handler, get_min_max_timestamp
|
from Handle_emg_data import CSV_handler, get_min_max_timestamp
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
#import Signal_prep
|
import Signal_prep
|
||||||
|
|
||||||
def test_df_extraction(emg_nr):
|
def test_df_extraction(emg_nr):
|
||||||
handler = CSV_handler()
|
handler = CSV_handler()
|
||||||
@ -24,4 +24,11 @@ def test_min_max_func():
|
|||||||
print(min)
|
print(min)
|
||||||
print(max)
|
print(max)
|
||||||
|
|
||||||
test_min_max_func()
|
def test_fft_prep():
|
||||||
|
handler = CSV_handler()
|
||||||
|
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
||||||
|
df = handler.get_time_emg_table(file, 1)
|
||||||
|
|
||||||
|
x, y, d = Signal_prep.prep_df_for_trans(df)
|
||||||
|
print(x)
|
||||||
|
print(y)
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user