Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display datasets in a consistent window #188

Closed
d3-worgan opened this issue Nov 15, 2020 · 6 comments
Closed

Display datasets in a consistent window #188

d3-worgan opened this issue Nov 15, 2020 · 6 comments

Comments

@d3-worgan
Copy link

Hi,

Thanks for making this repo public, mnelab is great and provides a lot of the features we're looking for.

For our application, it would be great if we could display each new dataset into the same window. For example, at the moment:

  1. We load a .edf file
  2. We click the plot/ display button and an EEG graph pops up in a new Figure window.
  3. After viewing the data we decide to add a filter.
  4. After the filter, a new dataset appears in the sidebar.
  5. We click the display / plot button for the new dataset and it pops up in its new own seperate figure window.

We want step 5 to load the new dataset into the exisiting window for the first dataset, and preferably preserve the zoom and scrolling positions.

Can we do that in mne-lab already and have I missed a button? Otherwise is this a feature that has been considered or something that would be considered? Are there any ideas or suggestions on the best way to do this? It looks like the ideal approach is to add a main Figure window in the main window class? And then somehow replace the axes with the new dataset plot when we make a new dataset?

Hope that makes sense. Please someone let me know their thoughts.

Thanks!

@cbrnr
Copy link
Owner

cbrnr commented Nov 17, 2020

This is loosely related to #175. I agree that in addition a "copy & paste" plot settings feature would be useful. Which parameters would you like to be able to set? Visible time range, visible channels, and scalings?

I'm not sure what the best way to implement this feature is. Maybe MNELAB should remember the plot settings and just apply them to all newly created figures? And if this is not possible (e.g. if the time range doesn't exist) then the defaults could be used. I'll think about this some more - if you have suggestions please feel free to share them here!

@d3-worgan
Copy link
Author

Yes I think those parameters would work, and it looks like 175 is along the same lines. The other idea we are exploring, rather than displaying a new Figure each time and copying the parameters, we would use the existing figure and update the graph with the new dataset values; using methods like set_ydata(). When a new dataset is created by using something like a filter or dropping channels, we then clear the items in the axes, and replot them with the new data. Although maybe at that point we might as well write our own plotting function, and since we're using Qt we'd be better off using a native graph tool like Qt Charts. Maybe?

@cbrnr
Copy link
Owner

cbrnr commented Nov 18, 2020

Yes, it is probably better if you implement your alternative idea with Qt, because this use case is a bit too far away from what MNE offers. However, maybe MNELAB could have a second "plot data" option (e.g. "plot data in existing figure" or something along these lines), but I think this will make things complicated. It's probably easier to support some configuration settings and try to restore/reuse figure parameters whenever possible.

@d3-worgan
Copy link
Author

Okay yes I think so too. I'll have a look and let you know how I get on. Thanks

@d3-worgan
Copy link
Author

Hi,

An update on how I got on.

I searched the MNE source code for options for updating in the same window. I spoke to developers involved in MNE as well as developers involved in matplotlib. The conclusion I came to was that this is possible but as stated by matplotlib there is too much coupling and background action to do it cleanly. Also, matplotlib is mixed and further buried in private attributes and methods in MNE making it even worse...

I did start plotting my own EEG graphs using pyqtgraph but hit some issues with speed. There were some obvious options to achieve a faster application but it looked like there was a lot extra work we dont have time for.

In the end we settled with EDFBrowser, which is an EDF analyser written in C/C++. It does everything we need and is super fast. Its a shame we couldnt use python. Maybe we'll look into using pyqtgraph again in the future but might take some time to get right.

@cbrnr
Copy link
Owner

cbrnr commented Dec 28, 2020

Alright, thanks for the update! EDFbrowser is nice, I'm glad that it works for you. I will still keep your use case in mind and probably add something to remember raw plot settings with #175. I'm closing this issue now, but feel free to either post any comments here or in a new issue.

@cbrnr cbrnr closed this as completed Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants