[FieldTrip] DICS in fieldtrip: Hermitian vs not Hermitian spectral matrix computations - Multiple frequencies

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Sat Mar 29 13:11:05 CET 2025


Hi Enrico,

Nice that you dove into the code so deeply. With respect to your worries about computing the CSD-matrix from a matrix with Fourier coefficients as per the matlab syntax tmp*tmp’ I hope I can take these away by saying that the “ ‘ “ operator (the apostrophe) acutally DOES a complex conjugate transposition of the matrix. (as opposed to “ .’ “, i.e. a dot followed by an apostrophe, which is a ’normal’ transpose)

Regarding your second question: I am not sure whether I fully understand, but I assume that you mean to ask about applying previously computed spatial filters optimized for frequency band X, to data that quantifies frequency band Y (where Y is not contained by the frequency band X)? I follow your reasoning, but I would say that this is somewhat suboptimal, even indeed as you say that different frequency components might have the same (at least at the spatial resolution permitted by the measurement technique) neurobiological origins. The reason for this is that the idea that underlies the mathematics of the beamformers is not only that it aims to not distort activity originating from the current location of interest (i.e. the dipole source that you considering for a given iteration of the scanning loop across all potential dipole positions in your source model), but that it also aims at suppressing potentially distortive effects of uncorrelated sources outside the current location of interest. Thus, a spatial filter for a particular dipole location does not only reflect properties of the (possibly present) neural source at that location, but also implicitly reflects the other sources of the overall signal at frequency band X.

Best wishes,
Jan-Mathijs


On 27 Mar 2025, at 16:17, Enrico Sozza via fieldtrip <fieldtrip at science.ru.nl> wrote:

Hello FieldTrip community allies,

I come to seek your help in a field that goes way deeper than what my background allows me to understand, so forgive me beforehand if my questions come as no-sense or missing solid theoretical bases.

I am trying to source localize oscillatory EEG data through DICS beamforming and I came across some theoretical/methodological doubts that I couldn't clarify through the available documentation.

The first is related to the 'equivalence' of the output of ft_sourceanalysis with method DICS depending on what type of data you input: for what I read, it seems you can feed it with frequency data as output of ft_freqanalysis with either output 'fourier' or 'powandcsd' and expect the same computation.
Yet, after a deep dive into the functions, it seems that in ft_checkdata, with freq.fourierspctrm as input, computes just a symmetrical matrix (Cf, to be inverted later on) but not the Hermitan transpose with the complex conjugates (Actual CSD matrix), which seems to be critical for an adequate estimation of spectral properties and spatial relationship. So, I would say it is not actually the same, and I would say is mathematically 'invalid' (?).  If so, why is it implemented in FieldTrip? Why does it compute
data.fourierspctrm = reshape(data.fourierspctrm, [nrpt nchn nfrq*ntim]);
crsspctrm = complex(zeros(nchn,nchn,nfrq*ntim));
for k = 1:nfrq*ntim
tmp = transpose(data.fourierspctrm(:,:,k));
tmp(~isfinite(tmp)) = 0;
n = sum(tmp~=0,2);
crsspctrm(:,:,k) = tmp*tmp'./n(1);
end
instead of:

     crsspctrm(:,:,k) = tmp*conj(tmp')./n(1);

I guess manually changing the function it is somehow not suggested, otherwise it would have been coded as such since the beginning, but I am still left with quite a bit of uncertainty in such regard.




My other question is:
I know DICS is implemented to computing spatial filters tailored to a specific frequency, due to the process of averaging CSDs across trials before computing the inverse. Yet, I also saw that at the end with 'cfg.realfilter = yes' it only works with the real part of the matrix, keeping only the information regarding near zero-lag correlated signal and ignoring any phase-related relationship.
Keeping this into consideration, and assuming neurobiologically that activity ad different frequencies come from the same neural generators, would it be mathematically inappropriate or impossible to interpret to compute DICS feeding it with fft coefficients computed at different frequencies across trials? Again, bearing in mind that the goal is source localizing oscillatory activity (i.e., power) at those different frequencies in different trials, assuming they come from the same sources.



I am learning so much about this in-depth physics of signal processing and it's quite exciting, but my resources are quite limited, and I therefore would really value and appreciate any insight from you guys, hoping that I am not already blindingly hitting a wall.


Thank you very much in advance for the time you took to read this email and for your help.
Best of luck with your work
Regards

Enrico Sozza, PhD Student
Brainlab – Cognitive Neuroscience Research Group
Department of Clinical Psychology and Psychobiology
Institute of Neurosciences
University of Barcelona
P. Vall d'Hebron 171, 08035 Barcelona, Catalonia-Spain
Tel: +34 933 125 058 – Fax: +24 934 021 584
http://www.ub.edu/brainlab/team-post/enrico-sozza<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ub.edu%2Fbrainlab%2Fteam-post%2Fenrico-sozza&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C1a48a73609954ac565a008dd6ebac7e3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638788470672776528%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=PC%2F04UWyeoXikGF8GhX49gsGH18Lt7FG4GIlSSPgAZQ%3D&reserved=0>
http://www.neurociencies.ub.edu<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.neurociencies.ub.edu%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C1a48a73609954ac565a008dd6ebac7e3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638788470672791589%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=vEHzyy2AqMflVnakW4q5%2FSdGSWeL4v3nxZU6tjSFaTA%3D&reserved=0>


Aquest missatge, i els fitxers adjunts que hi pugui haver, pot contenir informació confidencial o protegida legalment i s’adreça exclusivament a la persona o entitat destinatària. Si no consteu com a destinatari final o no teniu l’encàrrec de rebre’l, no esteu autoritzat a llegir-lo, retenir-lo, modificar-lo, distribuir-lo, copiar-lo ni a revelar-ne el contingut. Si l’heu rebut per error, informeu-ne el remitent i elimineu del sistema tant el missatge com els fitxers adjunts que hi pugui haver.

Este mensaje, y los ficheros adjuntos que pueda incluir, puede contener información confidencial o legalmente protegida y está exclusivamente dirigido a la persona o entidad destinataria. Si usted no consta como destinatario final ni es la persona encargada de recibirlo, no está autorizado a leerlo, retenerlo, modificarlo, distribuirlo o copiarlo, ni a revelar su contenido. Si lo ha recibido por error, informe de ello al remitente y elimine del sistema tanto el mensaje como los ficheros adjuntos que pueda contener.

This email message and any attachments it carries may contain confidential or legally protected material and are intended solely for the individual or organization to whom they are addressed. If you are not the intended recipient of this message or the person responsible for processing it, then you are not authorized to read, save, modify, send, copy or disclose any part of it. If you have received the message by mistake, please inform the sender of this and eliminate the message and any attachments it carries from your account.

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C1a48a73609954ac565a008dd6ebac7e3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638788470672799822%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=prrxtObYLcDHcK6q%2F%2BwerEh5%2FvvwG4C%2FfdWaNzOZpAY%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C1a48a73609954ac565a008dd6ebac7e3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638788470672808053%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=XSLn%2Bx3P358JLqkrUdTeA%2F4nINJHzLPm4uyA5400xv8%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250329/67741217/attachment.htm>


More information about the fieldtrip mailing list