Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior of tutorial and code #669

Closed
suxpert opened this issue Feb 24, 2018 · 4 comments
Closed

Inconsistent behavior of tutorial and code #669

suxpert opened this issue Feb 24, 2018 · 4 comments
Labels

Comments

@suxpert
Copy link

suxpert commented Feb 24, 2018

It seems that the tutorials and examples here are not consistent with the newest code. For example, I've tried to plot some ERPs with:

cfg.parameter = 'avg';

Then ft_singleplotER will complain that:

selecting these fields that have repetitions: trial
removing these fields that do not have repetitions: avg, dof, var
error using getdimord (line 19)
field "avg" not present in data

Then I found that, although ft_timelockanalysis returns the avg et al., if I need to perform baseline correction using ft_timelockbaseline, these fields will be removed. What's more, ft_singleplotER will remove them too. So why did ft_timelockanalysis calculate such useless fields?

I'm so confused about this, it seems that the order should be (according to tutorial):

  1. ft_preprocessing, segmentation,
  2. ft_timelockanalysis, calculate average et al.
  3. ft_timelockbaseline, remove average et al., without calculate average,
  4. ft_singleplotER, remove average et al. if exist, re-calculate and plot.

But results from ft_timelockanalysis were removed and never be used again; ft_timelockbaseline's result differs from result of ft_timelockanalysis, none of a final result were used in ft_singleplotER...
If I need the average and variance, I'll have to calculate them myself (because ft_timelockbaseline do not have them)...

I though it should be:

  1. preprocessing and segmentation;
  2. baseline correction;
  3. averaging;
  4. plot

But perhaps I made some mistake or misunderstand fieldtrip, I don't know how to do this correctly. Can anybody show me the correct way to do this?

@robertoostenveld
Copy link
Contributor

Thanks for reporting. We recently made changes to the code that relate to the timelock.avg field (which is chantime) and the timelock.trial field (which is rptchan*time). Previously both could be present, but now we support either avg or trial. For existing data structures that have both the avg will be discarded early in the ft function. This may inadvertently affect the plotting.

You can ignore the warnings, there are still some pieces of code that are more strict in checking the data structures than necessary, but those do not affect the functionality. The error is of course a problem.

Could you specifically point to the tutorial that has the problem (the link you provide is to the home page) and where in the tutorial it happens (e.g. "around 75% down in the tutorial")?

@suxpert
Copy link
Author

suxpert commented Feb 24, 2018

I meet this issue when I'm trying out code snippets here: http://www.fieldtriptoolbox.org/tutorial/human_ecog#erp_and_hgp_analysis

There are also somewhere else in tutorials or examples where I can not run those code provided locally, some with warning, some with errors. I'll post here if I find more.

@suxpert
Copy link
Author

suxpert commented Feb 24, 2018

BTW, if I want to plot the average and do statistics all after baseline correction, how should I do?

@schoffelen
Copy link
Contributor

I realize that this has been open for quite some time now. Sorry for not having followed this up more thoroughly. I am wondering whether it is still relevant to keep this issue open. I suspect that in the meantime the code and the tutorials have moved forward, so the specific problems reported in this issue have gone away. For now, I suggest to close this issue. Feel free @suxpert to reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants