@@ -16,19 +16,21 @@ def __init__(self):
16
16
# Create layout
17
17
layout = QVBoxLayout ()
18
18
19
- # Create plot widgets for raw EMG and EMG envelope
20
- self .raw_emg_plot = PlotWidget (self )
21
- self .raw_emg_plot .setBackground ('w' )
22
- self .raw_emg_plot .showGrid (x = True , y = True )
23
- self .raw_emg_plot .setTitle ("Raw EMG Signal" )
19
+ # Create plot widgets for Filtered EMG and EMG envelope
20
+ self .emg_plot = PlotWidget (self )
21
+ self .emg_plot .setBackground ('w' )
22
+ self .emg_plot .showGrid (x = True , y = True )
23
+ self .emg_plot .setMouseEnabled (x = False , y = False ) # Disable zoom
24
+ self .emg_plot .setTitle ("Filtered EMG Signal(High Pass 70 Hz)" )
24
25
25
26
self .envelope_plot = PlotWidget (self )
26
27
self .envelope_plot .setBackground ('w' )
27
28
self .envelope_plot .showGrid (x = True , y = True )
28
- self .envelope_plot .setTitle ("EMG Envelope" )
29
+ self .envelope_plot .setMouseEnabled (x = False , y = False ) # Disable zoom
30
+ self .envelope_plot .setTitle ("EMG Envelope(10% Average Samples)" )
29
31
30
32
# Add plots to layout
31
- layout .addWidget (self .raw_emg_plot )
33
+ layout .addWidget (self .emg_plot )
32
34
layout .addWidget (self .envelope_plot )
33
35
34
36
# Central widget
@@ -55,23 +57,23 @@ def __init__(self):
55
57
56
58
self .b , self .a = butter (4 , 70.0 / (0.5 * self .sampling_rate ), btype = 'high' )
57
59
58
- # Moving RMS window size (50 for 250 sampling rate and 100 for 500 sampling rate)
60
+ # Moving RMS window size (25 for 250 sampling rate and 50 for 500 sampling rate)
59
61
self .rms_window_size = int (0.1 * self .sampling_rate )
60
62
61
63
# Set fixed axis ranges
62
- self .raw_emg_plot .setXRange (0 , 10 , padding = 0 )
64
+ self .emg_plot .setXRange (0 , 10 , padding = 0 )
63
65
self .envelope_plot .setXRange (0 , 10 , padding = 0 )
64
66
65
- # Set y-axis limits based on sampling rate for raw EMG
67
+ # Set y-axis limits based on sampling rate for Filtered EMG
66
68
if self .sampling_rate == 250 :
67
- self .raw_emg_plot .setYRange (- ((2 ** 10 )/ 2 ), ((2 ** 10 )/ 2 ), padding = 0 ) # for R3
69
+ self .emg_plot .setYRange (- ((2 ** 10 )/ 2 ), ((2 ** 10 )/ 2 ), padding = 0 ) # for R3
68
70
self .envelope_plot .setYRange (0 , ((2 ** 10 )/ 2 ), padding = 0 ) # for R3
69
71
elif self .sampling_rate == 500 :
70
- self .raw_emg_plot .setYRange (- ((2 ** 14 )/ 2 ), ((2 ** 14 )/ 2 ), padding = 0 ) # for R4
72
+ self .emg_plot .setYRange (- ((2 ** 14 )/ 2 ), ((2 ** 14 )/ 2 ), padding = 0 ) # for R4
71
73
self .envelope_plot .setYRange (0 , ((2 ** 14 )/ 2 ), padding = 0 ) # for R4
72
74
73
75
# Plot curves for EMG data and envelope
74
- self .emg_curve = self .raw_emg_plot .plot (self .time_data , self .emg_data , pen = pg .mkPen ('b' , width = 1 ))
76
+ self .emg_curve = self .emg_plot .plot (self .time_data , self .emg_data , pen = pg .mkPen ('b' , width = 1 ))
75
77
self .envelope_curve = self .envelope_plot .plot (self .time_data , self .emg_data , pen = pg .mkPen ('r' , width = 2 ))
76
78
77
79
# Timer for plot update
0 commit comments