Neuropype: motor imagery tutorial, questions

Greetings. I'm trying to motor imagery tutorial on the website using a Cyton. Using the GUI I can confirm there is EEG, and the LSL stream seems to be recognized. I went through the calibration to create the xdf file, and I edited the pipeline as specified in Neuropype. And the following happens:
Loading pipeline...
INFO: execution started
INFO: execution resuming
INFO: Importing XDF file C:/Recordings/CurrentStudy/exp1/slater1.xdf...
INFO: Imported file C:/Recordings/CurrentStudy/exp1/slater1.xdf.
INFO: Imported file C:/Recordings/CurrentStudy/exp1/slater1.xdf.
INFO: Resolving data stream (name='obci_eeg1')...
INFO: Applying FIR filter...
INFO: CSP model is training now...
****ERROR: The following error occurred in node Common Spatial Patterns: shape of data ((2, 4)) must match lengths of axes ((2, 6))****
WARNING: The channel labels of the given stream were missing or incomplete. Auto-generating labels.
INFO: LSL: Data stream obci_eeg1 acquired.
ERROR: CSP must be trained before it can be used
Honestly I'm not sure where to begin looking for the "Common Spatial Patterns" node to figure out why the data shape doesn't match the axes length. If I just run the pipeline without editing it (with no EEG input from my headset) it executes appropriately. Where should I start looking? Any suggestions will be appreciated. Thanks!
Comments
Doc, hi.
So you are referencing this tutorial, by Rakesh Jakati, @Rakeshbci,
https://docs.openbci.com/Examples/EEGProjects/MotorImagery/
I've referenced, using the at-sign notation, Rakesh. Hopefully he will see your error and respond. Possibly also suggesting any edits to the tutorial to avoid users encountering this in the future.
Regards, William
Mentioning @rakeshbci01, @Rakeshbci, can you please comment?
Hi,
The pipeline on my computer is working fine. I am using NeuroPype Academic edition 2020.0.3, try using this version.
I had another user with the same issue, but the error was due to not including the EEG markers in the stream. I will send you a .xdf to calibrate the pipeline, try using that before using live headset.
Hello Doc,
I would recommend you to go to the Pipeline Designer and select the CSP (Common Spatial Patterns) node and change parameter to 2.
This should hopefully fix the issue.
Regards
Devyansh Gupta
@Doc_Slater, hi.
Just checking on your situation. Did any of the comments by Devyansh or Rakesh solve your issue? Do you have a recommendation on how the current document could be improved?
Thanks, William
OK, so it now works (sort of). So I'm using the ThinkPulse active electrodes from Conscious Labs. They work well, but do require that one lowers the PCA gain (via a command in the GUI). If I start the LSL stream via the GUI, then start the pipeline I get an error due to the channel labels being unrecognizable. I've tried to figure out how to change the labels within the GUI and thus far failed. However if I just run the GUI to send the needed hardware commands, start streaming the data so I can see it and fix any electrode contact issues, then STOP the stream, I can then open an anaconda python command window, run the openbci_lsl.py program, and pass the correct electrode labels on there. Then I start the LSL stream using the command line. ONLY then can I start the Neuropype pipeline and it works. I say sort of because the calibration file that Rakesh was kind enough to send doesn't work especially well (I'm sure because I'm using active instead of passive electrodes). Now that I know how to do the two-step to connect the board AND the electrode labels to software, I'll try rerunning to the python code to do my own calibration. My hope is that will work a bit better.
I should emphasize the fact that without Rakesh's help and the file he sent, I never would have figured this out and gotten it to work at all, so he's my hero
Thank you all very much for the help!
Doc
Hi! I'm trying to motor imagery tutorial on the website using a Cyton.
I edited the pipeline as specified in Neuropype.

And the following happens:
The error occurs in the LSL input step. I have the following configuration:

and in GUI:

(I try others configurations and the same)
Do you know what I'm doing wrong?
Thanks!
Hi @arellanon,
I've merged your new question on the Neuropype MI tutorial, into this existing thread. I am hoping that @Rakeshbci or @Devyansh can offer some suggestions. As they are experts on Neuropype and the tutorial was written by Rakesh.
Regards, William
I am hoping that @Rakeshbci or @Devyansh can offer some suggestions. As they are experts on Neuropype and the tutorial was written by Rakesh.
William
Hi! I try a basic Neuropype LSL input with all configurations in LSL input ( check Enable diagnostics, Proc clocksync.. etc)

I get the same error
In Neuropype I see active LSL

I don't know that more modify.
Thanks!
I follow the guide at "https://docs.openbci.com/Examples/EEGProjects/MotorImagery/",but when running the"SimpleMotorImagery.pyp",it went wrong and keep popping the"CSP must be trained before it can be used" ERROR.
How should I do to fix this error?
@zealor187, hi.
I merged your new thread into this existing thread on the same topic. Please read the previous comments and solutions.
William
thank you sir
my error is because I want to make 4 classification task.I change the"motorimag_calibrate.py"script's label(in the line15) and makers(in the line 16) from 2 element list into 4 element list,and change some parameter and node in the pipeline designer.


