mir-evaluation/mir_eval

Warning in sonify.clicks

Closed this issue · 4 comments

I get this a lot:

/home/bmcfee/git/mir_eval/mir_eval/sonify.py:45: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  click_signal = np.zeros(length)

whenever length is a float type. I can cast it myself, but I think it's better to handle that within clicks.

The docstring specifies supplying an int, so the current policy of mir_eval is that it's on you:
https://github.com/craffel/mir_eval/blob/master/mir_eval/sonify.py#L25
Otherwise, this falls under #143 - we don't type check most inputs in mir_eval; if we're going to check some, we should check them all (e.g. that when a np.ndarray is asked for, a list is not provided #219, etc).

Actually I don't think that's correct in this case.

At these lines, the length is inferred from times, but not explicitly cast to int. Since times need not be int, this warning can happen anyway.

Actually I don't think that's correct in this case.

At these lines, the length is inferred from times, but not explicitly cast to int. Since times need not be int, this warning can happen anyway.

Well, it's definitely correct (we need length to be an int, user-supplied or not), it's just a different issue,. We should definitely be doing length = int(times.max()*fs + click.shape[0] + 1).

Yes, sorry if my initial post was unclear, I was writing in a hurry.

I think this does have to be fixed within mir_eval.