Skip to content

Misleading Error: "Specify either frequency_hz or timestamps, not both."

Steps to reproduce:

import numpy as np
import robofish.io

f = robofish.io.File(
    world_size_cm=(100, 100),
    sampling_name="25",
    frequency_hz=25,
    monotonic_time_points_us=np.linspace(0, 1e6, 25),
)

Output:

ERROR:root:Specify either frequency_hz or timestamps, not both.
NoneType: None

Expected behavior: No error or warning as this is not violating the spec.

I need both frequency_hz and monotonic_time_points_us in my files and was confused by the error being logged.

Suggested Fix: It looks like the file is created correctly and it is maybe enough to just remove the logging in src/robofish/io/file.py::create_sampling.