# [FieldTrip] Calculate activation time-course in sourcespace for ERF-data using ft_sourceanalysis

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri Jul 7 10:13:31 CEST 2017

```Dear Christian,

> pow = squeeze(sort(sum(cat(3,data_erf_source.avg.mom{:}).^2,1)))';    % i use the abs norm of the 3 orientation vectors as a value of source strength
> figure; ft_plot_mesh(sourcespace, 'vertexcolor', pow(:,time_of_interest));
>
> One other way to get the source distribution at that sample is to convolve the filter with the underlying erf-data:
>
> pow = squeeze(sort(sum(cat(3,data_erf_source.avg.filter{:}).^2,1)))';
> figure; ft_plot_mesh(sourcespace, 'vertexcolor', pow * data_cond_erf_bl_avg.avg(:,time_of_interest));
>
>
> But those to distributions look different. Not completely different, but substantially.

Well, let me first be a bit pedantic, by saying that one does not ‘convolve’ the filter with the underlying erf-data, it’s just a multiplication. But no worries, that’s just terminology.
The thing that goes wrong in your filter-times-erfdata step, is the fact that you already collapse the spatial filter across the three dipole orientations (and take the square), prior to doing the multiplication.

So the difference lies in the order of the operations, it should be sum((F*sensorERF).^2,1). In this case F is a single entry from source.avg.filter.

Best,
Jan-Mathijs

> Why are those two ways of calculating the source-distribution different. I thought that ft_sourceanalysis calculates the field 'mom' by basically convolving the erf_data with the spatial filter and therefore should result in the same distribution as the second version. What is the 'right' way in this case and what do you recommend I use.
>
> I thank you for your help.
>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

```