Skip to content

Commit 32d6dbe

Browse files
authored
Merge pull request #929 from simvue-io/kzscisoft/grid-metric-consistency
Fix inconsistency in grid definition
2 parents 64e9de2 + 7277539 commit 32d6dbe

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

simvue/run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,9 @@ def log_metrics(
16881688
+ "using default axis range [0, 1] for all axes "
16891689
+ "and assuming constant interval."
16901690
)
1691-
_axes_ticks = [numpy.linspace(0, 1, n) for n in metric.shape]
1691+
_axes_ticks = [
1692+
numpy.linspace(0, 1, n) for n in reversed(metric.shape)
1693+
]
16921694
self.assign_metric_to_grid(
16931695
metric_name=label,
16941696
grid_name=label,

tests/functional/test_run_class.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,16 @@ def test_log_metrics_online(
296296
assert system_metrics_spy.call_count >= 1
297297

298298

299+
@pytest.mark.run
300+
@pytest.mark.online
301+
def test_log_grid_metric_auto_grid() -> None:
302+
with sv_run.Run() as run_final:
303+
run_final.init("test")
304+
run_final.log_metrics({"test": numpy.ones((20, 30))}) # see issue #921
305+
time.sleep(1)
306+
307+
308+
299309
@pytest.mark.run
300310
@pytest.mark.offline
301311
@pytest.mark.parametrize("metric_type", ("regular", "tensor"))
@@ -318,7 +328,7 @@ def test_log_metrics_offline(
318328
)
319329
else:
320330
METRICS = {"a": 10, "aB0-_/.:=><+()": 1.2, "c": 2}
321-
331+
322332
run.log_metrics(METRICS)
323333

324334
time.sleep(1)

0 commit comments

Comments
 (0)