Last week was successful. I was able to run PCA to decrease the dimensionality of the sensor data, covariance matrix, and forward matrix. This reduced dimension data is able to run through the connectivity model smoothly. I was also able to take a list of cortical labels from the user, which informs the model which cortical regions the functional connectivity should be measured. I implemented a graphing tool in order to plot the connectivity values between the chosen cortical regions over time. This week I am attending a research conference. Once I return, I will ensure the code is aligned with MNE-Python's formatting guidelines and work to publish it.
My changes last week had to be restored - in an attempt to have the user only interface with the minimum amount of functions, I hid some functions within other processes. However, the further I got in building my script for measuring functional connectivity, the more I needed variables that were hidden in other functions. So I restored my program to a previous version where all the variables I needed were available within the script, and did not require going into any other functions. My plan is to get the script working with all of the functions/variables needed to initiate the model within this script, and once things are working smoothly, I can shift things (with some guidance from mentorship) such that the user is interacting with as few functions/variables as possible. I was able to process the sample data successfully so that the model for functional connectivity could be initialized, and the algorithm could be ran so that the connectivity measurements could be made. However, the algorithm fitting the connectivity measurements is currently crashing python. I plan to take two steps that should fix this problem this week: 1) Perform PCA on the sensor data so that the algorithm performs on fewer dimensions. 2) Select regions of interest to perform the analysis on such that connectivity is only measured for user selected cortical regions.
Over the past week I was able to fix the issue I was facing with the sample dataset, by using MNE's functions to load a forward matrix from the sample data, instead of computing the matrix from the data myself. Then I was able to move some functions around so that the user only interfaces with the functions they absolutely need for working with their data. Next steps will be to test out MNE functions to see if some of my pre processing steps can be replaced. I did not hit any severe obstacles last week.
During my first week in GSoC, I started to build a simple script that utilized the tools I've used to measure functional connectivity in my research. The challenge in building this script is that its goal is to utilize example data that MNE-Python uses in their examples and tutorials. In my first attempts, it was clear that the structure of the sample data is different from the data I've used for my research (in terms of the number of sensors, how bad channels are disregarded, and the use of data in both left and right hemispheres). I left off last week deciding that I needed to use a different, more visual based tool to understand the sample data so that I can manipulate the structure to fit into my connectivity model.
I've received lots of feedback in the first draft of this script and I see that over the next week, in addition to changing the example data structure to fit my model, I will need to change variable and function names to be aligned with MNE-Python's coding format. Outside of preferred naming format, I am learning that my scripts that will serve as tutorials for MNE-Connectivity will need to give the minimal amount of information to the users for them to navigate the tools, and that functions not important to the use should be hidden in the backend as to not overstimulate the user.
Over the last few weeks I have gotten acquainted with the MNE-Python subgroup by joining their Discord, following the contribution guide to make my first pull request, and starting an API proposal on what methods I will implement over the next several weeks. This week I plan to begin packaging a toolbox used for measuring functional connectivity in a format compatible using a coding style aligned with other MNE-Python functionality. In working on my first pull request, I chose to add a feature to the mne-qt-browser, used to display neuroimaging data over time. I got stuck in figuring out what part of the code needed to be modified to add this new feature. So I chose to edit the same function using a matplotlib backend which was more familiar and easier to navigate.