I move the "motorimag_calibrate.py" script to the desktop because it is unchangeable in the original directory.
and another problem is that the "lab recorder" didn't show the Marker stream.
when I'm doing the 2 classification task, it can run,but still have the error "No non empty chunks with only_signals set to False found!" occur,and other error is: 1. ip 127.0.0.1 access denied; 2."Pipeline execution status" shows that "Calibrating" is False; 3.The Classification plot seems do not response to my real-time Motor Imagery.


I suggest you email Rakesh directly, and report his answer back here. His email is rakeshbci01 at gmail.com. He is the author of the tutorial. Not sure why he is not seeing the @Rakeshbci mentions.
Greetings. I'm following the motor imagery tutorial on the website using Neuropype and Cyton via this link: https://docs.openbci.com/Examples/EEGProjects/MotorImagery/. The EEG and the LSL stream seem to be recognized by the lab recorder and the motorimag_calib.py. I followed the tutorial step-by-step, from changing the CSP parameters to removing and replacing the required nodes. Yet after finishing the 10-minute training, and lab recording, I tried to start my pipeline and got the following error on my Neuropype log:
graph loading graph structure
graph saving graph structure
graph loading graph structure
graph saving graph structure
execution started
execution resuming
Resolving data stream (name='obci_eeg1')
Importing XDF file Jan132023CSPTraining1LeftRightArm.xdf
Imported file Jan132023CSPTraining1LeftRightArm.xdf.
Imported file Jan132023CSPTraining1LeftRightArm.xdf.
Applying FIR filter...
CSP model is training now...
The following error occurred in node Common Spatial Patterns: Could not solve CSP problem. Your data might be rank deficient (e.g., not enough trials or electrically bridged channels). Try the FilterBankCommonSpatialPattern node with non-zero shrinkage.
LSL: Data stream obci_eeg1 acquired.
No non-empty chunks with only_signals set to False found!
CSP must be trained before it can be used
CSP must be trained before it can be used
CSP must be trained before it can be used
CSP must be trained before it can be used (statement loops)
I'm wondering what the issue could be, and I'm hoping that some of you may have an idea of what I'm currently encountering. I posted some additional images as a reference.

Thank you for taking the time to read my post.
Hi @Januz,
I've merged your new thread into this existing thread on the same subject. See some of the previous comments.
In previous comments I have attempted several times to get a response from the tutorial author, Rakesh Jakati, @Rakeshbci. He has another username on this Forum also as @rakeshbci01. Neither of these has used the Forum since December 2021, according to our logs.
He has not responded to users of his tutorial having issues. Here is his LinkedIn, perhaps you can try to contact him through that. Although in the past I've also messaged him there with no response.
https://www.linkedin.com/in/rakesh-bci696933/
I might suggest to Richard @retiutut, Eva @evaesteban or @Shirley that if users of Jakesh's tutorial are frequently stumped and cannot get a response from Rakesh, that this tutorial be labeled with a warning or deprecated so that OpenBCI users are not denied support with this tutorial.
William
Greetings, @Doc_Slater can you please send me the .xdf Calibration data coming from @rakeshbci01? I already asked him but it seems that he is busy at the moment. I could compare Mr. Rakesh's calibration data file to mine, and per event using Inspect Data node, which would greatly help in troubleshooting and narrowing down the issue that I'm currently facing. Thanks!
Update: The folks at Neuropype told me to use the Select Range node to eliminate any unused channels that might interfere with the CSP ML model and it worked.
@Januz, thanks so much(!)
An issue exists on our Github, for this deficiency in the tutorial document.
https://github.com/OpenBCI/Documentation/issues/139
Can you please add some comments on what you would delete / add to the current tutorial, so that future users do not hit the same roadblocks. Make it as clear as possible.
Here is the comment from @Januz regarding his NeuroPype debugging and fixes.
https://github.com/OpenBCI/Documentation/issues/139#issuecomment-1497312406
Hi, I'm trying motor imagery tutorial.


My Headset has only 8 channels. So I don't need to select range.
But there are many errors after calibration.
Could you help me? Or please teach me how to use motor imagery with other software.
Thank you.
@Fuyuki, can I see your Streaming Bar Plot Node Window? Mine's looking like this, and I haven't encountered that specific error.
However, even if my pipeline does not output errors anymore, it still doesn't classify correctly. I'm wondering if the issue stems from the calibration process, the pipeline itself, equipment misusage, or even hardware issues, and I'm yet to pin it down. Most likely, I'll post a separate query to confirm that.
Greetings,
I am currently working on the Motor Imagery Tutorial and when entering the Lab Recorder Part, i can't run the motorimag_calibrate.py file to access the MotorImag Marker stream. Can anybody help here? When trying to run the motorimag_calibrate.py by double clicking, nothing happens. Running it in miniconda leads to the following:
Kind regards,
Florian
Hey guys, I am also following the tutorial for motor imagery, does anyone know where to find the file called: motorimg_calibrate.py ?