Beauchamp:ECogAnalysis: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
Line 6: Line 6:
As long as the same experiment is being done and the equipment doesn't change, nothing else should need to be edited. If it were to change, examine items such as S.images, S.imageNames, S.sampleHZ, etc. Additional comments can be found on the code itself.
As long as the same experiment is being done and the equipment doesn't change, nothing else should need to be edited. If it were to change, examine items such as S.images, S.imageNames, S.sampleHZ, etc. Additional comments can be found on the code itself.


==LFP Traces and Power Spectra==
==Gamma Band Response==
 
The Gamma Band Response (GBR) measures activity in the gamma band of oscillations. This method is modeled after the method Lachaux's group uses. The GBR can then be treated as an LFP. To calculate the GBR:
#Organize the LFP data. This is done by doLFPvoltage.m
#Calculate the Power Spectra. This is done by doPowerSpectra.m
#Calculate the Gamma Band Response. This is done by doGBR.m


===doLFPvoltage===
===doLFPvoltage===
Line 12: Line 17:


Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 LFPvoltage). Make this the current directory in MATLAB.
Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 LFPvoltage). Make this the current directory in MATLAB.
type the following into the MATLAB command window:  
Type the following into the MATLAB command window:  




<code>for c = 1:<number of channels> <br> doLFPvoltage('<fileName>', c, 'none', 1); <br> c <br> end</code>
<code>for c = 1:<number of channels> <br> doLFPvoltage('<fileName>', c, 'none', 1); <br> c <br> end</code>


The previous step can take many minutes, depending on the number of channels. After it has gone through all channels, be sure to update the path so that these files are accessible to other functions as the analysis continues.
This can take many minutes, depending on the number of channels. After it has gone through all channels, be sure to update the MATLAB path so that these files are accessible to other functions as the analysis continues.


===doPowerSpectra===
===doPowerSpectra===
The next step of the analysis is to calculate Power Spectra. This is done by doPowerSpectra.
The next step of the analysis is to calculate Power Spectra. This is done by doPowerSpectra.m. To run Power Analysis and save the data:
 
Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 Power Spectra). Make this the current directory in MATLAB.
Type the following into the MATLAB command window:
 
 
<code>for c = 1:<number of channels> <br> doPowerSpectra('<fileName>', c, 'none', 1); <br> c <br> end</code>
 
This loop will take roughly 2-4 minutes per channel, making this the longest step by far of the analysis. After it has gone through all channels, be sure to update the MATLAB path so that these files are accessible to other functions as the analysis continues.
 
===doGBR===
The final step of the analysis is to calculate the GBR. The GBR can be calculated by category (audio only, AV congruent, AV incongruent, video only) or by image (drive V-only, drive AVcongruent, etc...). In addition, a simple method of computing the Gamma Band power by trial is included in doGBR. This method compares the percentage of power at each time point to the baseline, and reports it as a percent change. Because of this, we must create three directories for each set of data and run a for loop three times. To fully complete the analysis, calculate all GBRs, and save the data:
 
Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 GBR Category). Make this the current directory in MATLAB.
Type the following into the MATLAB command window:
 
<code>for c = 1:<number of channels> <br> doGBR('<fileName>', c, 'category', 1, 0); <br> c <br> end</code>
 
This will take roughly 20-30 seconds per channel. After the for loop is complete, create another directory and run the for loop again, changing 'category' to 'image' and then to 'trial'. In total, doGBR will be run 3 times per channel.
 
After it has gone through all channels, be sure to update the MATLAB path so that these files are accessible to other functions as the analysis continues.
 
==Broadband Power==
The broadband power

Revision as of 12:20, 29 July 2010

Processing Data from Ping Sun

Please note, all work with the ECoG data will be done in MATLAB. First, get the data files from Ping. There is one data file per channel, which will be entitled fileName_ch#.mat (e.g. "JPDatafile006_ch15.mat", where JPDatafile006 is fileName and 15 is the channel number in question). In addition, a time stamp file is needed, named fileName_timeStamp.mat (e.g. JPDatafile006_timeStamp.mat). Once these files are uploaded to the server, one must create a setting file in MATLAB called OBJSettingForAll_new.mat. This is done by the generateOBJSetting_new.m. This setting file will encode the information particular to that subject's experiment. Of particular importance to edit is the list of channel names (S.chanDesList), as this changes for every patient. For example, for JPDatafile006, the channel list is:

