Articles on marsipu's Bloghttps://blogs.python-gsoc.orgUpdates on different articles published on marsipu's BlogenSun, 22 Aug 2021 20:15:35 +0000Blog Week 11 (16.08.-20.08.)https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-11-16-08-20-08/<h2>What did I do this week?</h2> <p>During this week I worked on left features, adapting the pyqtgraph-backend to tests and fixing remaining bugs. I also wrapped up GSoC by writing a <a href="https://github.com/marsipu/gsoc2021/blob/main/FINAL_REPORT.md">final report</a>. There you can also find instructions on how to test the new backend. I opened a <a href="https://github.com/mne-tools/mne-python/pull/9687">WIP-PR</a> for my mentors to review my work on the new backend. There are still things to do left, which I listed in <a href="https://github.com/mne-tools/mne-python/issues/9686">this issue</a>. And finally I completed the final GSoC-Evaluation.</p> <h2>Where did I get stuck?</h2> <p>At the beginning of the week I really got stuck with implementing fake clicks for pyqtgraph, which are then used by several tests. I had to try a lot and consulted my mentors often until I luckily finally could get it to work never the less.</p> <h2>Thank you!</h2> <p>Since this was my last official week of Google Summer of Code, I will no longer blog here. But you can still reach me via <a href="mailto:dev@earthman-music.de">dev@earthman-music.de</a> if you got questions or ideas regarding the new pyqtgraph-backend or other related topics. It was a great experience for me to work on such a project full time before I start my clinical elective next year. I hope that the new backend facilitates the step of data-preprocessing of MEG/EEG-Data for the <a href="https://mne.tools/stable/index.html">MNE-Python</a>-Users. Thank you to the pyqtgraph-developers who with their package facilitated accomplishing my project-goals a lot. And a lot of thanks to my mentors, who were always in reach and provided help and feedback wherever they could.</p> <p>So long, see you on GitHub:)</p>beetlejuice920@gmail.com (marsipu)Sun, 22 Aug 2021 20:15:35 +0000https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-11-16-08-20-08/Weekly Check-In Week 10 (09.08.-13.08.)https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-10-09-08-13-08/<div class="lead"> <div class="lead"> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model cms-plugin-aldryn_newsblog-article-lead_in-1076">What did I do this week?</h2> <p>After having finished refactoring most of the refactoring of the matplotlib-backend, this <a href="https://github.com/mne-tools/mne-python/pull/9596">PR</a> could now be merged into MNE-Python. When I started on prototyping with pyqtgraph, I build my own framework for loading and processing data and forwarding parameters into the prototype for visualization. This week I worked a lot on adapting the pyqtgraph-prototype to the framework mne-python provides. Furthermore I noticed, that performance is heavily depending on wether the data is already preloaded in memory. But this can be limiting for large datasets or devices with little amount of RAM. We therefore thought about having a separate thread for loading the data only up to a given range around the visible range.</p> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model cms-plugin-aldryn_newsblog-article-lead_in-1076">What is coming up next?</h2> <p>To integrate the pyqtgraph-backend into mne-python, a lot of tests still need to be adapated. And there are some features from the current matplotlib backend missing. When the former is done, we will start then a PR for the first integration of the pyqtgraph-backend as an experimental features.</p> </div> </div>beetlejuice920@gmail.com (marsipu)Sun, 15 Aug 2021 14:39:49 +0000https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-10-09-08-13-08/Blog Week 9 (02.08.-06.08.)https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-9-02-08-06-08/<h2>What has been done?</h2> <p>The biggest part of the week was taken again by the refactoring of the existing matplotlib-backend inside MNE-Python. I discussed the changes with my mentors on the <a href="https://github.com/mne-tools/mne-python/pull/9596">Pull-Request</a> and implemented their feedback. Now we are at a point, where we probably can merge this first PR soon to pave the way for the next PR with the integration of the pyqtgraph-backend.</p> <h2>What is coming next?</h2> <p>Now that the refactoring is mostly done I will focus again on the pyqtgraph-backend and its adaption to the parent-class <em>BrowserBase</em> which will be inherited by both backends. Furthermore there need to be new methods to test the pyqtgraph-backend (mouse/keyboard-interaction), which may be solved with <a href="https://pytest-qt.readthedocs.io/en/latest/intro.html">pytest-qt</a>.</p>beetlejuice920@gmail.com (marsipu)Fri, 06 Aug 2021 13:23:02 +0000https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-9-02-08-06-08/Weekly Check-In Week 8 (26.07.-30.07.)https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-8-26-07-30-07/<div class="lead"> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model cms-plugin-aldryn_newsblog-article-lead_in-1076">What did I do this week?</h2> <p>As last week this week was about refactoring the existing matplotlib-backend into a new BrowserBase-Class. This time the main-focus was the refactoring of the tests. This included reorganizing the data-import, adding abstract-methods for interaction and adjusting the backend-selection to a get/set/use scheme.<br>To fix the problem that lines looked different when OpenGL was activated, I opened a PR for pyqtgraph.</p> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model cms-plugin-aldryn_newsblog-article-lead_in-1076">What is coming up next?</h2> <p>After finishing the current PR about refactoring the matplotlib-backend, I will soon open a second PR for the integration of the new pyqtgraph-backend into MNE-Python. For this I have to first apply the changes I made to BrowserBase on to the PyQtGraph-Browser-Class and adapt the tests where necessary to make them pass with both possible backends.</p> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model cms-plugin-aldryn_newsblog-article-lead_in-1076">Did you get stuck anywhere?</h2> <p>I had some questions about how to refactor the tests (and what pytest-fixtures would have to do with that) which could be resolved by my mentors.</p> </div>beetlejuice920@gmail.com (marsipu)Fri, 30 Jul 2021 12:20:09 +0000https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-8-26-07-30-07/Blog Week 7 (19.07.-23.07.)https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-7-19-07-23-07/<h2>A week of Refactoring</h2> <p>During the last week I focused on refactoring the backend-independent methods of the <a href="https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.plot">matplotlib-backend</a> already implemented in MNE-Python into a new parent-class called BrowserBase. This shall facilitate the side-by-side integration of the new pyqtgraph-backend and avoid duplication of those methods which can be used similiary for both backends (as preparing/preprocessing the data, processing the parameters, etc.).</p> <h2>Next week</h2> <p>I am currently working on refactoring the tests in the same manner so that the pyqtgraph-tests can be integrated into the already existing tests. Afterwards I will start with adjusting the pyqtgraph-prototyp, which until now relies on provisional data-preparation, to BrowserBase.</p>beetlejuice920@gmail.com (marsipu)Mon, 26 Jul 2021 09:50:10 +0000https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-7-19-07-23-07/Weekly Check-In Week 6 (12.06.-16.07.)https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-6-12-06-16-07/<h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model">What did I do this week?</h2> <p>During this week I mainly fixed bugs (scrolling, annotations, benchmarks). Some new features included a downsampling-test and channel-colors. As my mentors suggested to refactor the existing matplotlib-backend into a subclass inheriting from an abstract base-class for plotting I read more into the structure of the matplotlib-backend and equivalent backends of MNE-Python.</p> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model">What is coming up next?</h2> <p>Displaying Epochs is the biggest feature which is still left, so this will be next. The way how epochs-data is handled before display is already implemented in the matplotlib-backend so I will probably benefit from implementing the epochs-display in pyqtgraph while refactoring the epoch-handling methods from the matplotlib-backend.</p> <h2 class="cms-plugin cms-plugin-aldryn_newsblog-article-lead_in-1002 cms-render-model">Did you get stuck anywhere?</h2> <p>At first I struggled a bit on defining what of the existing matplotlib-backend should be refactored and moved into an abstract class, but this could be overcome by consulting my mentors. The refactoring probably will be a side-by-side task now where I refactor the data-management-methods when I need them in the pyqtgraph-backend.</p>beetlejuice920@gmail.com (marsipu)Fri, 16 Jul 2021 10:57:59 +0000https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-6-12-06-16-07/Blog Week 5 (05.07.-09.07.)https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-5-05-07-09-07/<h2>What did I work on this week?</h2> <p>I worked on the implementation and improvement of features as the mouse-interaction and the annotation-management. There also were still some bugs which appeared during vertical scrolling (lines getting added/removed when they shouldn't) and which were a bit hard to track. To simplify the bug-tracking, I simplified the dynamic loading of lines. With the annotation-manager, I finished a feature which is partly inspired by <a href="https://github.com/cbrnr/sigviewer">SigViewer</a>.</p> <h2>Benchmarks</h2> <p>As the performance can still be improved, I ran some benchmarks for the horizontal scrolling to compare different methods of downsampling. With the <a href="https://github.com/marsipu/gsoc2021/commit/d7f17ff0b7a9bb448ba9175b3900fa9ec3c140e0">current version</a> I found:</p> <ul> <li>applying downsampling in chunks decreases performance</li> <li>the "peak"-downsampling-method from pyqtgraph decreases performance compared to no downsampling</li> </ul> <p>I am still working on ways to improve performance. One way is to activate OpenGL, which improves perfomance a lot. On Windows this may come with future problems, because it only works with an older pyqtgraph-version at the moment.</p> <h2>What comes next?</h2> <p>There are still <a href="https://github.com/marsipu/gsoc2021/blob/main/TODO.md">features</a> left to be implemented before I can open the first PR for an integration into the main-branch of MNE-Python which I will work on. Besides that my mentors advised me to refactor the existing matplotlib-classes to make a side-by-side implementation of both backends more feasible.</p>beetlejuice920@gmail.com (marsipu)Sun, 11 Jul 2021 20:32:52 +0000https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-5-05-07-09-07/Weekly Check-In Week 4 (28.06.-02.07.)https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-4-28-06-02-07/<h2>What did I do this week?</h2> <p>During this week I mainly worked on the annotations-feature to mark regions for example for exclusion. I also adapted the methods from pyqtgraph for downsampling.</p> <h2>What is coming up next?</h2> <p>After a meeting with my mentors we still confirmed, that pyqtgraph would be the way to go for now and I updated the <a href="https://github.com/marsipu/gsoc2021/blob/main/TODO.md">ToDo-List</a> with all the features which still need to be implemented. As the basic functionality is mostly already working sufficiently we are aiming on integrating the first version of the pyqtgraph-RawBrowser into the MNE-Python development-branch soon.</p> <h2>Did you get stuck anywhere?</h2> <p>Not yet.</p>beetlejuice920@gmail.com (marsipu)Sun, 04 Jul 2021 19:03:47 +0000https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-4-28-06-02-07/Blog Week 3 (28.06.-02.07.)https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-3-28-06-02-07/<h2>What did I do this week?</h2> <p>I continued with implementing more features into the pyqtgraph-prototype (scrollbars, bad-channel-selection, keyboard-shortcuts) and I fixed several bugs. To investigate the differences in performance between the pyqtgraph-prototype and a barebone PyQt-Prototype I tried to implement the features from the pyqtgraph-prototype there too (see "Did I get stuck anywhere?"). And I recently contacted the community of pyqtgraph for some feedback on the prototype (and to thank them for their great work).</p> <h2>What is coming up next?</h2> <p>There are still features left, especially in terms of markers and the visualization of Epochs. In accordance with my mentors I will continue with implementing those features into the pyqtgraph-backend as this seems to be a viable option as the final backend.</p> <h2>Did I get stuck anywhere?</h2> <p>Working on the barebone PyQt-Prototype I encountered several challenges which haven't been present while I was working with pyqtgraph. For example I couldn't fit the lines to the view and when I tried shifting the visible lines, it resolved in weird artefacts. It was then more than ever that I realized how many problems are solved by pyqtgraph beforehand and as it took to much time to struggle with those problems I now switched back to working on the pyqtgraph-backend. The original performance problem (activating OpenGL for pyqtgraph) turned out to have a very simple solution so now the performance of the pyqtgraph-backend can be better regardless.</p>beetlejuice920@gmail.com (marsipu)Mon, 28 Jun 2021 16:33:16 +0000https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-3-28-06-02-07/Weekly Check-In Week 2 (14.06.-18.06.)https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-2-14-06-18-06/<h2>1. What did you do this week?</h2> <p>After having decided to continue improving the pyqtgraph-prototype during the first week, I worked on implementing more features from the current RawBrowser as scrolling vertically through the channels and customizing the axes. An improved benchmark-utility allows now for comparison between different parameter-sets to observe the influence of parameters on the performance.</p> <h2>2. What is coming up next?</h2> <p>As the performance already has reached a satisfying level I decided with my mentors to focus on implementing the remaining features to see if everything is feasible with the pyqtgraph-backend.</p> <h2>3. Did you get stuck?</h2> <p>Sometimes it took me a while do understand how something like e.g. the axes are implemented in pyqtgraph, but the more I read the pyqtgraph-source-code the easier it gets.</p>beetlejuice920@gmail.com (marsipu)Tue, 22 Jun 2021 07:22:33 +0000https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-week-2-14-06-18-06/Blog Week 1 (07.06.-12.06)https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-1-07-06-12-06/<p>To implement the features of the <a href="https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.plot">existing Raw-Visualization</a> and provide improved performance, Qt respectively <a href="https://riverbankcomputing.com/software/pyqt/">PyQt</a> was the backend-solution we pursued from the start. The <a href="https://doc.qt.io/qt-5/graphicsview.html">Graphics View Framework</a> from Qt provides the foundation for the required plotting-functionalities. Originally I thought I could read into the documentation of Qt alone and start with an (only) PyQt-based prototype from scratch. This turned out to be a big challenge, because there were various hurdles to overcome as how to setup the View, how to handle multiple Plot-Lines or how to setup axes. Thus on the second day I decided, in consultation with my mentors, to focus on the <a href="https://www.pyqtgraph.org/">pyqtgraph</a>-prototype which was planned to be setup during the second week for comparison. This turned out to be great, because by reading <a href="https://pyqtgraph.readthedocs.io/en/latest/">pyqtgraph's documentation</a> and it's <a href="https://github.com/pyqtgraph/pyqtgraph">source-code</a> I learned by example how a plotting-implementation in PyQt could be realized. The modularity of pyqtgraph and its well written code contributed significantly to my learning process (thanks and cudos <a href="https://github.com/pyqtgraph/pyqtgraph/graphs/contributors">@developers of pyqtgraph</a>). I even got quickly to a point where the pyqtgraph-prototype could foreshadow to some extent how the final implementation may look like. So this week my work will also by focused on further improving this prototype to set the groundwork for the final backend.</p>beetlejuice920@gmail.com (marsipu)Mon, 14 Jun 2021 19:37:53 +0000https://blogs.python-gsoc.org/en/marsipus-blog/blog-week-1-07-06-12-06/Weekly Check-In Community Bonding Period (17.05.-06.06)https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-community-bonding-period-17-05-06-06/<p><strong>Introduction</strong></p> <p>Dear Python/MNE-Community, I am Martin Schulz (marsipu) from Heidelberg (Germany) and I am a 6th year student of medicine. When starting my thesis about pinprick-evoked pain (MEG/EEG) three years ago, I got first in touch with MNE-Python &amp; Programming and benefited a lot from it since. Starting to contribute was an exciting “looking behind the curtain”-experience and therefore I am enthusiastic about the perspective of using this summer for full-time contribution.</p> <p>My project is about providing an additional backend for the visualization of Raw-data. It is supposed to offer higher performance (e.g. regarding scrolling &amp; scaling) and thus shall facilitate the analysis-step of signal inspection.</p> <p><strong>1. What did you do this week?</strong></p> <p>During the Community-Bonding-Period I met with my mentors and started to learn more about the current RawBrowser-Implementation by working on related issues (<a href="https://github.com/mne-tools/mne-python/pull/9412">#9412</a>, <a href="https://github.com/mne-tools/mne-python/pull/9414">#9414</a>, <a href="https://github.com/mne-tools/mne-python/pull/9419">#9419</a>, <a href="https://github.com/mne-tools/mne-python/pull/9444">#9444</a>). I also started reading into the documentation of some of the possible backend-alternatives (PyQt, pyqtgraph) and created my <a href="https://github.com/marsipu/gsoc2021">gsoc-repository</a> where prototypes and progress will be hosted.</p> <p><strong>2. What is coming up next?</strong></p> <p>This first week of coding will be all about expanding the existing (only)pyqt-based prototype to be comparable to the other possible backends (pyqtgraph, vtk). In the course of that I will also probably start to refactor the prototypes to make their comparision in a future benchmark-utility easier.</p> <p><strong>3. Did you get stuck anywhere?</strong></p> <p>Learning about how Qt handles custom plots took (and still takes) me longer than expected and some problems of <a href="https://github.com/mne-tools/mne-python/pull/9419">#9419</a> posed a challenge, but with the help of the other contributors/mentors those could be overcome.</p>beetlejuice920@gmail.com (marsipu)Mon, 07 Jun 2021 18:08:35 +0000https://blogs.python-gsoc.org/en/marsipus-blog/weekly-check-in-community-bonding-period-17-05-06-06/