royerlab / ultrack

Cell tracking and segmentation software
https://royerlab.github.io/ultrack
BSD 3-Clause "New" or "Revised" License
86 stars 11 forks source link

`Tracker` API variable arguments bug #138

Open JoOkuma opened 1 month ago

JoOkuma commented 1 month ago

When not using kwargs,

    tracker = Tracker(cfg)
    tracker.track(foreground, contours)

it results in the error below

Traceback (most recent call last):
  File "/Users/jordao.bragantini/Softwares/ultrack/ultrack/core/_test/test_autotune.py", line 50, in <module>
    main()
  File "/Users/jordao.bragantini/Softwares/ultrack/ultrack/core/_test/test_autotune.py", line 35, in main
    tracker.track(foreground, contours)
  File "/Users/jordao.bragantini/Softwares/ultrack/ultrack/core/tracker.py", line 97, in track
    track(config=self.config, *args, **kwargs)
  File "/Users/jordao.bragantini/Softwares/ultrack/ultrack/utils/deprecation.py", line 36, in _update_from_dict
    return func(*args, **kwargs)
  File "/Users/jordao.bragantini/Softwares/ultrack/ultrack/utils/deprecation.py", line 36, in _update_from_dict
    return func(*args, **kwargs)
TypeError: track() got multiple values for argument 'config'

I think they should not take variable args without keywords (e.g. *args), for example:

    @functools.wraps(track)
    def track(self, *args, **kwargs) -> None:
        track(config=self.config, *args, **kwargs)
        self.status = TrackerStatus.SOLVED

cc @ilan-theodoro