S.chanDesList = {'G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8', 'G9', 'G10', 'G11', 'G12', 'g13', 'G14', 'G15', 'G16', 'G17', 'G18', 'G19', 'G20', 'G21', 'G22', 'G23', 'G24', 'G25', 'G26', 'G27', 'G28', 'G29', 'G30', 'g31', 'G32', 'AF1', 'AF2', 'AF3', 'AF4', 'AIT1', 'AIT2', 'AIT3', 'AIT4', 'MIT1', 'MIT2', 'MIT3', 'MIT4', 'PIT1', 'PIT2', 'PIT3', 'PIT4', 'SPLT1', 'SPLT2', 'SPLT3', 'SPLT4', 'SPLT5', 'SPLT6', 'IPLT1', 'IPLT2', 'IPLT3', 'IPLT4', 'IPLT5', 'IPLT6', 'IPLT7', 'IPLT8', 'EKG1', 'EKG2'};

As long as the same experiment is being done and the equipment doesn't change, nothing else should need to be edited. If it were to change, examine items such as S.images, S.imageNames, S.sampleHZ, etc. Additional comments can be found on the code itself.

Gamma Band Response

The Gamma Band Response (GBR) measures activity in the gamma band of oscillations. This method is modeled after the method Lachaux's group uses. The GBR can then be treated as an LFP. To calculate the GBR:

  1. Organize the LFP data. This is done by doLFPvoltage.m
  2. Calculate the Power Spectra. This is done by doPowerSpectra.m
  3. Calculate the Gamma Band Response. This is done by doGBR.m

doLFPvoltage

To analyze the data, the first step is to organize the raw analog traces into a structure relating to the trial number. This is done by the function doLFPvoltage.m. To run analysis on all channels and save the data:

Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 LFPvoltage). Make this the current directory in MATLAB. Type the following into the MATLAB command window:


for c = 1:<number of channels>
doLFPvoltage('<fileName>', c, 'none', 1);
c
end

This can take many minutes, depending on the number of channels. After it has gone through all channels, be sure to update the MATLAB path so that these files are accessible to other functions as the analysis continues.

doPowerSpectra

The next step of the analysis is to calculate Power Spectra. This is done by doPowerSpectra.m. To run Power Analysis and save the data:

Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 Power Spectra). Make this the current directory in MATLAB. Type the following into the MATLAB command window:


for c = 1:<number of channels>
doPowerSpectra('<fileName>', c, 'none', 1);
c
end

This loop will take roughly 2-4 minutes per channel, making this the longest step by far of the analysis. After it has gone through all channels, be sure to update the MATLAB path so that these files are accessible to other functions as the analysis continues.

doGBR

The final step of the analysis is to calculate the GBR. The GBR can be calculated by category (audio only, AV congruent, AV incongruent, video only) or by image (drive V-only, drive AVcongruent, etc...). In addition, a simple method of computing the Gamma Band power by trial is included in doGBR. This method compares the percentage of power at each time point to the baseline, and reports it as a percent change. Because of this, we must create three directories for each set of data and run a for loop three times. To fully complete the analysis, calculate all GBRs, and save the data:

Find the directory you wish to save the data in. The best way to do this is to create a new folder for each type of data with the filename (e.g. JPDatafile006 GBR Category). Make this the current directory in MATLAB. Type the following into the MATLAB command window:

for c = 1:<number of channels>
doGBR('<fileName>', c, 'category', 1, 0);
c
end

This will take roughly 20-30 seconds per channel. After the for loop is complete, create another directory and run the for loop again, changing 'category' to 'image' and then to 'trial'. In total, doGBR will be run 3 times per channel.

After it has gone through all channels, be sure to update the MATLAB path so that these files are accessible to other functions as the analysis continues.

Broadband Power

The broadband power