simvue-io / simvue-io/python-api

Grid.new fails if 1D array provided

未关闭
#883 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug wontfix
主要语言
Python
星标
4
派生
1
平均合并
5 天 8 小时
30 天内合并 PR
4

描述

Description of Bug

If trying to create a grid for a 2D metric by providing a 1D array of ticks, it fails validation.

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(10), axes_labels=['x'])
    for i in range(10):
        run.log_metrics({"test_metric_2d": numpy.random.rand(10)}, time=i, step=i)

Expected behavior

Grid added correctly

Actual Behaviour

Traceback (most recent call last):
  File "/home/wk9874/Documents/simvue/python-api/test_retrieval.py", line 6, in <module>
    run.assign_metric_to_grid(metric_name="test_metric_2d", axes_ticks=numpy.arange(10), axes_labels=['x'])
  File "/home/wk9874/Documents/simvue/python-api/simvue/utilities.py", line 260, in wrapper
    return class_func(self, *args, **kwargs)
  File "/home/wk9874/Documents/simvue/python-api/simvue/run.py", line 105, in _wrapper
    return _function(self, *args, **kwargs)
  File "/home/wk9874/Documents/simvue/python-api/simvue/utilities.py", line 300, in wrapper
    raise RuntimeError(error_str)
RuntimeError: `Grid.new` Validation:
╒═════════╤═════════════╤══════════════════╤══════════════════════════════╕
│   Input │ Location    │ Type             │ Message                      │
╞═════════╪═════════════╪══════════════════╪══════════════════════════════╡
│       0 │ ['grid', 0] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       1 │ ['grid', 1] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       2 │ ['grid', 2] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       3 │ ['grid', 3] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       4 │ ['grid', 4] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       5 │ ['grid', 5] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       6 │ ['grid', 6] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       7 │ ['grid', 7] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       8 │ ['grid', 8] │ int != list_type │ Input should be a valid list │
├─────────┼─────────────┼──────────────────┼──────────────────────────────┤
│       9 │ ['grid', 9] │ int != list_type │ Input should be a valid list │
╘═════════╧═════════════╧══════════════════╧══════════════════════════════╛

Screenshots

If applicable, add screenshots to help explain your problem.

Setup

  • OS: [e.g. Windows 11]
  • Python version [e.g. v3.13.3]

Additional context

Add any other context about the problem here.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先从 simvue/run.py 中的 assign_metric_to_grid 调用和 simvue/utilities.py 中的验证包装器开始,然后使用提供的 NumPy 示例重现该失败。检查 Grid.new 如何验证网格输入。当包含单个标签的 1D axes_ticks 数组能够成功创建网格,且不再出现报告的验证错误时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
numpy, python
领域
api
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。