Difference between revisions of "Create Triggers for Artifact-Rejected Epochs"

From BESA® Wiki
Jump to: navigation, search
(Creating a New Event File (*.evt))
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
|title = Module information
 
|title = Module information
 
|module = BESA Research Basic or higher
 
|module = BESA Research Basic or higher
|version = 5.2 or higher
+
|version = BESA Research 5.2 or higher
 
}}
 
}}
  
 
=== Overview ===
 
=== Overview ===
Here we demonstrate how to track what epochs were rejected by the artifact rejection. There might be experiments were one is interested in actually analyzing the rejected epochs. This information is available in the respective paradigm file but has to be extracted by the user. The idea is to create a new trigger for the rejected epochs that can later be read back into BESA Research.
+
 
 +
Here we demonstrate how to track what epochs were rejected by the artifact rejection. There might be experiments were one is interested in actually analyzing the rejected epochs. This information is available in the respective paradigm file (*.PDG) but has to be extracted by the user. The idea is to create a new trigger for the rejected epochs that can later be read back into BESA Research.
  
 
=== Identifying Rejected Epochs ===
 
=== Identifying Rejected Epochs ===
In this example we use the subject 2 of the Auditory Intensity experiment located in the BESA Research examples folder (../Examples/AuditoryIntensity/S2.cnt).  
+
 
 +
In this example we use the subject 2 of the Auditory Intensity experiment located in the BESA Research examples folder (../Examples/ERP-Auditory-Intensity/S2.cnt).
 +
 
 
# Open the raw file S2.cnt and create a new paradigm for it. In the conditions tab create only conditions that directly correspond to each of the respective triggers (in my case I have 5 triggers, thus I have 5 conditions, one for each "current" trigger).
 
# Open the raw file S2.cnt and create a new paradigm for it. In the conditions tab create only conditions that directly correspond to each of the respective triggers (in my case I have 5 triggers, thus I have 5 conditions, one for each "current" trigger).
 
# Define the Epochs and Filters as you like.
 
# Define the Epochs and Filters as you like.
 
# Run the artifact rejection.
 
# Run the artifact rejection.
# Close everything and find the respective paradigm file in the folder of raw file S2.cnt (typically %basename%.pdg, in my case S2.pdg, see [[File:S2.PDG|thumb]]).
+
# Close everything and find the respective paradigm file in the folder of raw file S2.cnt (typically <code>%basename%.pdg</code>, in my case S2.pdg, see [[:File:S2.PDG|S2.PDG]]).
 
# Open the paradigm file in a text editor (e.g. Notepad, please do not use word as it might change the format of the text).
 
# Open the paradigm file in a text editor (e.g. Notepad, please do not use word as it might change the format of the text).
# Find the section starting with [ArtifactScan], ignore the following 4 lines (see the [[Paradigm File Format in BESA|PDG file format description]] for details if you are curious!) and copy everything thereafter to a new txt file.  
+
# Find the section starting with '''[ArtifactScan]''', ignore the following 4 lines (see the [[Paradigm File Format in BESA|PDG file format description]] for details) and copy everything thereafter to a new txt file.  
 
# Import the newly created file in Excel by specifying that spaces and tabs are the delimiters for the columns. Save the file in excel format and leave it open. Be sure to have the decimal separator set to " . " and the thousands separator set to none.
 
# Import the newly created file in Excel by specifying that spaces and tabs are the delimiters for the columns. Save the file in excel format and leave it open. Be sure to have the decimal separator set to " . " and the thousands separator set to none.
# Open the attached excel file [[File:ArtifactRejection.xlsx]]. In the first sheet you should be able to see a blue painted area. Please copy the contents of the table you created in there. Be sure to copy the values only (not e.g. the format). The table will basically check if a particular epoch was rejected or not. In case it will substitute the value for the trigger on the left most side of the table with a new trigger (12 in this case, marked in orange in the table). The table was made to support up to 257 channels, in case you have more please just adjust the formulas in Exceeds max Amp etc…
+
# Open the attached excel file [[:File:ArtifactRejection.xlsx|ArtifactRejection.xlsx]]. In the first sheet you should be able to see a blue painted area. Please copy the contents of the table you created in there. Be sure to copy the values only (not e.g. the format). The table will basically check if a particular epoch was rejected or not. In case it will substitute the value for the trigger on the left most side of the table with a new trigger (12 in this case, marked in orange in the table). The table was made to support up to 257 channels, in case you have more please just adjust the formulas in Exceeds max Amp etc…
Please also set the right artifact rejection values (cells are marked with green in the table) as in the paradigm window.  
+
## Please also set the right artifact rejection values (cells are marked with green in the table) as in the paradigm window.  
Please also make the tables length match the length of your data by copy pasting the 4 row x 10 columns block accordingly (marked in orange for easier identification!).
+
## Please also make the tables length match the length of your data by copy pasting the 4 row × 10 columns block accordingly (marked in orange for easier identification!).
# Ok, now you should be almost done. The 5 leftmost columns on your table should have all the necessary information to create a new event file. Please copy the 4 columns starting from the cell immediately below the label "Tmu" (A13 if nobody changed the table in the meantime) to the end of the table. Insert them in a new sheet (NewEventFile) from A2 onward. Please be careful to paste values only! (Do paste special->values only in excel).
+
# The 5 leftmost columns on your table should have all the necessary information to create a new event file. Please copy the 4 columns starting from the cell immediately below the label "Tmu" (A13 if nobody changed the table in the meantime) to the end of the table. Insert them in a new sheet (NewEventFile) from A2 onward. Please be careful to paste values only (do Paste Special → values only in excel).
# Almost there! Please select all the data in the new sheet and press Sort & Filter, select Custom sort, and choose sort by Column A, Sort On Values and choose A->Z as order. This should effectively remove the empty rows.  
+
# Please select all the data in the new sheet and press Sort & Filter, select Custom sort, and choose sort by Column A, Sort On Values and choose A Z as order (Sort Smallest to Largest). This should effectively remove the empty rows.
 +
 
 +
