[FieldTrip] Resampling error + General question on resampling vs single precision

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Fri Feb 3 16:38:23 CET 2023


Hi Yasir,

The motivation for using ft_resampledata is not clear to me, neither is it clear how you actually called the function (cfg details etc).
Have you tried diagnosing this a bit more yourself, by specifying a breakpoint in the code, or by using the ‘dbstop if error’ command?
Given the information provided there is not much to say at the moment.

With respect to your second quesion: it depends…

Some computations to be accurate require double precision representation in memory.

If you downsample too  much, you might lose temporal detail.

Good luck
Jan-Mathijs


On 2 Feb 2023, at 18:56, Yasir Çatal via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello FieldTrip community,

When I run ft_resampledata, I get the following error:

Error using signal.internal.resample.nonUniformParser>getSamples
The number of elements of Tx must match the number of rows of X when X is a matrix
Error in signal.internal.resample.nonUniformParser (line 23)
[x, tx] = getSamples(xIn,tx1,Dim);
Error in resample>nonUniformResample (line 268)
[x, tx, tGrid, fs, p, q] = signal.internal.resample.nonUniformParser(isDimValSet,Dim,m,xIn,varargin{:});
Error in resample (line 214)
            nonUniformResample(isDimValSet,Dim, m, method1, dimIn, xIn, ...
Error in ft_resampledata (line 253)
        newdat = transpose(resample(transpose(olddat),fsres,fsorig));

I searched the mailing list and found a similar error from another user: [FieldTrip] Errors with downsampling and artifact rejection (ru.nl)<https://mailman.science.ru.nl/pipermail/fieldtrip/2020-June/040130.html>

The solution for him was using an integer division of the original sampling rate (1000 -> 250 or 200). However, my data has a sampling rate of  508.6275 (HCP-MEG data, rmegpreproc output) which I'm afraid doesn't have a nice integer division. I tried with a couple of different cfg.resamplerefs but none of them worked.

My second question is a more general one. For memory-efficient processing, which one is a better option: using single data type or downsampling but keeping it double precision.

Thanks,
Yasir


_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6QuchDjlTP1en2wbDVO-tCS33xH_IKoYp8GFfJ7E2RLCnqX7t13ucFwg1Qn_8OnacoX5c_pGDhnqVIJLVc57Ck6zxNONnq_mTiCWNA$

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


More information about the fieldtrip mailing list