diff --git a/tests/test_core.py b/tests/test_core.py index 16b8a4fe..e9978ec6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -213,11 +213,11 @@ def nfreq_imp(): @pytest.fixture(scope="module") def rao(ndof_imp, nfreq_imp): """Synthetic RAO transfer matrix.""" - rao = np.empty([ndof_imp, ndof_imp, nfreq_imp], dtype=complex) - rao[0, 0, :] = [0+1j, 0+2j] - rao[1, 0, :] = [1+1j, 11+2j] - rao[0, 1, :] = [2+1j, 22+2j] - rao[1, 1, :] = [3+1j, 33+2j] + rao = np.empty([nfreq_imp, ndof_imp, ndof_imp], dtype=complex) + rao[:, 0, 0] = [0+1j, 0+2j] + rao[:, 1, 0] = [1+1j, 11+2j] + rao[:, 0, 1] = [2+1j, 22+2j] + rao[:, 1, 1] = [3+1j, 33+2j] return rao @@ -576,7 +576,7 @@ def test_behavior(self,): i in range(np.size(x)-1)], -1), [np.real(z[-1]) * np.real(x[-1])], ]) - Z_mimo = wot.mimo_transfer_mat(np.reshape([z], [1,1,-1]), False) + Z_mimo = wot.mimo_transfer_mat(np.reshape([z], [-1, 1,1]), False) assert np.allclose(Z_mimo @ X, F) diff --git a/wecopttool/core.py b/wecopttool/core.py index d46c49de..c2f013bd 100644 --- a/wecopttool/core.py +++ b/wecopttool/core.py @@ -1963,8 +1963,7 @@ def force_from_impedance( -------- force_from_rao_transfer_function, """ - omega0 = np.expand_dims(omega, [1,2]) - return force_from_rao_transfer_function(impedance*(1j*omega0), False) + return force_from_rao_transfer_function(impedance*(1j*omega), False) def force_from_waves(force_coeff: ArrayLike, @@ -2000,7 +1999,7 @@ def inertia( Inertia matrix. """ omega = np.expand_dims(frequency(f1, nfreq, False)*2*np.pi, [1,2]) - inertia_matrix = np.expand_dims(inertia_matrix, -1) + inertia_matrix = np.expand_dims(inertia_matrix, 0) rao_transfer_function = -1*omega**2*inertia_matrix + 0j inertia_fun = force_from_rao_transfer_function( rao_transfer_function, False)