simvue-io / simvue-io/python-api
Grid.new fails if 1D array provided
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 4
- Fork
- 1
- Merge trung bình
- 5 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với lệnh gọi assign_metric_to_grid trong simvue/run.py và các wrapper kiểm tra hợp lệ trong simvue/utilities.py, sau đó tái hiện lỗi bằng ví dụ NumPy được cung cấp. Kiểm tra cách Grid.new kiểm tra tính hợp lệ của đầu vào grid. Hoàn tất khi một mảng axes_ticks 1D với một nhãn duy nhất tạo grid thành công mà không gặp lỗi kiểm tra hợp lệ đã nêu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- numpy, python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100