Different PAC results between different BS versions

When I followed the "Time-resolved PAC estimation with tPAC" tutorial (https://neuroimage.usc.edu/brainstorm/Tutorials/TutPac), results from
Version: 08-Feb-2021 and Version: 25-Jul-2018 are different. The result from the old version looks similar to the web.

Is this a bug?


@Samiee @Sylvain?

It looks that the symptom came to appear from the commit on 25-Feb-2019 3efd6b0b57359bf8b03ef2d6e5ef60034941d65a.

At this commit, toolbox/math/bst_bandpass_hfilter.m was modified, that seems to be the direct cause.

Is it possible to keep maintenance of the tPAC?


Indeed, the filters were updated in February 2019:

The filter bank of the PAC analysis changed accordingly.
We did not consider maintaining the older version in the code, as we did not want to keep to versions of the filtering functions, because of the confusion it would bring in the interface and in the code.

If you want a strict reproduction of the old PAC results, you can use that older version of Brainstorm, but except for the strict reproducibility of published results, we don't recommend it.

Hi Francois,

Please recognized that the current tPAC does not estimate PAC well from the commit of 25-Feb-2019 until now. No peak appears at 0-10 sec from the synthesized data.

I compute again using the latest codes from Github and confirmed the results.

Screenshot 2021-06-20 123507


@Samiee @Sylvain
Could you describe exactly how you generate the signal for the tPAC section of the tutorial?

We need to include this for the exact reproducibility of the results that are illustrated.
Please send me the description, I will add it to the tutorial.

And could you check the results reported in this thread?


@Samiee @Sylvain
PS: The link at the end of the section does not work anymore: https://plotly.bic.mni.mcgill.ca/~ssamie4/1/
Should we update it or remove it?

Sorry for the late reply, Folks:
@wito: the absence of tPAC peak over 0-10s is indeed very strange. Would you mind posting a snapshot of the original time series, please?

@Francois: please remove the link to plotly.

Thank you!

Here you are.

Generate three PAC data using Simulate PAC signals (version 1.2)
signal duration: 10s
sampling: 1000.0 Hz
coupling intensity: 0.90
SN: 6.0 dB

w1 fP1 = 9 Hz, fA1 = 115 Hz, coupling phase: 270 degree
w2 fP2 = 13 Hz, fA2 = 145 Hz, coupling phase: 0 degree
w3 fP3 = 5 Hz, fA3 = 87 Hz, coupling phase: 180 degree

Export the data to Workspace
right-click on wave data / File / Export to Matlab
variable names are set as w1, w2, and w3.

Run the following script
waveData = (w2.Value + w3.Value)/2;
waveData = cat(2, w1.Value(1:10000), waveData(1:10001));

timeData = w1.Time + 10.0;
timeData = cat(2, w1.Time(1:10000), timeData(1:10001));

synthesized_pac = w1;
synthesized_pac.Value = waveData;
synthesized_pac.Time = timeData;
synthesized_pac.Comment = 'Simulated PAC';

Import synthesized_pac
right-click on the folder under the subject, select File / Import from Matlab

synthesized_pac.mat (208.3 KB)


Hi everyone,

Thanks a lot @wito for reporting this issue.

I have just seen the post. Sorry I was not much involved in maintaining PAC after this filter update. I think it could be a serious problem which needs close attention (not sure what changed there but would be great to double check everything related to this filter process). @Sylvain: could someone from the lab double check it please? Thank you!

Related issue on github:

Thank you. Sorry for the slow reply on this front. We're looking into this and will keep everyone posted on this thread, ASAP.

Proposed PR:

1 Like

The PR is now merged. You can update Brainstorm and try again.
The tPAC computation should now use the older implementation of the filters and produce exactly the same results as before, and as illustrated in the tutorials.

@Sylvain's team is now investigating why this change of filter implementation caused such important differences in the tPAC evaluation.

We have fixed the issues reported in this thread -- thank you for your kind patience and please update your Brainstorm version.
The results are now similar to those from the original documentation.
We have also added a new parameter that helps define the frequency resolution of the band of interest for the nested oscillations (frequency for amplitude). It can help refine the identification of the PAC modes in the data.
As before, the PAC time-frequency representations can be smoothed using the visualization panel.
Thank you again for reporting this issue!