Skip to content

Commit c1735fc

Browse files
committed
Update tests
1 parent 91cc76a commit c1735fc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

openquake/vmtk/tests/test_modeller.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import shutil
33
import unittest
44
import numpy as np
5+
import pytest
6+
7+
pytest.importorskip("openseespy.opensees",
8+
reason="openseespy not installed — modeller tests skipped")
59

610
from openquake.vmtk.modeller import modeller
711

@@ -254,7 +258,11 @@ def test_modal_analysis_period(self):
254258
def test_modal_analysis_mode_shape(self):
255259
T, phi = self.model.do_modal_analysis(num_modes=3)
256260
# phi[0] is (n_nodes x 3); skip base node (row 0), take x-direction (col 0)
257-
np.testing.assert_array_almost_equal(phi[0][1:, 0], self.PHI, decimal=4)
261+
raw = phi[0][1:, 0]
262+
# Normalise by the maximum absolute component — OpenSees does not
263+
# guarantee a consistent eigenvector scale across platforms/versions.
264+
normalised = raw / np.abs(raw).max()
265+
np.testing.assert_array_almost_equal(normalised, self.PHI, decimal=4)
258266

259267
def test_spo_analysis(self):
260268
self.model.do_spo_analysis(0.01, 5, 1, self.PHI, pFlag=False)

0 commit comments

Comments
 (0)