@@ -379,10 +379,8 @@ def bode_plot(
379379 else :
380380 raise ValueError ("initial_phase must be a number." )
381381
382- # Reshape the phase to allow standard indexing
383- phase = response .phase .copy ().reshape ((noutputs , ninputs , - 1 ))
384-
385382 # Shift and wrap the phase
383+ phase = np .angle (response .frdata ) # 3D array
386384 for i , j in itertools .product (range (noutputs ), range (ninputs )):
387385 # Shift the phase if needed
388386 if abs (phase [i , j , 0 ] - initial_phase_value ) > math .pi :
@@ -405,12 +403,9 @@ def bode_plot(
405403 else :
406404 raise ValueError ("wrap_phase must be bool or float." )
407405
408- # Put the phase back into the original shape
409- phase = phase .reshape (response .magnitude .shape )
410-
411- # Save the data for later use (legacy return values)
412- mag_data .append (response .magnitude .reshape (noutputs , ninputs , - 1 ))
413- phase_data .append (phase .reshape (noutputs , ninputs , - 1 ))
406+ # Save the data for later use
407+ mag_data .append (np .abs (response .frdata ))
408+ phase_data .append (phase )
414409 omega_data .append (response .omega )
415410
416411 #
@@ -685,8 +680,8 @@ def _make_line_label(response, output_index, input_index):
685680
686681 for index , response in enumerate (data ):
687682 # Get the (pre-processed) data in fully indexed form
688- mag = mag_data [index ]. reshape (( noutputs , ninputs , - 1 ))
689- phase = phase_data [index ]. reshape (( noutputs , ninputs , - 1 ))
683+ mag = mag_data [index ]
684+ phase = phase_data [index ]
690685 omega_sys , sysname = omega_data [index ], response .sysname
691686
692687 for i , j in itertools .product (range (noutputs ), range (ninputs )):
0 commit comments