Embed Size (px)
Source activation single trial analysis
Source activation single trial analysis
I.The excel file
Open your Psyscope data file with Excel:
This Excel workbook should be where you store all the information you extract from the .sqd MEG file, as well as all the calculations you perform on the behavioral data. One page of the workbook should be used for the “variables” that will be input to the statistical analysis of your results. Each column of this page will have values for variable, both “independent” (properties of the subjects and properties of the stimuli that you manipulated) and “dependent” (what you measured, including RT and MEG measures). To begin creating this page from your initial import from the Psyscope data file, remove the header information (keeping column labels), remove irrelevant columns, and add “subject” as the first column, giving this variable a single value of the subject number for the whole column.
The column that indicates which button the subject pushed should be recoded to indicate whether or not the subject was correct (we’ll remove error trials from all statistical analyses). Use zero for error, one for correct. Select all the columns and Data Sort first by Event Tag and second by State. Given what you know about the correct responses, overwrite correct responses with “1” and incorrect responses with “0”. When you’re done, Sort again by Trial.
II.Preparing the .sqd file for analysis
Open your .sqd file in MEG160.
Under “Edit” do “Noise Reduction” using the parameters shown. Say “no” about the possibility of undoing the operation.
Using “Select Channels” (it’s the last button on the top row of buttons), select “All MEG” channels before the next step. THIS IS IMPORTANT.
Then, under Edit, choose “Moving Average” with the parameters shown. Reply “no” to being able to undo the operation.
If your file is too big for MatLab to handle, you may need to downsample (for example, down from 1kHz to 500Hz sampling rate). Choose “Thin Out” under the edit menu, with these parameters.
III.Creating the “weights” file for a source analysis.
A.Create a Grand Average
For the Grand Average, you want to get triggers for all of the relevant stimulus types (for the M350, all words and nonwords would be averaged together). If you’ve triggered on one channel for all stimuli, you can just search on that trigger line. If you have different triggers for different stimuli that will go into the Grand Average, you should use “Add Mode” in the Trigger List frame and search for triggers one after the other.
First, hit the Set button for “Level Rejection.” When the Level Rejection window appears, first hit “All MEG,” then set the parameters as shown, for +/-.4% rejection.
With the parameters as shown in the Offline Averaging box (from Edit Average), Search for triggers. (You could use a different epoch size, depending on where the activity of interest occurs. For example, for an M100, a range from –100ms prestimulus to 250ms post-stimulus might be sufficient.)
Execute and save the averaged file.
Select Channels All MEG Channels and change the vertical scale to reveal the components of the averaged response. For visual word presentation, the M170 should be clearly visible as shown.
Next do Baseline Correct (under Edit) with the parameters shown.
Then do LPF (Low Pass Filter) under Edit with the parameters shown.
You should be ready for M350 localization at this point. Not every file will allow you to find a localizable M350. In fact, the one we’ve been working on in this example fails to show an M350 field pattern in the time window between 300 and 400ms post stimulus onset.
The good M350 field pattern will be positive – red – at the bottom left and negative – blue – at the top left.
This field pattern should resemble that for the auditory M100 response from the same subject.
Choose the sensors that cover this field pattern in the left hemisphere. Make sure that you save the set of sensors you’ve chosen by choosing “save” under the “file” menu in the “Select Channels” pop-up box.
Choose from the MRI menu Create MRI file from Digitizer Data.
“Search” for the .hsp headshape file and then the .elp marker coil file. Hit OK and save the .mri file, answering yes to all the questions that pop up.
Now under the MRI menu, choose MRI Marker Positioning and Search for the marker .sqd file. Hit OK.
Now under MRI do MRI/MEG coregistration. Hit “Exec Coregistration” then OK to accept (hopefully, the coregistration will give an average error of less than 5mm).
Under the Analysis menu, choose Sphere Model, then hit the Auto button (with “Two End Points” chosen). Using the arrows with the x y and z and Radius indicators, you can expand or move the sphere to cover much of the head
Hit OK to accept.
Place the cursor at the beginning of the time region that you would like to analyze for the M350 and shift click and drag to highlight the region from that point to the end of the time region.
Click back at the beginning of the time region (exactly) and choose Dipole Fitting from the Analysis menu.
Unclick the “Confirm” Box and hit Estimate #1. Close the Dipole Fitting box.
Under the Property menu, choose Magnetic Source Info. Examine the file and find the Intensity peak latency in ms. that also shows a reasonable GOF (goodness of fit) – over 90% is fine. SAVE THIS FILE using the save command under the File menu.
Close the Info window and click on the time slice of the Intensity peak. Note in this example that the dipole at the intensity peak is medial and inferior to where we would expect the M350 source (the localization toward the beginning of the time windows is closer to what we expect).
Save the file before the next step. Now choose under the Edit menu, Forward Problem and agree to overwriting measured data with data computed from the dipole.
Under the Property menu, choose Measured Data Info. Select Channels and select only the MEG channels 0-157. Under the File menu in the Measured Data Info window, Save this info as a .txt file.
You’re now done with MEG160. The “Measured Data” file you saved will be used to create a weights file for source analysis.
Open the Measured Data file you saved in Excel, copy just the column of 157 numbers corresponding to the measured data in fTs, paste this column into a Word file and save as a plain .txt file. This is the basis of the weights file you’ll create in MatLab.
Load your text file into MatLab:
wgtsft = load('weightsft.txt');
Now you’ll normalize the weights vector.
>> for i=1:length(wgtsft)
Save the weight file as a text file:
save weight.txt weight –ASCII
(this puts the file under the MATLAB7 folder – you may want then to move it into your working folder, with the other files relevant to the analysis)
Now the mean(weight) = 0 and the stn(weight)=1
IV. Using MatLab
Here’s what MatLab looks like after you start the program up. The “Array Editor” may not be open until you double click on a matrix or vector variable in the Workspace.
A.Load your MEG file
The MatLab command is “get_trials”:
>> [triggers, datastack, smpr] = get_trials('2830_TAFTFORSTERfran', [160:167], [0:157], -100, 450);
The variables returned by this function are “triggers” “datastack” and “smpr”. “triggers” has two columns. The first indicates the time of each trigger in milliseconds; the second gives the trigger code for each trigger. “datastack” is the MEG data divided into epochs around each trigger and stacked. Each level of the stack is a two dimensional array of MEG sensor values, with sensor number one dimension and time the other. “smpr” relates to the sampling rate of the file and is used by further functions.
The input to this function are (1) the file name of the .sqd data file that you prepared in the first step of these instructions, (2) the trigger channels (use what’s shown for Mac experiments, use [184:191] (3) the MEG channels (use all channels [0:157]), (4) the prestimulus interval (negative values for pre-trigger values, so –100 for 100ms pre-trigger) (5) the post-stimulus interval (here 450ms).
The program will return the following information about your .sqd file when it is done loading datastack and finding triggers:
Sqdhandle object properties:
Version : 2
Revision : 1
SystemID : 31
SystemName : Massachusetts Institute of Technology
160-channel MEG System
ModelName : EQ1160R
FileName : 2830_TAFTFORSTERfran
InputGain : 2
OutputGain : 50
ChannelCount : 192
Channels : [1x192] Channel array
SampleRate : 1000
AcquisitionType : 1
RawOffset : 58236
Datatype : int16
SamplesAcquired : 1000000
ActSamplesAcquired : 405000
SamplesAvailable : 405000