Open choldgraf opened 8 years ago
I think it'd be great to add to pacpy! This new function would definitely be an improvement to the current 'comodulogram' function that currently repeats filtering and also doesn't have these nice visualizations.
The visualizations are pretty simple to implement, and I don't think they'd need to be part of a PR. The benefit of the function is that it can output PAC as an array of shape (n_pac_metrics, n_epochs, n_channel_pairs, n_frequency_pairs, n_time_windows) so that you can then slice and dice the output however you like :)
True. Yeah, I think this will be good to provide that functionality for people analyzing trial data sets with many simultaneous recordings.
@parenthetical-e what do you think? I believe you were the most hesitant to start adding extra functionality to pacpy (which I think has reasonable arguments behind it). IMO this is a close-enough extension to the functionality that's already there, so doesn't deviate too much from the overall goal of pacpy. What do you think?
I am all for adding the ability to work with trials and 2-d arrays of data, but am very much against the making a monolithic function like,
phase_amplitude_coupling(..., method='plv')
Something like,
from pacpy.pac import plv
trials(lo, hi, f_lo, f_hi, trial_index, pacfn=plv)
channels(X, f_lo, f_hi, lo_index, high_index, pacfn=plv) # where X is 2d
trials_and_channels(X, f_lo, f_hi, trial_index, lo_index, high_index, pacfn=plv)
is in the spirit of the pacpy
interface, maintaining the semi-functional and transparent implementation I've tried hard to imbue. In sum, I'd much rather pass simple functions than flags. I'd be happy to adapt what you've got to this kind of interface, and help in wrapping that up for mne
. Is that a workable/useful/interesting compromise?
As for plotting routines, I'm neutral. As long as your functions return easily plot-able things, explicit routines seem to me to be unneeded. But peoplenotme seem to like them, so sure. Why not?
(Sorry. Had no intent to close this. I've thumb hands.)
@parenthetical-e I think I'm +1 to that, but let's chat about implementation etc. The reason that I've got all those flags is because I'm assuming that the input to the function is always the same type (channels x time) and it always does the filtering on that data first, before it does any slicing and dicing. That's why I don't have, e.g., an extra function for trials-shaped data. (and why this one is kind of a mammoth)
if you wanna skype and chat about the function etc, then I'm down for that. Only catch is that I'll be out of communication from Thursday to ~Tuesday (I'll be in Yellowstone hanging out with elks and stuff :D )
Let's just chat when you get back. Thursday the 9th? 10:30 AM?
wellllll, I might be leaving for knight lab camping on Thursday the 9th, so wednesday would be better for me if that works for you.
On Tue, May 31, 2016 at 3:57 PM, Erik notifications@github.com wrote:
Let's just chat when you get back. Thursday the 9th? 10:30 AM?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/voytekresearch/pacpy/issues/45#issuecomment-222846081, or mute the thread https://github.com/notifications/unsubscribe/ABwSHfeb3ZaHWdfOlnuGnFdMYKWitKgWks5qHLzVgaJpZM4Iq3iY .
Sure. 10 AM ok?
Sounds good to me, Wed June 8th, 10AM.
On Tue, May 31, 2016 at 3:58 PM, Erik notifications@github.com wrote:
Sure. 10 AM ok?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/voytekresearch/pacpy/issues/45#issuecomment-222846322, or mute the thread https://github.com/notifications/unsubscribe/ABwSHbpRcGI128I--E-lJkhHwyMNQaYcks5qHL0sgaJpZM4Iq3iY .
Works for me too
Cools.
On May 31, 2016, at 4:01 PM, Chris Holdgraf notifications@github.com wrote:
Sounds good to me, Wed June 8th, 10AM.
On Tue, May 31, 2016 at 3:58 PM, Erik notifications@github.com wrote:
Sure. 10 AM ok?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/voytekresearch/pacpy/issues/45#issuecomment-222846322, or mute the thread https://github.com/notifications/unsubscribe/ABwSHbpRcGI128I--E-lJkhHwyMNQaYcks5qHL0sgaJpZM4Iq3iY .
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/voytekresearch/pacpy/issues/45#issuecomment-222846692, or mute the thread https://github.com/notifications/unsubscribe/ABIxh2dqXRSk2r55OMLHJcoyJBxwzjM-ks5qHL20gaJpZM4Iq3iY.
Hey guys - I just realized that I had already opened this. Let's discuss integrating PAC efficiency etc into pacpy here.
Hey folks - I've got a PR right now in the MNE-sandbox repo, which adds a high-level function to do a bunch of PAC stuff between signals. It lets you:
It will then pre-filter the proper channels only one time per pair of low/high frequencies, so that we don't duplicate filtering etc.
You can also:
It will then calculate PAC using the metric of choice for each pair of channel indices, phase/amp frequencies, and tmin/tmax window. With the option of either calculating this per epoch, or concatenating across epochs first.
So this way, you could make PAC plots with this function like this:
Or like this:
Or do a connectivity plot w/ lots of pairs of electrodes.
In the PR we've been discussing whether it would make more sense to contribute this to PacPy, since there's a hidden function that's basically designed to not be specific for MNE objects, but instead operate on arrays. Would you all be interested in this? I'd be willing to take some time porting over the tests and the visualization functions (or whatever subset of that you're interested in). However I know that you guys generally want to keep this repo restricted to just the PAC metrics themselves.
LMKWYT. Pinging @srcole and @parenthetical-e in case you guys have thoughts ;)