Call me stupid but I just spent 5 minutes trying to "debug" why this wasn't doing as I expected:
epochs.apply_baseline(None, 0)
Obviously, the baseline period should be specified as a tuple… What happened here is that instead of throwing an error message, I ended up with Epochs without baseline correction. Signature of apply_baseline is:
@verbose
def apply_baseline(self, baseline=(None, 0), verbose=None):
So verbose was simply set to 0.
While you could always argue that of course you should check your results and that you cannot make a software fool-proof, I was still wondering if we couldn't easily prevent some of those "user bugs" from happening. In this particular case, either being more restrictive on the allowed values of verbose, or declaring verbose to be a keyword-only argument would have successfully mitigated my inaptness :)
def apply_baseline(self, baseline=(None, 0), *, verbose=None):
Thoughts?
I like both suggestions: make verbose a kw-only argument and restrict its values.
There's a third (complementary) solution: at one point, we should start discussing adding type annotations.
Let's try to move this point as far as possible into the future...
I'm fine with adding the * to functions where verbose is close to the other arguments. We can even just start with apply_baseline for 0.21 as I agree it's a likely candidate for this problem.
I'm also fine with making the verbose decorator more picky, but let's do that early in 0.22
We can even just start with
apply_baselinefor 0.21 as I agree it's a likely candidate for this problem.
I can do this later tonight I believe.
remind me of
np.zeros(2, 3) :)
>
np.zeros(2, 3) :)
I literally had to run this code to figure out what's wrong with it. Ouch.
Most helpful comment
Let's try to move this point as far as possible into the future...