why not something like line 52-54 here: https://github.com/breuderink/eegtools/blob/master/examples/ex_csp_motor_imagery.py#L52-54 ? That's much more concise and simple