@@ -792,7 +792,7 @@ def calculate_velocity(self):
792792
793793 # Unwrap angles and compute velocity
794794 warr = np .rad2deg (np .unwrap (np .deg2rad (self .rot_deg_line )))
795- velocity = np .diff (warr ) / self .sampling_rate
795+ velocity = np .diff (warr ) * self .sampling_rate
796796
797797 # Butterworth low-pass filter
798798 order = 3
@@ -918,10 +918,8 @@ def plot_rotation_angles_and_velocity(self):
918918 label = "velocity" ,
919919 )
920920
921- # change x ticks to seconds by using sampling rate
922- ticks = ax .get_xticks ()
923- new_ticks = [int (tick * self .sampling_rate ) for tick in ticks ]
924- ax .set_xticklabels (new_ticks )
921+ # remove top axis
922+ ax2 .spines ["top" ].set_visible (False )
925923
926924 # set x label
927925 ax .set_xlabel ("Time (s)" )
@@ -981,12 +979,17 @@ def plot_rotation_speeds(self):
981979 label = f"repetition { idx } " ,
982980 color = colors [j ],
983981 )
984- # ax[row, col].legend()
985982 ax [row , col ].set_title (f"Speed: { speed } , direction: { direction } " )
986- # ax[row, col].set_ylim(-1.5, 1.5)
987983 ax [row , col ].spines ["top" ].set_visible (False )
988984 ax [row , col ].spines ["right" ].set_visible (False )
989985
986+ # set titles of axis
987+ ax [row , col ].set_xlabel ("Time (s)" )
988+ ax [row , col ].set_ylabel ("Velocity (°/s)" )
989+
990+ # leave more space between subplots
991+ plt .subplots_adjust (hspace = 0.5 , wspace = 0.5 )
992+
990993 fig .suptitle ("Rotation on signal for each speed" )
991994 plt .savefig (self .debug_plots_folder / "all_speeds.png" )
992995 plt .close ()
0 commit comments