[FieldTrip] fieldtrip Digest, Vol 148, Issue 24

Peter Kaskan peter.kaskan at einsteinmed.edu
Tue Apr 11 22:30:18 CEST 2023


Hello Jan-Mathijs,

Thanks for the reply; I was traveling and just got back to this...

In my initial, very rudimentary preprocessing script, cfg.dataset will take a single neuralynx file:

      cfg.dataset = 'CSC4.ncs';
            cfg.continuous = 'yes';
            highpass, lowlass, demean, detrend etc..
            filtContData = ft_preprocessing(cfg);

But the question was how to reference one channel with another.

I have been trying to implement your channellist and appenddata suggestion as you describe (below) using channellist = {'CSC1.ncs'; 'CSC2.ncs'; 'CSC3.ncs'} and the subsequent data loop.

However, my initial attempt left some errors related to
Error using ft_checkconfig (line 163)
The field cfg.datafile is required
The field cfg.headerfile is required

Error in ft_preprocessing (line 385)
      cfg = ft_checkconfig(cfg, 'required',   {'headerfile', 'datafile'});
After digging a little further in ft_preprocessing lines 446-447

% translate the channel groups (like 'all' and 'MEG') into real labels

  cfg.channel = ft_channelselection(cfg.channel, hdr);

  assert(~isempty(cfg.channel), 'the selection of channels is empty');

... we rescued the error by resetting

cfg.channel = CSC1.ncs;

Do you know what is happening? If we use: channellist = {'CSC1.ncs'; 'CSC2.ncs'; 'CSC3.ncs'}

does the cfg.datafile and cfg.headerfile need to be defined some other way?


Thanks, Peter



________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of fieldtrip-request at science.ru.nl <fieldtrip-request at science.ru.nl>
Sent: Monday, March 27, 2023 6:00 AM
To: fieldtrip at science.ru.nl <fieldtrip at science.ru.nl>
Subject: fieldtrip Digest, Vol 148, Issue 24

Today's Topics:

1. Re: re-referencing using neuralynx.csc channels
      (Schoffelen, J.M. (Jan Mathijs))

Date: Mon, 27 Mar 2023 08:20:40 +0000
From: "Schoffelen, J.M. (Jan Mathijs)"
        <janmathijs.schoffelen at donders.ru.nl>

Hi Peter,

ft_read_data is a so-called ‘intermediate’ level fieldtrip function and not typically called directly by the casual user.

I think your use case calls for the following strategy:

channellist = {‘channel1’;’channel2’;…’channelN’};
for k = 1:numel(channellist)
   cfg.channel = channellist{k}; % or something equivalent, at least instructing the reading function to grab a channel specific file
   data{k} = ft_preprocessing(cfg);
end

alldata = ft_appenddata([], data{:});

Once you have the alldata object, you can apply re-referencing. Perhaps indeed this is best done by creating a ‘montage’, and apply it to the data.

Best wishes,

Jan-Mathijs



On 23 Mar 2023, at 22:12, Peter Kaskan via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello,

I am writing a ft_preprocessing script; I can give it channel1.csc and proceed with filtering, defining trials etc.

...but, how do I re-reference to another channel?

Is there a way to use ft_read_data to create a structure with all channels, and then tell it what channel I want to use as a reference?

Or do I need to create a montage, and how do I do that with n #s of separate neuralynx.csc channels?



Thanks - Peter


Peter M. Kaskan, Ph.D.
Assistant Professor
Albert Einstein College of Medicine
Leo M. Davidoff Department of Neurological Surgery
1410 Pelham Parkway South
Kennedy Center Room 429B
Bronx, NY 10461

phone: 718-430-2763
_______________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230411/5e8fb383/attachment.htm>


More information about the fieldtrip mailing list