Back to the main page.
Bug 2949 - ft_selectdata does not work with comp (IC) data
Status | CLOSED WONTFIX |
Reported | 2015-08-23 15:42:00 +0200 |
Modified | 2019-08-10 12:31:24 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | Macintosh |
Operating System: | Mac OS |
Importance: | P5 normal |
Assigned to: | |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Flor Kusnir - 2015-08-23 15:42:35 +0200
I can no longer select individual components (from ICA data) with ft_selectdata (worked in older versions). I currently have the most recent version of fieldtrip.
Robert Oostenveld - 2015-08-24 11:37:53 +0200
(In reply to Flor Kusnir from comment #0) Hi Flor, We have this "new" ft_selectdata already for quite some time (like a year or so), so I suspect that you made a switch from a quite old version to the latest one. I was not aware that the old version could select components. How did you do that, i.e. what did you exactly specify on the command line? Robert
Flor Kusnir - 2015-08-27 13:40:04 +0200
It could be that it was only implemented in an older version (I had not tried to run this script in about a year, or more). I specified as follows: indComp=23; caseComp=ft_selectdata(comp,'channel',indComp); where inComp refers to the component number i want to keep (the rest i discard), and comp is the output of an IC analysis in which I keep 40 components (see below) comp = fsample: 249.999997591658 time: {1x376 cell} trial: {1x376 cell} topo: [240x40 double] unmixing: [40x240 double] label: {40x1 cell} topolabel: {240x1 cell} cfg: [1x1 struct] Cheers, Flor
Jan-Mathijs Schoffelen - 2015-09-11 11:21:25 +0200
Well, this issue is related to the fact that ft_selectdata does not operate on 'raw'ish types of data structures anymore. In other words, it will fail for channel and trial selection for datatypes 'raw' and 'comp'. Have you tried ft_preprocessing? cfg = []; cfg.channel = 23; compout = ft_preprocessing(cfg, compin);
Robert Oostenveld - 2015-09-14 15:52:27 +0200
(In reply to Jan-Mathijs Schoffelen from comment #3) I agree with the workaround. However, it does work for raw data. E.g. it is also used for trial and channel selection in ft_timelockanalysis and plenty of other functions. So it might just not work for comp structures... I tried the following load dataFIC cfg = []; cfg.method = 'pca'; % the fastest compFIC = ft_componentanalysis(cfg, dataFIC) compFIC = fsample: 300 time: {1x77 cell} trial: {1x77 cell} topo: [149x149 double] unmixing: [149x149 double] label: {149x1 cell} topolabel: {149x1 cell} grad: [1x1 struct] cfg: [1x1 struct] cfg = []; cfg.channel = 1; ft_selectdata(cfg, compFIC) ans = fsample: 300 time: {1x77 cell} trial: {1x77 cell} topo: [149x1 double] unmixing: [1x149 double] label: {'pca001'} <====== note this, it was 149x1 before topolabel: {149x1 cell} grad: [1x1 struct] cfg: [1x1 struct] Besides the trial output (i.e component time series) also the topo (mixing) and unmixing are updated. It is only that the interface of ft_selectdata has changed, with the new it works, but with the old one I can confirm the problem. >> ft_selectdata(compFIC, 'channel', 1) undoing the comp balancing for the gradiometer definition undoing the comp balancing for the gradiometer definition ans = fsample: 300 time: {1x77 cell} trial: {1x77 cell} label: {149x1 cell} grad: [1x1 struct] cfg: [1x1 struct] unmixing: [149x149 double] topo: [149x149 double] topolabel: {149x1 cell} The problem therefore is in ft_selectdata_old, which is old and deprecated for good reasons. So we are not going to fix it. Please use ft_selectdata according to its documentation.