Importing Spike Trains into Brainstorm

Not able to Run Spike Field Coherence

Hi, this is my first post. I need some help trying to run Spike Field Coherence. I think I was successful in importing a .mat file with the spike time stamps following the conventions outlined in this tutorial (https://neuroimage.usc.edu/brainstorm/e-phys/ConvertToBrainstormEvents) (See attached screenshot #1). And then importing as “Brainstorm .mat”. The spikes show up as events, as intended. Some ephys functions work, like obtaining a PSTH, or the raster plot. But I cannot get Spike Field Coherence to work. I keep getting this error “The time-selection must be around the spikes” (see Screenshot #2, filename has been redacted). I have selected multiple time windows, all with multiple spike events in a second (around 3 to 5 per second), and it doesn’t recognize them. Does it have something to do with how I am importing the spike events?

Is there a minimum of spikes/second that this function needs?

Thank you so much in advance!

Hi @raulca, welcome to the Brainstorm forum!

Your post is missing Screenshot #2.

It seems you are trying to run the Spike Field Coherence process in a file with multiple spike events, is that right?

If so, after importing the events, you need to import epochs around those spikes, and use those epochs as the input of the Spike Field Coherence.

Thank you so much for your response Raymundo!

I was definitely not doing that. I didn’t know that’s how it worked. I run Spike Field Coherence on all the epochs around the spikes as you said. I got 870 Epochs. When I try to run it over the folder of 870 Epochs, I get this error.

***************************************************************************
** Error: \[process_spike_field_coherence\] Electrophysiology > Spike field coherence
** 255: Dot indexing is not supported for variables of this type.
**
** stack:
** >process_spike_field_coherence.m>get_FFTs at 255
** >process_spike_field_coherence.m>Run at 126
** >process_spike_field_coherence.m at 31
** >bst_process.m>Run at 236
** >bst_process.m at 38
** >panel_process1.m>RunProcess at 138
** >panel_process1.m at 26
** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 781
** >bst_call.m at 28
** >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 301
** 
** 
***************************************************************************

When I try to run it over a single epoch, I get a very similar message.

***************************************************************************
** Error: \[process_spike_field_coherence\] Electrophysiology > Spike field coherence
** Line 255: Dot indexing is not supported for variables of this type.
** 
** Call stack:
** >process_spike_field_coherence.m>get_FFTs at 255
** >process_spike_field_coherence.m>Run at 126
** >process_spike_field_coherence.m at 31
** >bst_process.m>Run at 236
** >bst_process.m at 38
** >panel_process1.m>RunProcess at 138
** >panel_process1.m at 26
** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 781
** >bst_call.m at 28
** >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 301
** 
** 
***************************************************************************

Do you know by any chance what is this dot indexing and how do I change that about my epochs?

Thank you so much for your time Raymundo!

Did you happen to follow the provided tutorials on electrophysiology?
By following those with the provide data it is possible to see how to use the e-phy functions in Brainstorm.

https://neuroimage.usc.edu/brainstorm/Tutorials#Single.2FMulti-Unit_Electrophysiology


Regarding the error, it suggests there is a problem with structure that contains the imported Epoch data. This is likely to have its origin in the step where the events where added.

Can you share the following?

  1. A screenshot of the database (tree) in the Brainstorm GUI

  2. The structure of the events in the imported epochs. For one of the imported epochs:

    1. Right-click on it, then File > Copy filepath to clipboard
    2. In Matlab run the command DataMat = in_bst_data('COPIEDPATH');
    3. In Matlab run the following commands and share the results:
    DataMat.Events
    length(DataMat.Events)
    {DataMat.Events.label}
    

Dear Raymundo,

Thank you so much, sorry for the delay. Yes I followed the tutorial. Everything has been imported using Brainstorm tools, except the Spike events, but I followed the importing instructions following this tutorial (https://neuroimage.usc.edu/brainstorm/e-phys/ConvertToBrainstormEvents).

  1. Here’s the screenshot of the database tree:

  1. Regarding this, when I import into the database from raw, I use the spike events to create the Epochs (as indicated by your last coment), the spike event becomes (0.0s), and I have no events, DataMat.Events is empty. Thus, it shows me this:
   DataMat = in_bst_data('/media/raul/BrainstormDB/brainstorm_db/data/SubjectJW/TI_Session_band/data_Spikes_Channel_1__1__trial001.mat');

   >> DataMat.Events
   length(DataMat.Events)

   {trial.Events.label}
   ans =
   [ ]

   ans =
   0

   Unable to resolve the name 'trial.Events.label'.

But, I do have other epochs with spike events, so that we can see their Event Structure.

> DataMat = in_bst_data('/media/raul/BrainstormDB/brainstorm_db/data/SubjectJW/TI_Session_band/data_4mA_5Hz_global_trial005.mat');

\>> DataMat.Events

length(DataMat.Events)

{trial.Events.label}

ans =

[struct](matlab:helpPopup\('struct'\)) with fields:

label: 'Spikes Channel 1 |1|'
color: [1 0 0\]
epochs: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
times: [0.4882 0.7462 0.9459 1.1464 1.3486 1.5500 1.7502 1.9504 2.1502 2.3494 2.5506 2.7454 2.9511 3.1471 3.3473 3.5459 3.7477 3.9512 4.1462 … ] (1×29 double)
reactTimes: [ ]
select: 1
channels: {'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''}
notes: {'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''}

ans =

1

The event structure for the Spikes is just like the one specified in this tutorial, so I don’t know where the bug is or what I’m doing wrong.

Thank you in advance Raymundo!

Hi @raulca

Apologies for the misdirection. Importing the epochs around the spike events ('Spikes Channel 1 |1|') will not be useful to compute the spike field coherence. You need to import either either with condition markers (or a time segment of your data), then the imported epochs (or 1 epoch in case of importing a time segment) will have the spike events.

What happens when you run the SFC on the imported (4mA_5Hz_global) files?

For you channel names, is there a channel just label as 1?
Asking as the event name suggest that label: 'Spikes Channel 1 |1|'

Hi @Raymundo.Cassani,

No worries at all!

No, I have no Channel 1, I just used Channel 1 as a place holder. Does the actual channel name matter?, should I import it with a name of a channel that actually exist? (In my case for example, Channel B’1?)

Thank you in advance!

Best,

Raul

Yes, it has to be the name of a channel present in the data.
Ideally the channel where the spikes where found, so when coherence is computed is between the LFP of that channel, and the LFP of all the other channels.