# Cross frequency coupling

**URL:** <https://mne.discourse.group/t/cross-frequency-coupling/9296>\
**Category:** Support & Discussions\
**Tags:** time-frequency, preprocessing, meg, eeg, visualization\
**Created:** [September 8, 2024, 10:42pm UTC](https://mne.discourse.group/t/cross-frequency-coupling/9296 "2024-09-08T22:42:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mouseresearch](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mouseresearch](https://mne.discourse.group/u/mouseresearch)\
**Post date:** [September 8, 2024, 10:42pm UTC](https://mne.discourse.group/t/cross-frequency-coupling/9296/1 "2024-09-08T22:42:38Z")

</div>

I am facing problem with calculating PAC(Phase Amplitude coupling). My Raw data structure is like this - 1 coloumn with multiple rows with no variable inside the datasets,( my data structure - ‘data’: array([[274.3722, 273.6554, 263.2611, …). I want to create 2 variable in the datasets like lfpHG and lfpHfo , like this lfpHG = bandpass\_filter(lfp, 30, 60, srate)  
lfpHFO = bandpass\_filter(lfp, 60, 150, srate) , my sampling rate is 3000 and total duration is 2120 seconds. I am doing this in Python and the goal is to compute # Phase-Amplitude comodulogram to observe blob between theta -gama (Amplitude of high frequency vs Phase of low frequency) between 8hz - 40 hz.

Let me know how can i do it properly.

Thanks

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [September 9, 2024, 12:19am UTC](https://mne.discourse.group/t/cross-frequency-coupling/9296/2 "2024-09-09T00:19:16Z")

</div>

Hi @mouseresearch

You will probably have an easier time using existing tools than you would if you roll your own implementation. Have you tried either of these packages?

- [GitHub - pactools/pactools: Phase-amplitude coupling (PAC) toolbox](https://github.com/pactools/pactools)
- [GitHub - EtienneCmb/tensorpac: Phase-Amplitude Coupling under Python](https://github.com/EtienneCmb/tensorpac)

---

<div class="post-metadata">

**Author:** ![mouseresearch](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mouseresearch](https://mne.discourse.group/u/mouseresearch)\
**Post date:** [September 9, 2024, 12:34am UTC](https://mne.discourse.group/t/cross-frequency-coupling/9296/3 "2024-09-09T00:34:23Z")

</div>

Any idea how I can start ?

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [September 9, 2024, 3:46pm UTC](https://mne.discourse.group/t/cross-frequency-coupling/9296/4 "2024-09-09T15:46:09Z")

</div>

Hi @mouseresearch

Please have a look at their tutorials:

- [https://pactools.github.io](https://pactools.github.io)
- [Tensorpac — Tensorpac 0.6.5 documentation](https://etiennecmb.github.io/tensorpac/)
