Difference between revisions of "Data Processing"

From Neuroelectric's Wiki
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
== Matlab tools ==
 
== Matlab tools ==
  
When EEG data is recorded by NIC from Enobio or StarStim instruments, several files are created. These include an .info file and an .easy file. "Easy" format data is, well, easy to load into a program such as Matlab. Here is an example in Matlab:
+
[[File:spectrogram.png|200px|thumb|left|'''See [[Manuals & Downloads / Repository | Manuals & Downloads / Repository ]] for more sophisticated sample code to do data analysis.'''
 +
]]
 +
When EEG data is recorded by NIC from Enobio or StarStim instruments, several files are created. These include an .info file and an .easy file. "Easy" format data is, well, easy to load into a program such as Matlab.  
  
>> MyData= load('201320020020data.easy');
+
'''See [[Manuals & Downloads / Repository | Manuals & Downloads / Repository ]] for more sophisticated sample code to do data analysis.''' You can find there code to create PSDs plots, spectrograms, etc.
  
 +
Here is a simple example in Matlab (download the example [[media:SimpleCodeExample.zip | '''here''']]). This is a an example file to read NE data. First we load the file - change the filename below as needed. The file  should be in the Matlab working directory in this case:
 +
 +
>> d=load(‘20120731153351_enobiodata.easy’);
  
 
+
The data is now loaded as an array in the "d" variable.
Here is a more sophisticated example:
 
 
 
% This is a an example file to read NE data.
 
% First we load the file - change the filename below as needed. The file  should be in
 
% the Matlab working directory in this case:
 
 
   
 
   
>> d=load(‘20120731153351_enobiodata.easy’);
+
Next we define the time axis using the last column in the data (in ms Unix time):
 
% Next we define the time axis using the last column in the data (in ms Unix time):
 
  
time=d(:,end); % time stamp is in the last column - in ms Unix time
+
>> time=d(:,end); % time stamp is in the last column - in ms Unix time
 
+
>> time=time-time(1); % set clock to zero in first sample
time=time-time(1); % set clock to zero in first sample
+
>> time=time/1000; % change time units to seconds  
 
 
time=time/1000; % change time units to seconds  
 
 
   
 
   
% Example one: we plot channel 1 in mV
 
 
figure(1); plot(time, d(:,1)/1e6); % divide by one million to go to mV
 
  
xlabel(‘Time from start (s)’);
+
[[File:MatlabExampleFigure1.png |200px|thumb|left|Figure from Example 1 (tDCS signal)]]
 +
[[File:MatlabExampleFigure2.png |200px|thumb|left|Figure from Example 2 (tDCS signal)]]
  
ylabel(‘Voltage (mV)’);
+
'''Example 1:''' we plot channel 1 in mV  
  
title(‘Channel 1 data’);
+
>> figure(1); plot(time, d(:,1)/1e6); % divide by one million to go to mV
 +
>> xlabel(‘Time from start (s)’);
 +
>> ylabel(‘Voltage (mV)’);
 +
>> title(‘Channel 1 data’);
 
   
 
   
% Example two: we plot channels 1 to 8 in uV
 
  
figure(2); plot(time, d(:,1:8)/1e3); % divide by one thousand to go to uV
 
  
xlabel(‘Time from start (s)’);
 
  
ylabel(‘Voltage (uV)’);
+
'''Example 2:''' we plot channels 1 to 8 in uV
  
legend({‘Ch1’,’Ch2’,’Ch3’,’Ch4’,’Ch5’,’Ch6’,’Ch7’,’Ch8’});
+
>> figure(2); plot(time, d(:,1:8)/1e3); % divide by one thousand to go to uV
 +
>> xlabel(‘Time from start (s)’);
 +
>> ylabel(‘Voltage (uV)’);
 +
>> legend({‘Ch1’,’Ch2’,’Ch3’,’Ch4’,’Ch5’,’Ch6’,’Ch7’,’Ch8’});
 +
>> title(‘Channels 1-8 data’);
 +
>> ylim([-200 200]); % fix the y-axis limits to plu/minus 200 uV
  
title(‘Channels 1-8 data’);
 
  
ylim([-200 200]); % fix the y-axis limits to plu/minus 200 uV
 
  
 +
<br />
  
[[File:spectrogram.png|200px|thumb|left|Spectrogram with TMS]]
+
== NIC Offline ==
  
== NIC Offline ==
+
NIC Offline (available on our website, Downloads section) is a stand alone tool to input Neuroelectrics files in any format and carrying out simple data analysis on them. It reproduces the online capabilities of NIC, but works from a data file as opposed to real data streams from a device.

Latest revision as of 14:47, 14 October 2013

In this page you will find some tips on how to analyze NE instrument data. This includes EEG data and accelerometry.

We discuss data analysis with Matlab and with NIC-Offline


Matlab tools

See Manuals & Downloads / Repository for more sophisticated sample code to do data analysis.

When EEG data is recorded by NIC from Enobio or StarStim instruments, several files are created. These include an .info file and an .easy file. "Easy" format data is, well, easy to load into a program such as Matlab.

See Manuals & Downloads / Repository for more sophisticated sample code to do data analysis. You can find there code to create PSDs plots, spectrograms, etc.

Here is a simple example in Matlab (download the example here). This is a an example file to read NE data. First we load the file - change the filename below as needed. The file should be in the Matlab working directory in this case:

>> d=load(‘20120731153351_enobiodata.easy’);

The data is now loaded as an array in the "d" variable.

Next we define the time axis using the last column in the data (in ms Unix time):

>> time=d(:,end); % time stamp is in the last column - in ms Unix time
>> time=time-time(1); % set clock to zero in first sample
>> time=time/1000; % change time units to seconds 

Figure from Example 1 (tDCS signal)
Figure from Example 2 (tDCS signal)

Example 1: we plot channel 1 in mV

>> figure(1); plot(time, d(:,1)/1e6); % divide by one million to go to mV
>> xlabel(‘Time from start (s)’); 
>> ylabel(‘Voltage (mV)’);
>> title(‘Channel 1 data’);


Example 2: we plot channels 1 to 8 in uV

>> figure(2); plot(time, d(:,1:8)/1e3); % divide by one thousand to go to uV
>> xlabel(‘Time from start (s)’);
>> ylabel(‘Voltage (uV)’);
>> legend({‘Ch1’,’Ch2’,’Ch3’,’Ch4’,’Ch5’,’Ch6’,’Ch7’,’Ch8’});
>> title(‘Channels 1-8 data’);
>> ylim([-200 200]); % fix the y-axis limits to plu/minus 200 uV



NIC Offline

NIC Offline (available on our website, Downloads section) is a stand alone tool to input Neuroelectrics files in any format and carrying out simple data analysis on them. It reproduces the online capabilities of NIC, but works from a data file as opposed to real data streams from a device.