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

[WIP] Calculate PAC on evoked data #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexrockhill
Copy link
Contributor

Ok so after some experimenting and here is a very rough, not really working version of the code. I thought I would post this PR so that we could discuss briefly @TomDLT if you have time.

Basically, I tested using the example on simulated data that you already had made and PAC was really only recoverable above 10 but cleanly without frequency smearing above 20 seconds of simulated data. The data I want to compute PAC on is related to a task with trials on the order of ~5 second duration. Thus, I think maybe the only reliable option is to do a state-based analysis where large blocks of trials are considered. I thought I would ask you just in case you had any other ideas. (Also, this PR will probably be closed without merging but I just wanted you to see what I was thinking/trying).

@alexrockhill
Copy link
Contributor Author

alexrockhill commented May 11, 2020

Hey @TomDLT, I made some examples to show simulated evoked PAC and how many trials at what SNR and using what window are needed to recover the generative parameters. I was planning to do an exhaustive search using all possible epoch windows and then use cross-validation to quantify the likelihood of the result. If you're interested, I detailed it in the below presentation.

https://docs.google.com/presentation/d/135x2Ej4dMvCmlixRwotGNBuVTCVuaeuxF1Wda5FDlCI/edit?usp=sharing

I'm not sure if this PR should be merged, at least probably not until after I publish something using the methods, but I wanted to leave this here in case you were at all interested. And, if you wanted to weigh in on if parameterizing a gaussian or some kind of envelope such as in the second figure into the DAR model to determine the peak and std of the evoked signal would be something that could be done. My impression from your PLoS One and IEEE papers is that this would have to be done at the level above the DAR model or else it would be very complicated to translate into autoregressive parameters.

If this is something you don't have time to advise on, no worries at all, I just think this is a great tool and will make PRs to try and make my analyses more reproducible either way.

@TomDLT
Copy link
Member

TomDLT commented May 11, 2020

I don't have much time to look at the details, but this is definitely an interesting exploration. I don't think adding a layer of parameterization in the DAR model is easy, and I would recommend adding it at the level above the DAR model, as you said. A search over epoch windows using cross-validation to quantify the likelihood of the result seems a reasonable approach. Keep in mind that PAC analysis involves filtering, which introduces edge artifacts at the start and end of the signals, so you should filter before cutting the time windows.

@alexrockhill
Copy link
Contributor Author

alexrockhill commented May 12, 2020

I don't have much time to look at the details, but this is definitely an interesting exploration. I don't think adding a layer of parameterization in the DAR model is easy, and I would recommend adding it at the level above the DAR model, as you said. A search over epoch windows using cross-validation to quantify the likelihood of the result seems a reasonable approach. Keep in mind that PAC analysis involves filtering, which introduces edge artifacts at the start and end of the signals, so you should filter before cutting the time windows.

Comodulogram.fit with raw_to_mask does the filtering correctly right?

Edit: looks like Comodulogram.fit worked as expected with the mask: no edge artifacts as far as I can tell since at 500 trials it's recovered even for the shortest window. Pushing changes also.
Figure3

@TomDLT
Copy link
Member

TomDLT commented May 12, 2020

I didn't see that you were using raw_to_mask, so it should do the filtering correctly yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants