lsl_archived icon indicating copy to clipboard operation
lsl_archived copied to clipboard

How to change output dimension of inlet.pull_sample()

Open nsinnigen opened this issue 6 years ago • 5 comments

When I call "inlet.pull_sample()" it outputs a 1x63 matrix (EEGData). How can I change the EEGData output from 63x1 to 63x1 without transposing the matrix EEGData? I couldn't fine the code line where this might be possible.

nsinnigen avatar Sep 25 '18 14:09 nsinnigen

Are you using the Python wrapper?

Can you explain more about what you are trying to do with the data and why transpose is inappropriate in your case? For a matrix where one of the dimensions is 1, the transpose operation is very fast (100 nsec on my computer).

cboulay avatar Sep 25 '18 17:09 cboulay

I am using lsl with matlab to correct EEG data in real time. An EEG data set is simulated using Brainvision Recorder and sent to Matlab. All the functions I wrote are based on 63x1 dimension. On my computer transpose operation is quite fast as well (about 16µs). I just wanted to avoid any unnecessary calculation steps. But if it's too much effort to change the dimension of the outcome, then I'll just stick to transpose. I just thought there might be a simple solution.

Btw, thanks for working on labstreaminglayer. It helped me a lot and saved me probably hundreds of working hours!

nsinnigen avatar Sep 26 '18 12:09 nsinnigen

For nx1 / 1xn-matrices the transpose operation is O(1), i.e. it takes the same time no matter how much data you have. If performance is a real problem, you could try pypy or write parts of your algorithm in C / C++.

tstenner avatar Sep 26 '18 13:09 tstenner

There is no option in LSL to change the transposition of data.

Also, just a comment, if you are using the RDA server in Recorder, you are already incurring a 40-60ms latency. It is much faster to stream data directly from one of the LSL connectors (all Brain Products amplifiers are supported) but, then you lose the ability to simultaneously record with Recorder.

On 26.09.2018 15:08, Tristan Stenner wrote:

For nx1 / 1xn-matrices the transpose operation is O(1), i.e. it takes the same time no matter how much data you have. If performance is a real problem, you could try pypy or write parts of your algorithm in C / C++.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sccn/labstreaminglayer/issues/347#issuecomment-424708507, or mute the thread https://github.com/notifications/unsubscribe-auth/ADch7uPOVS4S5deirLAt1vZbzNakA1W7ks5ue3xcgaJpZM4W4zUT.

dmedine avatar Sep 26 '18 14:09 dmedine

At the beginning I used Brain Product's "Remote Data access" to stream data directly from Brainvision Recorder to Matlab, but my code didn't work there, because there is no option to buffer data. The processing time is a bit larger than the acquisition time, so it's rather near real-time. That's why I thought it's a good idea to use labstreaminglayer since this enables me to use a buffer.

Or are there any other options to perform near real-time correction using matlab? (I am quite a newbie to the topic)

nsinnigen avatar Sep 26 '18 14:09 nsinnigen