Bug when using mode = "w"
- There is a problem with the
"w"
mode ("Create file, truncate if exists") - Tested with commit 0608dd55
Output:
WARNING:root:Attribute "format_version" missing","root
Wassss?
...
KeyError: "Unable to open object (object 'samplings' doesn't exist)"
- "format_version" does not need to be set by the user
- "Wassss?" indicates that it was not expected that the program could get into this state
Code to reproduce the issue. You have to run it twice. First run creates the file and on second run the error appears.
import numpy as np
import robofish.io
guppy_poses = np.array(
[
[[-0.14, -0.38, -4.10], [-0.18, -0.44, 2.43]],
[[-0.14, -0.38, -3.99], [-0.18, -0.44, 2.30]],
[[-0.25, -0.26, -1.85], [-0.24, -0.22, 4.02]],
]
)
time_us = np.array([0.04, 0.08, 0.12]) * 1e6
with robofish.io.File(
"test.hdf5",
"w",
monotonic_time_points_us=time_us,
world_size_cm=[100, 100],
) as f:
f: robofish.io.File
for i in range(guppy_poses.shape[1]):
f.create_entity(poses=guppy_poses[:, i], category="simulated guppy")