Skip to content

Creating new grid breaks if axes labels not provided #882

@wk9874

Description

@wk9874

Description of Bug

If I use assign_metrics_to_grid to make a new grid, and I don't provide a list of axes labels, it will crash and give a misleading error message:

  File "/home/wk9874/Documents/simvue/python-api/simvue/run.py", line 1434, in assign_metric_to_grid
    self._error(f"Grid '{grid_name}' is not defined.")
  File "/home/wk9874/Documents/simvue/python-api/simvue/run.py", line 606, in _error
    raise SimvueRunError(message)
simvue.exception.SimvueRunError: Grid 'test_metric_2d' is not defined.

I dont think axes labels should be required, it should probably default to 'x' for 2D metrics of ['x', 'y'] for 3D metrics. Although if you would prefer to be explicit and require axes labels, it should provide a more informative message

Steps To Reproduce

Code to reproduce the behavior:

import simvue
import numpy

with simvue.Run() as run:
    run.init("test")
    run.assign_metric_to_grid(metric_name="test_metric_2d", axes_ticks=numpy.arange(100))
    for i in range(10):
        run.log_metrics({"test_metric_2d": numpy.random.rand(10)}, time=i, step=i)

Expected behavior

Should create a grid and log a metric

Actual Behaviour

Error thrown

Screenshots

If applicable, add screenshots to help explain your problem.

Setup

  • OS: Ubuntu 22.04
  • Python version 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions