Closed rb643 closed 7 years ago
I've updated it to save to a three-column CSV, with columns 1 & 2 being channel pairs, and column three being the connection strength.
I assume down the line we'll want to not average over all frequencies, which would make it a bit more complicated.
Nice! We should probably create an indexing object for the 5 frequency band and then just put everything into another loop to loop over those (while also updating the savename variable with the respective band.
So within that loop we would just run the connectivity and saving parts.
Also, not sure if it makes much difference for python i/o in what format things are saved. I just picked csv as we can load them in easily in matlab or R if we want, but we can also save into a pandas or numpy structure if that speeds things up later on.
I think csv is fast enough. The other option would be to use pickle
, but I think it makes sense to keep it accessible from R.
The frequency bands can actually be done automatically by the spectral_connectivity
function, should be easier than looping!
Maybe we should eventually store them as square/full connecivity matrices rather than sparse matrices? Depends a bit on how we want to run graph analysis I guess.
Just updated it to separately average over 4 frequency bands, which are stored as separate columns in the CSV file.
You can change the variable freqbands
if you want to change the start / stop for each band or add a new one :)
Might be useful to store the connectivity matrices in a numpy array and write them to a csv file for later use. This can then also be used to check if a subject has already been pre-processed.
I added this a little bit but need to dig into the output structure from the connectivity analysis a bit further... #