From 7277539c265276b9ab40590103cfb95f62f2e59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Zar=C4=99bski?= Date: Tue, 3 Mar 2026 11:26:27 +0000 Subject: [PATCH] Fix inconsistency in grid definition --- simvue/run.py | 4 +++- tests/functional/test_run_class.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/simvue/run.py b/simvue/run.py index 52d76f65..728b0a0b 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -1688,7 +1688,9 @@ def log_metrics( + "using default axis range [0, 1] for all axes " + "and assuming constant interval." ) - _axes_ticks = [numpy.linspace(0, 1, n) for n in metric.shape] + _axes_ticks = [ + numpy.linspace(0, 1, n) for n in reversed(metric.shape) + ] self.assign_metric_to_grid( metric_name=label, grid_name=label, diff --git a/tests/functional/test_run_class.py b/tests/functional/test_run_class.py index f1ba2d81..5f66c4d6 100644 --- a/tests/functional/test_run_class.py +++ b/tests/functional/test_run_class.py @@ -296,6 +296,16 @@ def test_log_metrics_online( assert system_metrics_spy.call_count >= 1 +@pytest.mark.run +@pytest.mark.online +def test_log_grid_metric_auto_grid() -> None: + with sv_run.Run() as run_final: + run_final.init("test") + run_final.log_metrics({"test": numpy.ones((20, 30))}) # see issue #921 + time.sleep(1) + + + @pytest.mark.run @pytest.mark.offline @pytest.mark.parametrize("metric_type", ("regular", "tensor")) @@ -318,7 +328,7 @@ def test_log_metrics_offline( ) else: METRICS = {"a": 10, "aB0-_/.:=><+()": 1.2, "c": 2} - + run.log_metrics(METRICS) time.sleep(1)