=== Creating a New Event File (*.evt) ===
  
=== Creating a new evt File ===
+
# Please select all the relevant rows for the 5 columns in the new sheet and just copy them to a new file in Notepad. Please save the file with the evt extension. You can see the evt file obtained from the example described here [[:File:S2_ArtRej_EventFile.evt|S2_ArtRej_EventFile.evt]].
# Please select all the relevant rows for the 5 columns in the new sheet and just copy them to a new file in Notepad. Please save the file with the evt extension. You can see the evt file obtained from the example described here [[File:S2_ArtRej_EventFile.evt]].
+
# Go back to BESA Research, remove all the existing triggers in "ERP Edit Triggers Delete". Once this is done please load the evt file you created by doing "ERP Open Event File".
# Go back to BESA, remove all the existing triggers in ERP->Edit Triggers->Delete. Once this is done please load the file evt file you created by doing ERP->Open Event File.
+
 
# Trigger 12 should now appear in your data and represents those triggers that will be removed during artifact rejection.  
 
# Trigger 12 should now appear in your data and represents those triggers that will be removed during artifact rejection.  
 
# Using the paradigm window you should now be able to run your analysis using the new trigger 12 you created.
 
# Using the paradigm window you should now be able to run your analysis using the new trigger 12 you created.
  
 
[[Category:ERP/ERF]]
 
[[Category:ERP/ERF]]

Latest revision as of 10:15, 5 May 2021

Module information
Modules BESA Research Basic or higher
Version BESA Research 5.2 or higher

Overview

Here we demonstrate how to track what epochs were rejected by the artifact rejection. There might be experiments were one is interested in actually analyzing the rejected epochs. This information is available in the respective paradigm file (*.PDG) but has to be extracted by the user. The idea is to create a new trigger for the rejected epochs that can later be read back into BESA Research.

Identifying Rejected Epochs

In this example we use the subject 2 of the Auditory Intensity experiment located in the BESA Research examples folder (../Examples/ERP-Auditory-Intensity/S2.cnt).

  1. Open the raw file S2.cnt and create a new paradigm for it. In the conditions tab create only conditions that directly correspond to each of the respective triggers (in my case I have 5 triggers, thus I have 5 conditions, one for each "current" trigger).
  2. Define the Epochs and Filters as you like.
  3. Run the artifact rejection.
  4. Close everything and find the respective paradigm file in the folder of raw file S2.cnt (typically %basename%.pdg, in my case S2.pdg, see S2.PDG).
  5. Open the paradigm file in a text editor (e.g. Notepad, please do not use word as it might change the format of the text).
  6. Find the section starting with [ArtifactScan], ignore the following 4 lines (see the PDG file format description for details) and copy everything thereafter to a new txt file.
  7. Import the newly created file in Excel by specifying that spaces and tabs are the delimiters for the columns. Save the file in excel format and leave it open. Be sure to have the decimal separator set to " . " and the thousands separator set to none.
  8. Open the attached excel file ArtifactRejection.xlsx. In the first sheet you should be able to see a blue painted area. Please copy the contents of the table you created in there. Be sure to copy the values only (not e.g. the format). The table will basically check if a particular epoch was rejected or not. In case it will substitute the value for the trigger on the left most side of the table with a new trigger (12 in this case, marked in orange in the table). The table was made to support up to 257 channels, in case you have more please just adjust the formulas in Exceeds max Amp etc…
    1. Please also set the right artifact rejection values (cells are marked with green in the table) as in the paradigm window.
    2. Please also make the tables length match the length of your data by copy pasting the 4 row × 10 columns block accordingly (marked in orange for easier identification!).
  9. The 5 leftmost columns on your table should have all the necessary information to create a new event file. Please copy the 4 columns starting from the cell immediately below the label "Tmu" (A13 if nobody changed the table in the meantime) to the end of the table. Insert them in a new sheet (NewEventFile) from A2 onward. Please be careful to paste values only (do Paste Special → values only in excel).
  10. Please select all the data in the new sheet and press Sort & Filter, select Custom sort, and choose sort by Column A, Sort On Values and choose A → Z as order (Sort Smallest to Largest). This should effectively remove the empty rows.

Creating a New Event File (*.evt)

  1. Please select all the relevant rows for the 5 columns in the new sheet and just copy them to a new file in Notepad. Please save the file with the evt extension. You can see the evt file obtained from the example described here S2_ArtRej_EventFile.evt.
  2. Go back to BESA Research, remove all the existing triggers in "ERP → Edit Triggers → Delete". Once this is done please load the evt file you created by doing "ERP → Open Event File".
  3. Trigger 12 should now appear in your data and represents those triggers that will be removed during artifact rejection.
  4. Using the paradigm window you should now be able to run your analysis using the new trigger 12 you created.