Difference between revisions of "BESA Research Batch Processing"

From BESA® Wiki
Jump to: navigation, search
 
(40 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== <span style="color:#3366ff;"><span style="color:#00000a;">Batch Processing and Combining Conditions</span></span> ==
+
{{BESAInfobox
 +
|title = Module information
 +
|module = BESA Research Basic or higher
 +
|version = BESA Research 6.1 or higher
 +
}}
  
=== <span style="color:#3366ff;"><span style="color:#00000a;">Combine Conditions and Batch Module: Introduction</span></span> ===
+
<!-- == Batch Processing and Combining Conditions == -->
  
<span style="color:#3366ff;"><span style="color:#00000a;">Functions of this module are started by selecting the menu operations "</span></span><span style="color:#3366ff;">'''ERP / Combine Conditions..."'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and </span></span><span style="color:#3366ff;">'''"Process / Batch Scripts...".'''</span>
+
== Combine Conditions and Batch Module: Introduction ==
  
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Combine Condition Scripts'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> provides various operations on BESA averages.</span></span>
+
Functions of this module are started by selecting the menu operations "<span style="color:#3366ff;">'''ERP / Combine Conditions...'''</span>" and "<span style="color:#3366ff;">'''Process / Batch Scripts...'''</span>".
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Batch Scripts'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> provides batch operations on all data files.</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">Note that a batch script can also be performed on the current file by selecting </span></span><span style="color:#3366ff;">'''Process / Run'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> </span></span><span style="color:#3366ff;">'''Batch...'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> or by typing the shortcut key </span></span><span style="color:#3366ff;">'''"R'''</span><span style="color:#3366ff;"><span style="color:#00000a;">".</span></span>
+
  
 +
* '''Combine Condition Scripts''' provides various operations on BESA averages.
 +
* '''Batch Scripts''' provides batch operations on all data files.
 +
* Note that a batch script can also be performed on the current file by selecting "<span style="color:#3366ff;">'''Process / Run Batch...'''</span>" or by typing the shortcut key "<span style="color:#3366ff;">'''R'''</span>".
  
=== <span style="color:#3366ff;"><span style="color:#00000a;">File List Tab</span></span> ===
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">Define a list of files on which the operations will be performed. The tab is the same for Combine Conditions Scripts and for Batch Scripts. Combine Conditions Scripts only allows you to open BESA average files (e.g. </span></span><span style="color:#ff9c00;">'''<nowiki>*.fsg</nowiki>'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and </span></span><span style="color:#ff9c00;">'''<nowiki>*.avr</nowiki>'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, but also </span></span><span style="color:#ff9c00;">'''.mul'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, </span></span><span style="color:#ff9c00;">'''.raw'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, </span></span><span style="color:#ff9c00;">'''.swf'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, and </span></span><span style="color:#ff9c00;">'''.foc'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> if the files have a defined pre-stimulus interval), whereas Batch Scripts allows you to open any data file whose format is known to BESA Research.</span></span>
+
== File List Tab ==
  
<span style="color:#3366ff;"><span style="color:#00000a;">When the Combine-Conditions or the Batch module is started, all currently opened (Combine-Conditions: averages only) files are displayed in the list.</span></span>
+
Define a list of files on which the operations will be performed. The tab is the same for Combine Conditions Scripts and for Batch Scripts. Combine Conditions Scripts only allows you to open BESA average files (e.g. <span style="color:#ff9c00;">'''<nowiki>*.fsg</nowiki>'''</span> and <span style="color:#ff9c00;">'''<nowiki>*.avr</nowiki>'''</span>, but also <span style="color:#ff9c00;">'''.mul'''</span>, <span style="color:#ff9c00;">'''.raw'''</span>, <span style="color:#ff9c00;">'''.swf'''</span>, and <span style="color:#ff9c00;">'''.foc'''</span> if the files have a defined pre-stimulus interval), whereas Batch Scripts allows you to open any data file whose format is known to BESA Research.
  
<span style="color:#3366ff;"><span style="color:#00000a;">To the right of each file name, the number of electrodes, total number of channels, and the sampling rate used in the file are displayed. In the Combine-Conditions module, the number of Epochs (segments) and the number of differently-named conditions are also shown.</span></span>
+
When the Combine-Conditions or the Batch module is started, all currently opened (Combine-Conditions: averages only) files are displayed in the list.
  
 +
To the right of each file name, the number of electrodes, total number of channels, and the sampling rate used in the file are displayed. In the Combine-Conditions module, the number of Epochs (segments) and the number of differently-named conditions are also shown.
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Add files to the list'''</span></span>
 
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Press the </span></span><span style="color:#3366ff;">'''Add File '''</span><span style="color:#3366ff;"><span style="color:#00000a;">button.</span></span>
+
'''Add files to the list'''
* <span style="color:#3366ff;"><span style="color:#00000a;">Drag one or more files from Windows Explorer onto the window.</span></span>
+
  
 +
* Press the <span style="color:#3366ff;">'''Add File '''</span> button.
 +
* Drag one or more files from Windows Explorer onto the window.
  
<div style="color:#00000a;"></div>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Remove files from the list'''</span></span>
+
'''Remove files from the list'''
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Right click on the file name and confirm the delete operation in the resulting dialog.</span></span>
+
* Right click on the file name and confirm the delete operation in the resulting dialog.
* <span style="color:#3366ff;"><span style="color:#00000a;">Mark one or more file names in the list (e.g. hold down the</span></span><span style="color:#3366ff;">''' Ctrl'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> key to mark multiple files). Right click to obtain the context menu and select "</span></span><span style="color:#3366ff;">'''Delete'''</span><span style="color:#3366ff;"><span style="color:#00000a;">", or just press the </span></span><span style="color:#3366ff;">'''Del '''</span><span style="color:#3366ff;"><span style="color:#00000a;">key.</span></span>
+
* Mark one or more file names in the list (e.g. hold down the<span style="color:#3366ff;">''' Ctrl'''</span> key to mark multiple files). Right click to obtain the context menu and select "<span style="color:#3366ff;">'''Delete'''</span>", or just press the <span style="color:#3366ff;">'''Del '''</span>key.
  
  
<div style="color:#00000a;"></div>
+
'''Reorder files within the current file list'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Reorder files within the current file list'''</span></span>
+
* Right click on the file name and select "'''''Move Up'''''" or "'''''Move Down'''''".
 +
* Mark one or more file names in the list (e.g. hold down the <span style="color:#3366ff;">'''Ctr'''</span>l key to mark multiple files). Right click to obtain the context menu and select "'''''Move Up'''''" or "'''''Move Down'''''", or hold down the<span style="color:#3366ff;">''' Ctrl'''</span> key '''and '''press the <span style="color:#3366ff;">'''Up'''</span> and <span style="color:#3366ff;">'''Down arrows'''</span>.
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Right click on the file name and select "</span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''''Move Up'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">" or "</span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''''Move Down'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">".</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Mark one or more file names in the list (e.g. hold down the </span></span><span style="color:#3366ff;">'''Ctr'''</span><span style="color:#3366ff;"><span style="color:#00000a;">l key to mark multiple files). Right click to obtain the context menu and select "</span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''''Move Up'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">" or "</span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''''Move Down'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">", or hold down the</span></span><span style="color:#3366ff;">''' Ctrl'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> key </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''and '''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">press the </span></span><span style="color:#3366ff;">'''Up'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and </span></span><span style="color:#3366ff;">'''Down arrows'''</span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
 
  
 +
'''Sort the current file list alphabetically'''
  
<div style="color:#00000a;"></div>
+
* Click on the File bar above the list
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Sort the current file list alphabetically'''</span></span>
 
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Click on the File bar above the list</span></span>
+
'''Save the current file list'''
  
 +
* Press the <span style="color:#3366ff;">'''Save File List'''</span> button.
  
<div style="color:#00000a;"></div>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Save the current file list'''</span></span>
+
'''Load a file list'''
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Press the </span></span><span style="color:#3366ff;">'''Save File List'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button.</span></span>
+
* Press the <span style="color:#3366ff;">'''Load File List'''</span> button, or the <span style="color:#3366ff;">'''Load Previous'''</span> button to load the most recently used file list.
  
  
<div style="color:#00000a;"></div>
+
'''Which conditions are read from a source file? (Combine-Conditions module only)'''
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Load a file list'''</span></span>
+
 
+
* <span style="color:#3366ff;"><span style="color:#00000a;">Press the </span></span><span style="color:#3366ff;">'''Load File List'''</span><span style="color:#3366ff;"><span style="color:#00000a;">&nbsp;button, or the </span></span><span style="color:#3366ff;">'''Load Previous'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button to load the most recently used file list.</span></span>
+
 
+
 
+
<div style="color:#00000a;"></div>
+
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Which conditions are read from a source file? (Combine-Conditions module only)'''</span></span>
+
 
+
* <span style="color:#3366ff;"><span style="color:#00000a;">Normally, all conditions are read from a source file. To exclude one or more segments from operations in the Combine Conditions module, mark the segments as artifacts in the main program display. It is sufficient for the beginning or the end of an artifact interval to be within the segment for the segment to be excluded.</span></span>
+
  
 +
* Normally, all conditions are read from a source file. To exclude one or more segments from operations in the Combine Conditions module, mark the segments as artifacts in the main program display. It is sufficient for the beginning or the end of an artifact interval to be within the segment for the segment to be excluded.
  
<div style="color:#00000a;"></div>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''File list from Combine Conditions:'''</span></span>
+
'''File list from Combine Conditions:'''
  
  
Line 77: Line 69:
  
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Don't try to open here... (Batch only)'''</span></span>
+
'''Don't try to open here... (Batch only)'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">By default, this checkbox is unchecked.</span></span>
+
By default, this checkbox is unchecked.
  
<span style="color:#3366ff;"><span style="color:#00000a;">In the checked state, BESA Research doesn't check if it can open the file. Use this function </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''only'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> if the file is ASCII and you want to use the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''ImportASCII '''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">batch command.</span></span>
+
In the checked state, BESA Research doesn't check if it can open the file. Use this function '''only''' if the file is ASCII and you want to use the '''ImportASCII '''batch command.
  
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''File List from Batch Scripts'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">:</span></span>
+
'''File List from Batch Scripts''':
  
 
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
  
 
[[Image:Batch processing (2).png]]
 
[[Image:Batch processing (2).png]]
  
 +
== <span style="color:#3366ff;"><span style="color:#00000a;">Batch Processing </span></span> ==
  
=== <span style="color:#3366ff;"><span style="color:#00000a;">Batch Processing </span></span> ===
+
=== Batch Processing Scripts ===
  
==== <span style="color:#3366ff;"><span style="color:#00000a;">Batch Processing Scripts</span></span> ====
+
With Batch Scripts, you can define a set of operations (e.g. Artifact Scan, Average, etc.) and apply these to several data files.
  
<span style="color:#3366ff;"><span style="color:#00000a;">With Batch Scripts, you can define a set of operations (e.g. Artifact Scan, Average) and apply these to several data files.</span></span>
+
These operations include
  
<span style="color:#3366ff;"><span style="color:#00000a;">These operations include</span></span>
+
* Load Paradigm
 +
* Artifact Scan
 +
* Average
 +
* Export (and Merge)
 +
* File Open (switch to another data file)
 +
* Set filters
 +
* Specify a montage (used, for example, for export to current montage)
 +
* Run automatic eye and EKG artifact correction
 +
* Define artifact topographies
 +
* Turn artifact correction and view on and off
 +
* Read and write events
 +
* Edit default block epoch (for export around triggers)
 +
* Edit triggers (for export around triggers)
 +
* Mark a block for export, or send the block to Source Analysis or Top View
 +
* Convert patterns to triggers
 +
* Attach auxiliary files (e.g. elp, sfp) to the data file
 +
* Send to MATLAB
 +
* Specify display configurations for the BESA Research Main, SA, and Top View windows
 +
* and more - see the full list of [[#Batch Commands|Batch Commands]]
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Load Paradigm</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Artifact Scan</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Average</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Export (and Merge)</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">File Open (switch to another data file)</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Set filters</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Specify a montage (used, for example, for export to current montage)</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Run automatic eye and EKG artifact correction</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Turn artifact correction and view on and off</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Read and write events</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Edit default block epoch (for export around triggers)</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Edit triggers (for export around triggers)</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Mark a block for export, or send the block to Source Analysis or Top View</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Convert patterns to triggers</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Attach auxiliary files (e.g. elp, sfp) to the data file</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Send to MATLAB</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Specify display configurations for the BESA Research Main, SA, and Top View windows</span></span>
 
  
 +
An additional set of commands are available for operations in the '''Source Analysis Module''', allowing to load, create and fit dipole models, and save the results.
  
<div style="color:#00000a;"></div>
+
A further set of commands apply to '''Time-Frequency Analysis''', allowing to start TFC, change the display, save results, and run the beamformer or DICS analyses on a selected time-frequency range.
  
<span style="color:#3366ff;"><span style="color:#00000a;">An additional set of commands are available for operations in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Source Analysis Module'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">, allowing to load, create and fit dipole models, and save the results.</span></span>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">A further set of commands apply to </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Time-Frequency Analysis'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">, allowing to start TFC, change the display, save results, and run the beamformer or DICS analyses on a selected time-frequency range.</span></span>
+
[[Image:Batch commands1.png]]
  
 +
These operations will be extended in future program releases.
  
[[Image:Batch processing (3).png]]
+
The module includes two tabbed windows:
  
<span style="color:#3366ff;"><span style="color:#00000a;">These operations will be extended in future program releases.</span></span>
+
* '''File List''': Define a list of files on which the operations will be performed.
 +
* '''Batch''': Define or load '''batch commands'''. Run the batch.
  
<span style="color:#3366ff;"><span style="color:#00000a;">The module includes two tabbed windows:</span></span>
+
=== Batch Tab ===
  
* <span style="color:#3366ff;"><span style="color:#00000a;">'''File List'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">: Define a list of files on which the operations will be performed.</span></span>
+
Load or define batch commands, and then apply them to the files in the File List.
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Batch'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">: Define or load </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''batch commands'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">. Run the batch.</span></span>
+
 
+
 
+
==== <span style="color:#3366ff;"><span style="color:#00000a;">Batch Tab</span></span> ====
+
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">Load or define batch commands, and then apply them to the files in the File List.</span></span>
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (4).png]]
 
[[Image:Batch processing (4).png]]
  
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Add Command'''</span></span>
+
'''Add Command'''
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''Add Command'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to add a new command to the batch. The following dialog is opened, showing the available commands:</span></span>
+
* Press <span style="color:#3366ff;">'''Add Command'''</span> to add a new command to the batch. The following dialog is opened, showing the available commands:
  
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
[[Image:Batch commands1.png]]
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
 
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
* Select the desired command and press <span style="color:#3366ff;">'''OK'''</span> or double-click on the command. A dialog box is opened, allowing to specify individual command parameters.
 +
* If you click on "Apply at beginning of batch" or "Apply at end of batch", the command will only be run at the beginning or the end of a batch. You can use this, for example, at the end of a batch to start a MATLAB script to perform statistics on the results of the batch.
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
 
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
'''Load and Save Batch'''
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
* Press <span style="color:#3366ff;">'''Load Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to load a previously defined batch or </span></span><span style="color:#3366ff;">'''Save Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to save the current batch to a file (</span></span><span style="color:#ff9c00;">'''<nowiki>*.bbat</nowiki>'''</span><span style="color:#3366ff;"><span style="color:#00000a;">).</span></span>
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
 
  
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
'''Load Previous'''
 
+
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
 
+
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
 
+
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
 
+
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
 
+
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
 
+
<div style="color:#00000a;margin-left:0.635cm;margin-right:0cm;"></div>
+
 
+
[[Image:Batch processing (3).png]]
+
 
+
 
+
* <span style="color:#3366ff;"><span style="color:#00000a;">Select the desired command and press</span></span><span style="color:#3366ff;">''' OK '''</span><span style="color:#3366ff;"><span style="color:#00000a;">or double-click on the command. A dialog box is opened, allowing to specify individual command parameters.</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">If you click on "Apply at beginning of batch" or "Apply at end of batch", the command will only be run at the beginning or the end of a batch. You can use this, for example, at the end of a batch to start a Matlab script to perform statistics on the results of the batch.</span></span>
+
 
+
 
+
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Load and Save Batch'''</span></span>
+
 
+
* <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''Load Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to load a previously defined batch or </span></span><span style="color:#3366ff;">'''Save Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to save the current batch to a file (</span></span><span style="color:#ff9c00;">'''<nowiki>*.bbat</nowiki>'''</span><span style="color:#3366ff;"><span style="color:#00000a;">).</span></span>
+
 
+
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Load Previous'''</span></span>
+
  
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''Load Previous'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to load the most recently used batch file. Whenever a batch is run, the current set of commands is written to the file </span></span><span style="color:#ff9c00;">'''Previous.bbat in'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> the </span></span><span style="color:#3366ff;">'''Scripts/Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> subdirectory. This file is loaded when you press </span></span><span style="color:#3366ff;">'''Load Previous'''</span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''Load Previous'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to load the most recently used batch file. Whenever a batch is run, the current set of commands is written to the file </span></span><span style="color:#ff9c00;">'''Previous.bbat in'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> the </span></span><span style="color:#3366ff;">'''Scripts/Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> subdirectory. This file is loaded when you press </span></span><span style="color:#3366ff;">'''Load Previous'''</span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
  
  
<div style="color:#00000a;margin-left:1.27cm;margin-right:0cm;"></div>
+
'''Clear All'''
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Clear All'''</span></span>
+
  
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Clears all commands from the window.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Clears all commands from the window.</span></span>
  
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''View Log File'''</span></span>
+
'''View Log File'''
  
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Each time a batch is run, BESA Research adds information about the batch to a log file, with headings showing the date and time the batch was started. The file is opened automatically in Internet Explorer if errors occurred during processing. Otherwise you may open the file by </span></span><span style="color:#3366ff;"><span style="color:#00000a;">pressing the </span></span><span style="color:#3366ff;">'''View Log File'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button here or in the dialog that is displayed at the end of batch processing. </span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Each time a batch is run, BESA Research adds information about the batch to a log file, with headings showing the date and time the batch was started. The file is opened automatically in Internet Explorer if errors occurred during processing. Otherwise you may open the file by </span></span><span style="color:#3366ff;"><span style="color:#00000a;">pressing the </span></span><span style="color:#3366ff;">'''View Log File'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button here or in the dialog that is displayed at the end of batch processing. </span></span>
* <span style="color:#3366ff;"><span style="color:#00000a;">The log file is saved in xml format, and a JavaScript is used to format the display in Internet Explorer or Netscape family browsers. JavaScript should be enabled in the browser to obtain an optimal display of the results. If JavaScript is enabled, the log file is displayed as a list of headings for each batch. Click on a heading to display the results of the corresponding batch.</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">The log file is saved in xml format, and a JavaScript is used to format the display in web browsers. JavaScript should be enabled in the browser to obtain an optimal display of the results. If JavaScript is enabled, the log file is displayed as a list of headings for each batch. Click on a heading to display the results of the corresponding batch.</span></span>
* <span style="color:#3366ff;"><span style="color:#00000a;">To open the log file in NotePad, hold the</span></span><span style="color:#3366ff;">''' Shift '''</span><span style="color:#3366ff;"><span style="color:#00000a;">key down when pressing the </span></span><span style="color:#3366ff;">'''View Log File'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button.</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">To open the log file in the Notepad, hold the</span></span><span style="color:#3366ff;">''' Shift '''</span><span style="color:#3366ff;"><span style="color:#00000a;">key down when pressing the </span></span><span style="color:#3366ff;">'''View Log File'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button.</span></span>
  
  
<div style="color:#00000a;"></div>
+
'''Batch Command List'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Batch Command List'''</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">Double-click on a command to edit it. See </span>[[#Batch Commands|Batch Commands]]</span><span style="color:#3366ff;"><span style="color:#00000a;"> for descriptions of the dialogs that are opened to edit each command.</span></span>
* <span style="color:#3366ff;"><span style="color:#00000a;">Double-click on a command to edit it. See chapter “</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Batch Commands”''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> for descriptions of the dialogs that are opened to edit each command.</span></span>
+
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Right click on a command to open a context menu allowing more options.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Right click on a command to open a context menu allowing more options.</span></span>
  
Line 231: Line 180:
  
  
 
+
'''Single Step Mode'''
<div style="color:#00000a;"></div>
+
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Single Step Mode'''</span></span>
+
  
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Check this item to step through the batch, one command at a time. A dialog is opened after each command, allowing to run the next command, continue the batch without single steps, or stop running the batch. See the</span></span><span style="color:#3366ff;"><span style="color:#00000a;">'' “Pause''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">” command for further details.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Check this item to step through the batch, one command at a time. A dialog is opened after each command, allowing to run the next command, continue the batch without single steps, or stop running the batch. See the</span></span><span style="color:#3366ff;"><span style="color:#00000a;">'' “Pause''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">” command for further details.</span></span>
Line 240: Line 186:
  
  
<div style="color:#00000a;"></div>
+
'''Changes in batch written to database'''
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Changes in batch written to database'''</span></span>
+
  
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Checked by default. If this item is unchecked, file display settings, such as Montage setting and Artifact correction display, are not written to the database. When the file is next opened in BESA Research, the settings made in the batch are not retained.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Checked by default. If this item is unchecked, file display settings, such as Montage setting and Artifact correction display, are not written to the database. When the file is next opened in BESA Research, the settings made in the batch are not retained.</span></span>
  
  
<div style="color:#00000a;"></div>
+
'''Leave files in the file list open after running the batch'''
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">'''Leave files in the file list open after running the batch'''</span></span>
+
  
 
* <span style="color:#3366ff;"><span style="color:#00000a;">If this item is checked, files in the file list will remain open after the batch. This is useful, for instance, if you want to open a set of files, specifying the same montage and/or filter settings for each file.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">If this item is checked, files in the file list will remain open after the batch. This is useful, for instance, if you want to open a set of files, specifying the same montage and/or filter settings for each file.</span></span>
  
  
<div style="color:#00000a;"></div>
+
Press <span style="color:#3366ff;">'''OK'''</span> to start running the batch. Each command is then applied in succession to each file in the File List.
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to start running the batch. Each command is then applied in succession to each file in the </span></span>
+
 
+
<span style="color:#3366ff;"><span style="color:#00000a;">File List.</span></span>
+
  
 
<span style="color:#3366ff;"><span style="color:#ff0000;">Note that, while a batch is running press and hold down the</span></span><span style="color:#3366ff;">''' Pause'''</span><span style="color:#3366ff;"><span style="color:#ff0000;"> or </span></span><span style="color:#3366ff;">'''Delete'''</span><span style="color:#3366ff;"><span style="color:#ff0000;"> key to interrupt the batch and enter Single Step Mode. Press and hold down the </span></span><span style="color:#3366ff;">'''Esc'''</span><span style="color:#3366ff;"><span style="color:#ff0000;"> key to cancel the batch.</span></span>
 
<span style="color:#3366ff;"><span style="color:#ff0000;">Note that, while a batch is running press and hold down the</span></span><span style="color:#3366ff;">''' Pause'''</span><span style="color:#3366ff;"><span style="color:#ff0000;"> or </span></span><span style="color:#3366ff;">'''Delete'''</span><span style="color:#3366ff;"><span style="color:#ff0000;"> key to interrupt the batch and enter Single Step Mode. Press and hold down the </span></span><span style="color:#3366ff;">'''Esc'''</span><span style="color:#3366ff;"><span style="color:#ff0000;"> key to cancel the batch.</span></span>
  
  
==== <span style="color:#3366ff;"><span style="color:#00000a;">The log file</span></span> ====
+
=== The log file ===
  
<span style="color:#3366ff;"><span style="color:#00000a;">A protocol of each batch is written to the log file </span></span><span style="color:#ff9c00;">'''Scripts/Log/Batch.xml.'''</span>
+
A protocol of each batch is written to the log file <span style="color:#ff9c00;">'''Batch.txt.'''</span> (e.g. C:\Users\Public\Documents\BESA\Research_7_1\Scripts\Log\Batch.txt)
  
<span style="color:#3366ff;"><span style="color:#00000a;">When you press the </span></span><span style="color:#3366ff;">'''View Log File '''</span><span style="color:#3366ff;"><span style="color:#00000a;">button, the file is opened in your default browser for xml files. The file will be opened automatically if there was an error during batch processing, unless you have used the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''BatchError''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> batch command to suppress this behavior.</span></span>
+
When you press the <span style="color:#3366ff;">'''View Log File'''</span> button, the file is opened in the Batch Log dialog. The Batch Log dialog will be opened automatically if there was an error during batch processing, unless you have used the ''BatchError'' batch command to suppress this behaviour.
  
 +
'''Backup of the log file'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''DHTML formatting of the log file'''</span></span>
+
When the log file is written, a backup of the previous version is written to <span style="color:#ff9c00;">'''Batch.txt.bak'''</span>.
  
<span style="color:#3366ff;"><span style="color:#00000a;">The xml file is formatted using JavaScript (Dynamic HTML). If JavaScript is enabled in your browser, you will first see a list of batch protocol titles, labeled by the date and time at which the batch was started. The most recent batch is at the top of the list.:</span></span>
+
If the size of the log file exceeds 200 KB, it is renamed to <span style="color:#ff9c00;">'''Batch.txt_date_time'''</span> (e.g. <span style="color:#ff9c00;">'''Batch.txt_2004-10-08_10-53-32'''</span>), and a new version of <span style="color:#ff9c00;">'''Batch.txt'''</span> is created.
  
 +
=== Placeholders ===
  
[[Image:Batch processing (6).png]]
+
A powerful feature of the batch commands is the ability to define file names and specify standard paths using placeholders. These are text strings enclosed by percentage (%) signs. They can be used in all batch commands where file names are specified.
  
<span style="color:#3366ff;"><span style="color:#00000a;">Click on the title to view the protocol for the corresponding batch:</span></span>
 
  
 +
'''Basename'''
  
<div style="color:#00000a;"></div>
+
{| class="wikitable"
 +
! Placeholder !! Description !! Example
 +
|-
 +
|style="text-align:center;" width="10%"|'''%basename%'''
 +
|width="40%"|replaced by the basename of the currently opened file.
 +
|width="40%"|If the data file is named "<span style="color:#ff9c00;">f-spike.fsg</span>", "<span style="color:#ff9c00;">%basename%-export.fsg</span>" will be interpreted as "<span style="color:#ff9c00;">f-spike-export.fsg</span>".
 +
|-
 +
|style="text-align:center;"|'''%basename-n%'''
 +
|replaced by the basename of the currently opened file, but removing the last "n" characters from the name.
 +
|If the data file is named "<span style="color:#ff9c00;">dongle-BB.fsg</span>", "<span style="color:#ff9c00;">%basename-3%</span>" will be replaced by "<span style="color:#ff9c00;">dongle</span>", because the last 3 characters of the basename have been removed.
 +
|-
 +
|style="text-align:center;"|'''%-nbasename%'''
 +
|replaced by the basename of the currently opened file, but removing the first "n" characters from the name.
 +
|If the data file is named "<span style="color:#ff9c00;">BB-dongle.fsg</span>", "<span style="color:#ff9c00;">%-3basename%</span>" will be replaced by "<span style="color:#ff9c00;">dongle</span>", because the first 3 characters of the basename have been removed.
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%orgbasename%'''</u></span>
 +
|replace by basename of the current file in the file list (it has the same meaning as %basename% if no MAINFileOpen batch command was used in command list)
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%base%'''</u></span>
 +
|replace by basename of the current file without the path
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%orgbase%'''</u></span>
 +
|replace by basename of the current file in the file list without the path
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%ext%'''</u></span>
 +
|replace by extension of the current file
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%orgext%'''</u></span>
 +
|replace by extension of the current file in the file list
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%basefolder%'''</u></span>
 +
|replace by folder of the current file
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.1 or higher"><u>'''%orgbasefolder%'''</u></span>
 +
|replace by folder of the current file in the file list
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.0 or higher"><u>'''%t%'''</u></span>
 +
|Log batch command only: time since start of batch on current file
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.0 or higher"><u>'''%T%'''</u></span>
 +
|Log batch command only: current date and time
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.0 or higher"><u>'''%label%'''</u></span>
 +
|Replace label of the most recent marked block by the block label, not including no. of averages
 +
|
 +
|-
 +
|style="text-align:center;"|<span title="Requires BESA Research 7.0 or higher"><u>'''%LABEL%'''</u></span>
 +
| Replace label of the most recent marked block by the block label, including no. of averages
  
<div style="color:#00000a;"></div>
+
|
 +
|-
 +
|style="text-align:center;"|'''%scripts%'''
 +
|replaced by the path to the Scripts folder.
 +
|"<span style="color:#ff9c00;">%scripts%Batch</span>" is where batches are saved by default; "<span style="color:#ff9c00;">%scripts%MATLAB</span>" is the location of the standard MATLAB scripts used by BESA Research.
 +
|-
 +
|style="text-align:center;"|'''%montages%'''
 +
|replaced by the path to the Montages folder.
 +
|
 +
|-
 +
|style="text-align:center;"|'''%examples%'''
 +
|replaced by the path to the Examples folder.
 +
|
 +
|}
  
<div style="color:#00000a;"></div>
+
<!--
 +
* '''%basename%''' -- replaced by the basename of the data file in the File List. For example, if the data file is named "<span style="color:#ff9c00;">f-spike.fsg</span>", "<span style="color:#ff9c00;">%basename%-export.fsg</span>" will be interpreted as "<span style="color:#ff9c00;">f-spike-export.fsg</span>".
  
[[Image:Batch processing (7).png]]
+
* '''%basename-n%''' -- replaced by the basename of the data file in the File List, but removing the last "n" characters from the name. For example, if the data file is named "<span style="color:#ff9c00;">dongle-BB.fsg</span>", "<span style="color:#ff9c00;">%basename-3%</span>" will be replaced by "<span style="color:#ff9c00;">dongle</span>", because the last 3 characters of the basename have been removed.
  
 +
* '''%-nbasename%''' -- replaced by the basename of the data file in the File List, but removing the first "n" characters from the name. For example, if the data file is named "<span style="color:#ff9c00;">BB-dongle.fsg</span>", "<span style="color:#ff9c00;">%-3basename%</span>" will be replaced by "<span style="color:#ff9c00;">dongle</span>", because the first 3 characters of the basename have been removed.
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''JavaScript and XP Service Pack 2'''</span></span>
+
* '''%scripts%''' -- replaced by the path to the Scripts folder (e,g, "<span style="color:#ff9c00;">%scripts%Batch</span>" is where batches are saved by default; "<span style="color:#ff9c00;">%scripts%MATLAB</span>" is the location of the standard Matlab scripts used by BESA Research).
  
<span style="color:#3366ff;"><span style="color:#00000a;">By default, if the log file is opened in Internet Explorer after XP Service Pack 2 has been installed, IE will warn you with the message: "</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''To help protect your security, Internet Explorer has restricted this file from''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''showing active content that could access your computer".''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> All the protocols in the log file are displayed. You may safely click on the options to allow active content in the log file, if you want to display the file as described above.</span></span>
+
* '''%montages%''' -- replaced by the path to the Montages folder.
  
 +
* '''%examples%''' -- replaced by the path to the Examples folder.
 +
-->
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Backup of the log file'''</span></span>
+
'''Placeholders for folders'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">When the log file is written, a backup of the previous version is written to </span></span><span style="color:#ff9c00;">'''batch.xml.bak'''</span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
+
The following placeholders are the same as those used in the [Folders] section of <span style="color:#ff9c00;">'''Besa.ini'''</span>:
  
<span style="color:#3366ff;"><span style="color:#00000a;">If the size of the log file exceeds 200 KB, it is renamed to </span></span><span style="color:#ff9c00;">'''batch.xml_date_time'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> (e.g. </span></span><span style="color:#ff9c00;">'''Batch.xml_2004-10-08_10-53-32'''</span><span style="color:#3366ff;"><span style="color:#00000a;">), and a new version of </span></span><span style="color:#ff9c00;">'''batch.xml'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> is created.</span></span>
+
The strings enclosed by percent signs (%) are placeholders for the following folders in English-language versions of Windows. Folder names are different for the system and for other language settings. BESA Research will substitute the placeholders by the appropriate folder name for the Windows system and the system language:
  
  
==== <span style="color:#3366ff;"><span style="color:#00000a;">Placeholders</span></span> ====
+
* '''Windows 10 (English)'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">A powerful feature of the batch commands is the ability to define file names and specify standard paths using placeholders. These are text strings enclosed by percentage (%) signs. They can be used in all batch commands where file names are specified.</span></span>
+
<div style="margin-left:1.27cm;margin-right:0cm;"> '''%localapp%''' = ""C:\Users[user]\AppData\Local\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Desktop as ""Desktop[user]\AppData\Local\BESA\Research_7_1".</div>
  
<div style="color:#00000a;"></div>
+
<div style="margin-left:1.27cm;margin-right:0cm;"> '''%publicprog%''' = "Documents\BESA\Research_7_1".</div>
  
 +
<div style="margin-left:1.27cm;margin-right:0cm;">'''%privateprog%''' = ""C:\Users\[user]\Documents\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Desktop\[User]\Documents\BESA\Research_7_1".</div>
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Basename'''</span></span>
+
<div style="margin-left:1.27cm;margin-right:0cm;">'''%progdir%''' = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_7_1".</div>
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''%basename%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> -- replaced by the basename of the data file in the File List. For example, if the data file is named "</span></span><span style="color:#ff9c00;">'''f-spike.fsg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">", "</span></span><span style="color:#ff9c00;">'''%basename%-export.fsg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">" will be interpreted as "</span></span><span style="color:#ff9c00;">'''f-spike-export.fsg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">".</span></span>
+
<div style="margin-left:1.27cm;margin-right:0cm;">'''%besaroot%''' is the same as''' %progdir%'''</div>
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''%basename-n%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> -- replaced by the basename of the data file in the File List, but removing the last "n" characters from the name. For example, if the data file is named "</span></span><span style="color:#ff9c00;">'''dongle-BB.fsg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">", "%basename-3%" will be replaced by "dongle", because the last 3 characters of the basename have been removed.</span></span>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''%-nbasename%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> -- replaced by the basename of the data file in the File List, but removing the first "n" characters from the name. For example, if the data file is named "</span></span><span style="color:#ff9c00;">'''BB-dongle.fsg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">", "%-3basename%" will be replaced by "dongle", because the first 3 characters of the basename have been removed.</span></span>
+
* '''Windows 7 (English):'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''%scripts%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> -- replaced by the path to the Scripts folder (e,g, "%scripts%Batch" is where batches are saved by default; "%scripts%MATLAB" is the location of the standard Matlab scripts used by BESA Research).</span></span>
+
<div style="margin-left:1.27cm;margin-right:0cm;">'''%localapp%''' = "C:\Users\[user]\AppData\Local\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Desktop as "Desktop\[user]\AppData\Local\BESA\Research_7_1".</div>
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''%montages%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> --replaced by the path to the Montages folder.</span></span>
+
<div style="margin-left:1.27cm;margin-right:0cm;">'''%publicprog%''' = "C:\Users\Public\Public Documents\BESA\Research_7_1". This folder is directly accessible from the Windows Explorer under "Libraries\Documents\Public Documents\BESA\Research_7_1".</div>
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''%examples%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> -- replaced by the path to the Examples folder.</span></span>
+
<div style="margin-left:1.27cm;margin-right:0cm;">'''%privateprog%''' = "C:\Users\[user]\Documents\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as ""Libraries\Documents\My Documents\Research_7_1" or "Desktop\[User]\My Documents\BESA\Research_7_1".</div>
  
 +
<div style="margin-left:1.27cm;margin-right:0cm;">'''%progdir%''' = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_7_1".</div>
  
<div style="color:#00000a;"></div>
+
<div style="margin-left:1.27cm;margin-right:0cm;">'''%besaroot%''' is the same as''' %progdir% &nbsp;'''</div>
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Placeholders for folders'''</span></span>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">The following placeholders are the same as those used in the [Folders] section of </span></span><span style="color:#ff9c00;">'''Besa.ini'''</span><span style="color:#3366ff;"><span style="color:#00000a;">:</span></span>
+
=== Batch Commands ===
  
<span style="color:#3366ff;"><span style="color:#00000a;">The strings enclosed by percent signs (%) are placeholders for the following folders in English-language versions of Windows. Folder names are different for Vista and XP/2000 and for other language settings. BESA Research will substitute the placeholders by the appropriate folder name for the system (W2K, XP, Vista, or Win7) and the system language:</span></span>
+
Batch commands are selected when the "<span style="color:#3366ff;">'''Add Command'''</span>" button is pressed in the "Batch" Tab. The commands are subdivided into five categories: General commands, commands for the Main module, for the Source Analysis module, imaging commands in the Source Analysis module, and commands for Time-Frequency Analysis. The commands have prefixes,''' GEN''', '''MAIN''',''' SA''', '''SAIMAGE''', and''' TFC'''), which identify the category. For compatibility with older program versions, old batches without the prefixes are accepted.
  
 +
Detailed descriptions of each batch command are available in the electronic help chapter “''Batch Processing and Combining Conditions / Batch Processing / Batch Commands”.''
  
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Windows 7 (English)'''</span></span>
 
  
<div style="color:#00000a;margin-left:1.27cm;margin-right:0cm;"></div>
+
'''General commands''' - prefixed with "'''GEN'''" (can be used anywhere):
  
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%localapp%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Users\[user]\AppData\Local\BESA\Research_5_3", where [user] is the logon name of the current user. This folder is directly accessible from the Desktop as "Desktop\[user]\AppData\Local\BESA\Research_5_3".</span></span></div>
+
{| cellspacing="8" style
 +
| style="width: 180pt"| GENBatchError || used to change program behavior when errors occur
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>GENBatchWindowPosition</u></span> || set the position of the batch window relative to the main window
 +
|-
 +
| GENComment || comment in the batch script: no batch functionality
 +
|-
 +
| GENMATLABcommand || send a command string to MATLAB
 +
|-
 +
| GENMATLABwaitForVariable || tells BESA to wait until Matlab has created a variable with the specified name.
 +
|-
 +
| GENPause || pause batch operations, allowing step-by-step operations
 +
|-
 +
| GENFor/GENEndFor|| a programming language-like FOR loop
 +
|-
 +
| GENRunProcess || runs a command-line process, e.g. an external program to perform part of the data analysis in the batch
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>GENsaveBitmap</u></span> || save a screenshot of the Source Analysis or the 3D window
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>SetVariable</u></span> || the value of the variable is inserted into subsequent batch commands where the text contains the name flanked by % signs
 +
|-
 +
| GENWindowPosition || set window size and positions to a selection of standard settings, e.g. for bitmap export
 +
|}
  
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%publicprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Users\Public\Public Documents\BESA\Research_5_3". This folder is directly accessible from the Windows Explorer under "Libraries\Documents\Public Documents\BESA\Research_5_3".</span></span></div>
 
  
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%privateprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Users\[user]\Documents\BESA\Research_5_3", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Libraries\Documents\My Documents\Research_5_3" or "Desktop\[User]\My Documents\BESA\Research_5_3.</span></span></div>
+
'''Commands for the Main Module''' - prefixed with "'''MAIN'''":
  
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%progdir%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_5_3".</span></span></div>
+
{| cellspacing="8"
 +
| style="width: 180pt"| MAINArtifactCorrect || run automatic artifact correction
 +
|-
 +
| MAINArtifactMethod || specify the method for artifact correction
 +
|-
 +
| MAINArtifactOn || turn artifact correction an artifact view on or off
 +
|-
 +
| MAINArtifact Scan || run an artifact scan as from the Paradigm Dialog
 +
|-
 +
| MAINAuxiliaryFiles || associate auxiliary files (e.g. *.''ela'', *.''sfp'') with the data file
 +
|-
 +
| MAINAverage || average the data
 +
|-
 +
| MAINBaseline || specify the parameters for baseline correction
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINDefineArtifactTopography</u></span> || define an artifact topography
 +
|-
 +
| MAINEditDefaultEpoch || edit the default block epoch
 +
|-
 +
| MAINEventRead || read events from an ASCII event file
 +
|-
 +
| MAINEventWrite || write events to an ASCII event file
 +
|-
 +
| MAINExport || export or append data in the selected target format
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINExportToBESAConnectivity</u></span> || export data segments to BESA Connectivity
 +
|-
 +
| MAINFFT || calculates the FFT spectrum of the marked data interval
 +
|-
 +
| MAINFFTmean || starts an averaging procedure that calculates the mean spectral properties in pre-defined regions
 +
|-
 +
| MAINFFTsave || saves FFT data (generated using the ''FFT Average option'' in the ''Average ''command) to disk (*.''fma)''
 +
|-
 +
| MAINFileOpen || close the current file and open a new file to which the remaining batch commands will be applied
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINFileClose</u></span> || close the currently open file in a batch, provided it is not the current file in the File List
 +
|-
 +
| MAINFilter || set filters
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINfMRIArtifact</u></span> || turns on the fMRI artifact removal
 +
|-
 +
| MAINGoTo || jumps with the cursor to the specified time point
 +
|-
 +
| MAINICA || starts ICA decomposition of data on the current screen
 +
|-
 +
| MAINICAsave || saves selected ICA components as topographies in a file
 +
|-
 +
| MAINICAselect || opens component selection dialog for managing ICA components
 +
|-
 +
| MAINImportASCII || import an ASCII file into a ''<nowiki>*.fsg</nowiki>'' file.
 +
|-
 +
| MAINMarkBlock || mark a data block (optionally send to Source Analysis)
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINMarkChannels</u></span> || mark one or more channels, as given by the list
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINMaxInInterval</u></span> || within the current marked block, search for the largest absolute value on the specified channel
 +
|-
 +
| MAINMontage || change the montage (used by the Export command when saving to current montage)
 +
|-
 +
| MAINParadigm || load a paradigm file
 +
|-
 +
| MAINPatternToTrigger || convert a tag into a trigger
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINPolygraphicFilters</u></span> || sets filters for polygraphic or added channels
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINScale</u></span> || set amplitude and time scales
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINSearchAverageView</u></span> || start search average view
 +
|-
 +
| MAINSendToMATLAB || send data to MATLAB
 +
|-
 +
| MAINSMTApply || load and apply Schmitt trigger settings file to the data set
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINSplineConstant</u></span> || set the spline constant used in spherical spline maps and channel interpolation
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINTriggerRecode</u></span> || the command recodes a specified trigger number to a new number
 +
|-
 +
| MAINTriggerSelect || edit the trigger list (cf. ''Edit / Trigger Values''...)
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINTriggerTagDelete</u></span> || delete one or more triggers or tags
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>MAINViewAverageBuffer</u></span> || turn on the Average Buffer View and place the specified buffer number to the left in the display
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINViewChannelType</u></span> || select the channel type to display, and select channel types for mapping, export, etc
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>MAINViewSelected</u></span> || turns selected view on or off
 +
|}
  
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%besaroot%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> is the same as</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''' %progdir%'''</span></span></div>
 
  
 +
'''General commands for Source Analysis''' - prefixed with "'''SA'''" (but see also ''MarkBlock'', which is used to send a block of data to SA and open the SA window):
  
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Windows Vista (English):'''</span></span>
+
{| cellspacing="8"
 +
| style="width: 180pt"| SAAddSource || add a dipole or regional source to a model
 +
|-
 +
| SAChannelTypeForFit || switch between EEG, magnetometers or axial gradiometers, and planar gradiometers
 +
|-
 +
| SAConvertSource || convert a source from dipole to regional source, or from regional source to dipole
 +
|-
 +
| SAcorticalClara || run Cortical CLARA
 +
|-
 +
| SAcorticalLoreta || run Cortical LORETA
 +
|-
 +
| SADelete || delete current solution or all solutions or remove current fit interval or cursor
 +
|-
 +
| SADICS || start DICS computation (if DICS has been precomputed in the time-frequency image command)
 +
|-
 +
| SADisplayMRI || switch MRI display on/off and select small or large window
 +
|-
 +
| <span title="Requires BESA Research 7.0 or higher"><u>SAElectrodeConfiguration</u></span> || equivalent to pressing the Org or Std button in the Channel box of the Source analysis window
 +
|-
 +
| SAExit || close Source Module
 +
|-
 +
| SAFit || start fit
 +
|-
 +
| SAFitConstraint || set fit constraints, e.g. Residual Variance, Energy, Maximum Distance, Image Weighting, and their weights.
 +
|-
 +
| SAFitInterval || set fit or baseline interval
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>SAHeadModel</u></span> || set the head model
 +
|-
 +
| <span title="Requires BESA Research 7.1 or higher"><u>SALabelSource</u></span> || set the label of the specified source number
 +
|-
 +
| SAMinimumNorm || run a minimum norm analysis
 +
|-
 +
| SANewSolution || open a new solution
 +
|-
 +
| SAOpenSolution || open a solution from a file
 +
|-
 +
| SAPCA || toggle PCA display of data or residual, and transfer a selected number of components to the source model
 +
|-
 +
| SARegularization || set the regularization values both for discrete and distributed source images
 +
|-
 +
| SASaveBitmap || save a screenshot of the Source Analysis or the 3D window
 +
|-
 +
| SASaveLeadfields || save the leadfields of the current source model
 +
|-
 +
| SASaveModelWaveforms || save model waveforms
 +
|-
 +
| SASaveResidualWaveforms || save residual waveforms
 +
|-
 +
| SASaveRVandGFPWaveforms || save residual variance and global field power waveforms
 +
|-
 +
| SASaveSolution || save the current solution
 +
|-
 +
| SASaveSourceMontage || save a source montage
 +
|-
 +
| SASaveSourceWaveforms || save source waveforms
 +
|-
 +
| SASendToMATLAB || send data, model, source waveforms, images, etc. to Matlab
 +
|-
 +
| SASetCursor || set the cursor
 +
|-
 +
| SASetDefaultSourceType || set the default source type (dipole or regional source)
 +
|-
 +
| SASetOrActivateSource || Turn specified source on or off, or enable/disable source for fitting
 +
|-
 +
| SASetOrientation || set orientation (of regional source)
 +
|-
 +
| SASwitchCondition || switch to a specified condition
 +
|}
  
<div style="color:#00000a;"></div>
 
  
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%localapp%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Users\[user]\AppData\Local\BESA\Research_5_3", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Desktop\[user]\AppData\Local\BESA\Research_5_3".</span></span></div>
+
'''Commands for Distributed 3D Volume Images'''
  
<div style="color:#00000a;"></div>
+
{| cellspacing="8"
 
+
| style="width: 180pt"| SAIMAGEBeamformer || switch between Single Source and Bilateral Beamformer image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%publicprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Users\Public\Public Documents\BESA\Research_5_3". This folder is directly accessible from the Windows Explorer under "Desktop\Public\Public Documents\BESA\Research_5_3".</span></span></div>
+
|-
 
+
| <span title="Requires BESA Research 7.1 or higher"><u>SAIMAGEBeamformerTimeDomain</u></span> || start beamformer computation in the time domain
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%privateprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Users\[user]\Documents\BESA\Research_5_3", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Desktop\[user]\Documents\BESA\Research_5_3".</span></span></div>
+
|-
 
+
| SAimageBrainAtlas || turns on the Brain Atlas overlay on volumetric image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%progdir%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_5_3".</span></span></div>
+
|-
 
+
| SAIMAGECLARA || generate CLARA image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%besaroot%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> is the same as</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''' %progdir% &nbsp;'''</span></span></div>
+
|-
 
+
| SAIMAGEClip || clip image values under a threshold
 
+
|-
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Windows XP (English):'''</span></span>
+
| SAIMAGEExport || save the results of minimum norm or 3D imaging method
 
+
|-
<div style="color:#00000a;"></div>
+
| SAIMAGEGotoMax || set the crosshair cursor at the nth maximum in the image
 
+
|-
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%localapp%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Documents and Settings\[user]\Local Settings\Application Data\BESA\Research_5_3", where [user] is the logon name of the current user.</span></span></div>
+
| SAIMAGEImport || load a 3D volume image from file
 
+
|-
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%publicprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Documents and Settings\All Users\Documents\BESA\Research_5_3". This folder is directly accessible from the Windows Explorer under "Desktop\Shared Documents\BESA\Research_5_3".</span></span></div>
+
| SAimageImportFMRI || import fMRI image to Source Analysis Module
 
+
|-
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%privateprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Documents and Settings\[user]\My Documents\BESA\Research_5_3", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Desktop\My Documents\BESA\Research_5_3".</span></span></div>
+
| SAIMAGELAURA || create LAURA image
 
+
|-
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%progdir%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_5_3".</span></span></div>
+
| SAIMAGELORETA || create LORETA image
 
+
|-
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%besaroot%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> is the same as </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''%progdir%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> &nbsp;</span></span></div>
+
| SAIMAGESLoreta || create sLORETA image
 
+
|-
 
+
| SAimageSESAME || start SESAME computation
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Windows 2000 (English):'''</span></span>
+
|-
 
+
| SAIMAGESSLOFO || create SSLOFO image
<div style="color:#00000a;"></div>
+
|-
 
+
| SAIMAGEUser-Defined || create user-defined image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%localapp%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Documents and Settings\[user]\Local Settings\Application Data\BESA\Research_5_3", where [user] is the logon name of the current user.</span></span></div>
+
|-
 
+
| SAIMAGESaveLeadfields || save the leadfields of all the voxel sources in a 3D image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%publicprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Documents and Settings\All Users\Documents\BESA\Research_5_3".</span></span></div>
+
|-
 
+
| SAIMAGEClip || clip current 3D image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%privateprog%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = "C:\Documents and Settings\[user]\My Documents\BESA\Research_5_3", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Desktop\My Documents\BESA\Research_5_3".</span></span></div>
+
|-
 
+
| SAIMAGESmooth || smooth current 3D image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%progdir%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\\Research_5_3".</span></span></div>
+
|-
 
+
| SAIMAGESetCrosshair || set the position of the crosshair in the 3D image
<div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">'''%besaroot%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> is the same as </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''%progdir%'''</span></span></div>
+
|}
 
+
 
+
==== <span style="color:#3366ff;"><span style="color:#00000a;">Batch Commands</span></span> ====
+
 
+
Batch commands are selected when the "<span style="color:#3366ff;">'''Add Command'''</span>" button is pressed in the Batch Tab. The commands are subdivided into five categories: General commands, commands for the Main module, for the Source Analysis module, imaging commands in the Source Analysis module, and commands for Time-Frequency Analysis. The commands have prefixes,''' GEN''', '''MAIN''',''' SA''', '''SAIMAGE''', and''' TFC'''), which identify the category. For compatibility with older program versions, old batches without the prefixes are accepted.
+
 
+
Detailed descriptions of each batch command are available in the electronic help chapter “''Batch Processing and Combining Conditions / Batch Processing / Batch Commands”.''
+
 
+
 
+
'''General commands''' -- prefixed with "'''GEN'''" (can be used anywhere):* GENBatchError -- used to change program behavior when errors occur.
+
* GENComment -- comment in the batch script: no batch functionality
+
* GENMATLABcommand -- send a command string to Matlab.
+
* GENMATLABwaitForVariable -- tells BESA to wait until Matlab has created a variable with the specified name.
+
* GENPause -- pause batch operations, allowing step-by-step operations
+
* GENFor/GENEndFor -- a programming language-like FOR loop
+
* GENRunProcess -- runs a command line process, e.g. an external program to perform part of the data analysis in the batch
+
* GENWindowPosition -- set window size and positions to a selection of standard settings, e.g. for bitmap export
+
 
+
 
+
'''Commands for the Main Module''' -- prefixed with "'''MAIN'''":
+
* MAINArtifactCorrect -- run automatic artifact correction
+
* MAINArtifactMethod -- specify the method for artifact correction
+
* MAINArtifactOn -- turn artifact correction an artifact view on or off
+
* MAINArtifact Scan -- run an artifact scan as from the Paradigm Dialog
+
* MAINAuxiliaryFiles -- associate auxiliary files (e.g. *.''ela'', *.''sfp'') with the data file
+
* MAINAverage -- average the data
+
* MAINBaseline -- specify the parameters for baseline correction
+
* MAINEditDefaultEpoch -- edit the default block epoch
+
* MAINEventRead -- read events from an ASCII event file
+
* MAINEventWrite -- write events to an ASCII event file
+
* MAINExport -- export or append data in the selected target format
+
* MAINFFT -- calculates the FFT spectrum of the marked data interval
+
* MAINFFTmean -- starts an averaging procedure which calculates the mean spectral properties in pre-defined regions
+
* MAINFFTsave -- saves FFT data (generated using the ''FFT Average option'' in the ''Average ''command) to disk (*.''fma)''
+
* MAINFileOpen -- close the current file and open a new file to which the remaining batch commands will be applied
+
* MAINFilter -- set filters
+
* MAINGoTo -- jumps with the cursor to the specified time point
+
* MAINICA -- starts ICA decomposition of data on the current screen
+
* MAINICAsave -- saves selected ICA components as topographies in a file
+
* MAINICAselect -- opens component selection dialog for managing ICA components
+
* MAINImportASCII -- import an ASCII file into a ''<nowiki>*.fsg</nowiki>'' file.
+
* MAINMarkBlock -- mark a data block (optionally send to Source Analysis)
+
* MAINMontage -- change the montage (used by the Export command when saving to current montage)
+
* MAINParadigm -- load a paradigm file
+
* MAINPatternToTrigger -- convert a tag into a trigger
+
* MAINSendToMATLAB -- send data to Matlab
+
* MAINTriggerSelect -- edit the trigger list (cf. ''Edit / Trigger Values''...)
+
 
+
 
+
'''General commands for Source Analysis''' -- prefixed with "'''SA'''" (but see also ''MarkBlock'', which is used to send a block of data to SA and open the SA window):
+
* SAAddSource -- add a dipole or regional source to a model
+
* SAChannelTypeForFit -- switch between EEG, magnetometers or axial gradiometers, and planar gradiometers
+
* SAConvertSource -- convert a source from dipole to regional source, or from regional source to dipole
+
* SAcorticalClara -- run Cortical CLARA
+
* SAcorticalLoreta -- run Cortical LORETA
+
* SADelete -- delete current solution or all solutions, or remove current fit interval or cursor
+
* SADICS -- start DICS computation (if DICS has been precomputed in the time-frequency image command)
+
* SADisplayMRI -- switch MRI display on/off and select small or large window
+
* SAExit -- close Source Module
+
* SAFit -- start fit
+
* SAFitConstraint -- set fit constraints, e.g. Residual Variance, Energy, Maximum Distance, Image Weighting, and their weights.
+
* SAFitInterval -- set fit or baseline interval
+
* SAMinimumNorm -- run a minimum norm analysis
+
* SANewSolution -- open a new solution
+
* SAOpenSolution -- open a solution from a file
+
* SAPCA -- toggle PCA display of data or residual, and transfer a selected number of components to the source model
+
* SARegularization -- set the regularization values both for discrete and distributed source images
+
* SASaveBitmap -- save a screenshot of the Source Analysis or the 3D window
+
* SASaveLeadfields -- save the leadfields of the current source model
+
* SASaveModelWaveforms -- save model waveforms
+
* SASaveResidualWaveforms -- save residual waveforms
+
* SASaveRVandGFPWaveforms -- save residual variance and global field power waveforms
+
* SASaveSolution -- save the current solution
+
* SASaveSourceMontage -- save a source montage
+
* SASaveSourceWaveforms -- save source waveforms
+
* SASendToMATLAB -- send data, model, source waveforms, images, etc. to Matlab
+
* SASetCursor -- set the cursor
+
* SASetDefaultSourceType -- set the default source type (dipole or regional source)
+
* SASetOrActivateSource -- Turn specified source on or off, or enable/disable source for fitting
+
* SASetOrientation -- set orientation (of regional source)
+
* SASwitchCondition -- switch to a specified condition
+
 
+
 
+
'''Commands for Distributed 3D Volume Images'''
+
* SAIMAGEBeamformer -- switch between Single Source and Bilateral Beamformer image
+
* SAIMAGECLARA -- generate CLARA image
+
* SAIMAGEExport -- save the results of minimum norm or 3D imaging method
+
* SAIMAGEGotoMax -- set the crosshair cursor at the nth maximum in the image
+
* SAIMAGEImport -- load a 3D volume image from file
+
* SAIMAGELAURA -- create LAURA image
+
* SAIMAGELORETA -- create LORETA image
+
* SAIMAGESLoreta -- create sLORETA image
+
* SAIMAGESSLOFO -- create SSLOFO image
+
* SAIMAGEUser-Defined -- create user-defined image
+
* SAIMAGESaveLeadfields -- save the leadfields of all the voxel sources in a 3D image
+
* SAIMAGEClip -- clip current 3D image
+
* SAIMAGESmooth -- smooth current 3D image
+
* SAIMAGESetCrosshair -- set the position of the crosshair in the 3D image
+
  
  
 
'''Commands for Time-Frequency Analysis''' ('''TFC''')
 
'''Commands for Time-Frequency Analysis''' ('''TFC''')
* TFCStartTFAnalysis --(previously TFCgo) start TFC analysis using the current paradigm settings
 
* TFCdisplay -- change the TFC display (e.g. power/amplitude, coherence)
 
* TFCsave -- save numerical results to an ASCII file, or save a screenshot of the TFC window
 
* TFCimage -- start beamformer analysis on a selected time-frequency range
 
* TFCSendToMATLAB -- send TF results or single-trial data to Matlab
 
  
 +
{| cellspacing="8"
 +
| style="width: 180pt"| TFCStartTFAnalysis ||(previously TFCgo) start TFC analysis using the current paradigm settings
 +
|-
 +
| TFCdisplay || change the TFC display (e.g. power/amplitude, coherence)
 +
|-
 +
| TFCsave || save numerical results to an ASCII file, or save a screenshot of the TFC window
 +
|-
 +
| TFCimage || start beamformer analysis on a selected time-frequency range
 +
|-
 +
| TFCSendToMATLAB || send TF results or single-trial data to MATLAB
 +
|}
  
 
+
=== How to Average Your Data in a Batch  ===
==== How to Average Your Data in a Batch  ====
+
  
 
Using batch processing, several files from an experiment can be averaged at a time.
 
Using batch processing, several files from an experiment can be averaged at a time.
Line 512: Line 605:
 
* Create the paradigm, and save the paradigm file.
 
* Create the paradigm, and save the paradigm file.
 
* Open each individual data file to check the data:
 
* Open each individual data file to check the data:
 
+
** Make sure auxiliary files are defined and loaded properly, and the data are displayed correctly.
 
+
** Eyeball the data.
* <div style="margin-left:1.27cm;margin-right:0cm;">Make sure auxiliary files are defined and loaded properly, and the data are displayed correctly.</div>
+
** Define bad (and interpolated) channels.
* <div style="margin-left:1.27cm;margin-right:0cm;">Eyeball the data.</div>
+
** Mark artifact time ranges.
* <div style="margin-left:1.27cm;margin-right:0cm;">Define bad (and interpolated) channels.</div>
+
** If required, set up artifact correction for the file.
* <div style="margin-left:1.27cm;margin-right:0cm;">Mark artifact time ranges.</div>
+
** The data file can be closed again after this step.
* <div style="margin-left:1.27cm;margin-right:0cm;">If required, set up artifact correction for the file.</div>
+
* <div style="margin-left:1.27cm;margin-right:0cm;">The data file can be closed again after this step.</div>
+
 
+
  
  
Line 526: Line 616:
  
 
* Open at least one&nbsp;file and select ''Process / Batch Scripts''.... The file(s) should be displayed in the file list. Alternatively, just select ''Process / Batch Scripts...,'' and add the files by
 
* Open at least one&nbsp;file and select ''Process / Batch Scripts''.... The file(s) should be displayed in the file list. Alternatively, just select ''Process / Batch Scripts...,'' and add the files by
 
+
** pressing the <span style="color:#3366ff;">'''Add File'''</span> button
 
+
** dragging the files from Windows Explorer
* <div style="margin-left:1.27cm;margin-right:0cm;">pressing the <span style="color:#3366ff;">'''Add File'''</span> button</div>
+
** Opening a previously saved&nbsp;list with ''Load File List''
* <div style="margin-left:1.27cm;margin-right:0cm;">dragging the files from Windows Explorer</div>
+
* <div style="margin-left:1.27cm;margin-right:0cm;">Opening a previously saved&nbsp;list with ''Load File List''</div>
+
  
  
Line 536: Line 624:
 
* Select the ''Batch Tab''.
 
* Select the ''Batch Tab''.
 
* Add commands to your script. For averaging, these would normally be
 
* Add commands to your script. For averaging, these would normally be
 
+
** '''Paradigm''' -- to load the paradigm file
 
+
** '''Artifact Scan''' -- to run the artifact scan
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Paradigm''' -- to load the paradigm file</div>
+
** '''Average''' -- to perform the average
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Artifact Scan''' -- to run the artifact scan</div>
+
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Average''' -- to perform the average</div>
+
  
  
Line 548: Line 634:
 
* Look at the data averages to make sure they have been done correctly.
 
* Look at the data averages to make sure they have been done correctly.
 
* Repeat these steps until averaging is working properly.
 
* Repeat these steps until averaging is working properly.
 
  
  
Line 555: Line 640:
 
* Select ''Process / Batch Scripts''....
 
* Select ''Process / Batch Scripts''....
 
* Open the files you want to average in the batch in the file list:
 
* Open the files you want to average in the batch in the file list:
 
+
** Any files that were open in BESA are included in the list
 
+
** Files can be added using the <span style="color:#3366ff;">'''Add File'''</span> button
* <div style="margin-left:1.27cm;margin-right:0cm;">Any files that were open in BESA are included in the list</div>
+
** You may drag one or more files from Windows Explorer to the file list
* <div style="margin-left:1.27cm;margin-right:0cm;">Files can be added using the <span style="color:#3366ff;">'''Add File'''</span> button</div>
+
** Alternatively, load a previously saved file list.
* <div style="margin-left:1.27cm;margin-right:0cm;">You may drag one or more files from Windows Explorer to the file list</div>
+
* <div style="margin-left:1.27cm;margin-right:0cm;">Alternatively, load a previously saved file list.</div>
+
  
  
Line 569: Line 652:
 
* Press <span style="color:#3366ff;">'''OK'''</span> to run the batch.
 
* Press <span style="color:#3366ff;">'''OK'''</span> to run the batch.
  
 +
=== How to Merge and Compress raw data  ===
  
 +
Using the Export command in a batch, several data files can be merged into a single data file in BESA's data format (<span style="color:#ff9c00;">'''<nowiki>*.foc</nowiki>'''</span>).
  
==== How to Merge and Compress raw data ====
+
This can be useful if data from one subject have been collected in several data blocks, and you want to analyze all data blocks together.
  
<span style="color:#3366ff;"><span style="color:#00000a;">Using the Export command in a batch, several data files can be merged into a single data file in BESA's data format (</span></span><span style="color:#ff9c00;">'''<nowiki>*.foc</nowiki>'''</span><span style="color:#3366ff;"><span style="color:#00000a;">).</span></span>
+
Optionally, to save space, data can be saved in compressed format.
  
<span style="color:#3366ff;"><span style="color:#00000a;">This can be useful if data from one subject have been collected in several data blocks, and you want to analyze all data blocks together.</span></span>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">Optionally, to save space, data can be saved in compressed format.</span></span>
+
'''Files can be merged:'''
  
 +
* if they have identical channel configurations, or
 +
* there are at least 16 EEG channels, and the export format is Standard 81 (i.e. EEG channels are interpolated to 81 standard locations).
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''Files can be merged:'''</span></span>
 
  
* <span style="color:#3366ff;"><span style="color:#00000a;">if they have identical channel configurations, or</span></span>
+
'''How to merge files:'''
* <span style="color:#3366ff;"><span style="color:#00000a;">there are at least 16 EEG channels, and the export format is Standard 81 (i.e. EEG channels are interpolated to 81 standard locations). </span></span>
+
  
 +
* Select '''Process / Batch Scripts...'''
 +
* Add all the files that are to be merged to the file list:
 +
** Any files that were open in BESA Research are included in the list
 +
** Files can be added using the <span style="color:#3366ff;">'''Add File'''</span> button
 +
** You may drag one or more files from Windows Explorer to the file list
 +
** Alternatively, load a previously saved file list (''Load File List'').
 +
* Rearrange the files in the file list to the sequence in which they should be merged.
 +
* Select the ''Batch Tab ''and insert an "''Export"'' command, as described below.
  
<div style="color:#00000a;"></div>
 
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''How to merge files:'''</span></span>
+
The following dialog shows a possible configuration of the ''Export'' command:
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Select Process / Batch Scripts...</span></span>
+
[[Image:Batch processing (4).gif]]
* <span style="color:#3366ff;"><span style="color:#00000a;">Add all the files that are to be merged to the file list:</span></span>
+
  
  
* <div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">Any files that were open in BESA Research are included in the list</span></span></div>
+
* The parameters shown in the Information box are the settings chosen in the ''Export Dialog'' when the <span style="color:#3366ff;">'''Select Options'''</span> button has been pressed.
* <div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">Files can be added using the</span></span><span style="color:#3366ff;">''' Add File '''</span><span style="color:#3366ff;"><span style="color:#00000a;">button</span></span></div>
+
* '''Append if file already exists''' must be checked in order to merge the files.
* <div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">You may drag one or more files from Windows Explorer to the file list</span></span></div>
+
* The '''target file name''' must be fixed, i.e. don't use the '''%basename%''' variable, because that will result in a different target file name for each source file.
* <div style="margin-left:1.27cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">Alternatively, load a previously saved file list (</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Load File List''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">).</span></span></div>
+
* There are two variables that can be used for the segment label:
 +
** '''%filename%''' will insert the basename of the source file into the segment label.
 +
** '''%c%''' will insert the file number into the segment label. The number gives&nbsp;the position of the file in the file list. For instance, "File %c%" will generate the label "File 2" for the second file in the list.
  
 +
=== Example: Data averaging in the auditory intensity experiment ===
  
* <span style="color:#3366ff;"><span style="color:#00000a;">Rearrange the files in the file list to the sequence in which they should be merged.</span></span>
 
* <span style="color:#3366ff;"><span style="color:#00000a;">Select the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Batch Tab ''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">and insert an "</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Export"''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> command, as described below.</span></span>
 
  
 +
In this example, two raw data files, <span style="color:#ff9c00;">'''s1.cnt'''</span> and <span style="color:#ff9c00;">'''s2.cnt'''</span>, from the auditory intensity experiment will be batch averaged.
  
<div style="color:#00000a;"></div>
+
Please note that there are further tutorials covering this experiment. The first file is contaminated by many eyeblinks, and more epochs would be averaged if eye correction were used (see Viewlet demonstration on artifact correction on the BESA website). However, in this tutorial, we will just use artifact rejection.
  
<span style="color:#3366ff;"><span style="color:#00000a;">The following dialog shows a possible configuration of the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Export''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> command:</span></span>
 
  
 +
'''A. Various ways of creating a File List'''
  
<div style="color:#00000a;">[[Image:Batch processing (4).gif]]</div>
+
1. '''Files that were open in BESA Research are automatically added to the File List.''' Start BESA Research and open the files <span style="color:#ff9c00;">'''s1.cnt '''</span>and <span style="color:#ff9c00;">'''s2.cnt '''</span>in the directory ''Examples\ERP-Auditory-Intensity''.
  
 +
2. Select ''Process / Batch Scripts''.... You should see the file names in the '''''File List Tab''''' something like this:
  
* <span style="color:#3366ff;"><span style="color:#00000a;">The parameters shown in the Information box are the settings chosen in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Export Dialog''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> when the </span></span><span style="color:#3366ff;">'''Select Options'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button has been pressed.</span></span>
+
[[Image:Batch processing (5).gif]]
* <span style="color:#3366ff;"><span style="color:#00000a;">'''Append if file already exists'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> must be checked in order to merge the files.</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">The </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''target file name'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> must be fixed, i.e. don't use the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''%basename%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> variable, because that will result in a different target file name for each source file.</span></span>
+
* <span style="color:#3366ff;"><span style="color:#00000a;">There are two variables that can be used for the segment label:</span></span>
+
  
# <span style="color:#3366ff;"><span style="color:#00000a;">'''%filename%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> will insert the basename of the source file into the segment label.</span></span>
 
# <span style="color:#3366ff;"><span style="color:#00000a;">'''%c%'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> will insert the file number into the segment label. The number gives&nbsp;the position of the file in the file list. For instance, "File %c%" will generate the label "File 2" for the second file in the list.</span></span>
 
  
 +
3. You can resort the files in the file list alphabetically by clicking onto the '''''File List column header''''':
  
 +
[[Image:Batch processing (6).gif]]
  
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
 
<div style="color:#00000a;"></div>
 
 
==== <span style="color:#3366ff;"><span style="color:#00000a;">Example: Data averaging in the auditory intensity experiment</span></span> ====
 
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">In this example, two raw data files, </span></span><span style="color:#ff9c00;">'''s1.cnt'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and </span></span><span style="color:#ff9c00;">'''s2.cnt'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, from the auditory intensity experiment will be batch averaged.</span></span>
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">Please note that there are further tutorials covering this experiment. The first file is contaminated by many eyeblinks, and more epochs would be averaged if eye correction were used (see Viewlet demonstration on artifact correction on the BESA website). However, in this tutorial we will just use artifact rejection.</span></span>
 
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">'''A. Various ways of creating a File List'''</span></span>
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">'''1. Files that were open in BESA Research are automatically added to the File List'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">. Start BESA Research and open the files </span></span><span style="color:#ff9c00;">'''s1.cnt '''</span><span style="color:#3366ff;"><span style="color:#00000a;">and </span></span><span style="color:#ff9c00;">'''s2.cnt '''</span><span style="color:#3366ff;"><span style="color:#00000a;">in the directory </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Examples\ERP-Auditory-Intensity''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">2. Select </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Process / Batch Scripts''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">.... You should see the file names in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''''File List Tab'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> something like this:</span></span>
 
 
 
 
<div style="color:#00000a;margin-left:1.27cm;margin-right:0cm;"></div>
 
 
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (5).gif]]</div>
 
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">3. You can resort the files in the file list alphabetically by clicking onto the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''''File List column header'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">:</span></span>
 
 
 
 
<div style="color:#00000a;margin-left:1.27cm;margin-right:0cm;"></div>
 
 
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (6).gif]]</div>
 
 
 
<span style="color:#3366ff;"><span style="color:#00000a;">Alternatively, you can mark any file, hold down the </span></span><span style="color:#3366ff;">'''Ctrl '''</span><span style="color:#3366ff;"><span style="color:#00000a;">key and press the </span></span><span style="color:#3366ff;">'''Up'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> or </span></span><span style="color:#3366ff;">'''Down arrow '''</span><span style="color:#3366ff;"><span style="color:#00000a;">to move the file name up or down the list. This is the sequence in which files will be processed in the batch.</span></span>
 
  
 +
Alternatively, you can mark any file, hold down the <span style="color:#3366ff;">'''Ctrl '''</span>key and press the <span style="color:#3366ff;">'''Up'''</span> or <span style="color:#3366ff;">'''Down arrow '''</span>to move the file name up or down the list. This is the sequence in which files will be processed in the batch.
  
 
[[Image:Batch processing (7).gif]]
 
[[Image:Batch processing (7).gif]]
  
  
<span style="color:#3366ff;"><span style="color:#00000a;">4. Press </span></span><span style="color:#3366ff;">'''Save File List'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and save the list you have created to </span></span><span style="color:#ff9c00;">'''ERP-Aud-Ex1.flist'''</span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
+
4. Press <span style="color:#3366ff;">'''Save File List'''</span> and save the list you have created to <span style="color:#ff9c00;">'''ERP-Aud-Ex1.flist'''</span>.
  
<span style="color:#3366ff;"><span style="color:#00000a;">5. Highlight both names and press the</span></span><span style="color:#3366ff;">''' Del '''</span><span style="color:#3366ff;"><span style="color:#00000a;">button to remove them from the list.</span></span>
+
5. Highlight both names and press the<span style="color:#3366ff;">''' Del '''</span>button to remove them from the list.
  
<span style="color:#3366ff;"><span style="color:#00000a;">6. '''Files can be dragged from Windows Explorer'''<span style="color:#3366ff;"><span style="color:#00000a;">. Start Windows Explorer and navigate to the ''ERP-Auditory-Intensity'' subdirectory of your BESA Research examples folder (located in the ''Public Documents'' folder of your computer). Click on <span style="color:#ff9c00;">'''s1.cnt'''</span> and drag it with the mouse onto the <span style="color:#3366ff;">'''''File List Tab'''''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">. Let go of the mouse. BESA Research opens the file, and displays the name in the File List. Repeat for </span></span><span style="color:#ff9c00;">'''s2.cnt'''</span></span>
+
6. '''Files can be dragged from Windows Explorer'''. Start Windows Explorer and navigate to the ''ERP-Auditory-Intensity'' subdirectory of your BESA Research examples folder (located in the ''Public Documents'' folder of your computer). Click on <span style="color:#ff9c00;">'''s1.cnt'''</span> and drag it with the mouse onto the <span style="color:#3366ff;">'''''File List Tab'''''. Let go of the mouse. BESA Research opens the file, and displays the name in the File List. Repeat for <span style="color:#ff9c00;">'''s2.cnt.'''
  
<span style="color:#3366ff;"><span style="color:#00000a;">7. Highlight both names and press the </span></span><span style="color:#3366ff;">'''Del '''</span><span style="color:#3366ff;"><span style="color:#00000a;">button to remove them from the list.</span></span>
+
7. Highlight both names and press the <span style="color:#3366ff;">'''Del '''</span>button to remove them from the list.
  
<span style="color:#3366ff;"><span style="color:#00000a;">8. '''Files can be added using the'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> </span></span><span style="color:#3366ff;">'''Add File </span><span style="color:#3366ff;"><span style="color:#00000a;">button'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">. Press </span></span><span style="color:#3366ff;">'''Add File'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and navigate to the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Examples\ERP-Auditory-Intensity''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> subdirectory. Select </span></span><span style="color:#ff9c00;">'''s1.cnt'''</span><span style="color:#3366ff;"><span style="color:#00000a;">. Press </span></span><span style="color:#3366ff;">'''Ctrl'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and select </span></span><span style="color:#ff9c00;">'''s2.cnt'''</span><span style="color:#3366ff;"><span style="color:#00000a;">. Both names should then be displayed in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''File Open''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> dialog. Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to add the files to the file list.</span></span>
+
8. '''Files can be added using the ''Add File'' button'''. Press <span style="color:#3366ff;">'''Add File'''</span> and navigate to the ''Examples\ERP-Auditory-Intensity'' subdirectory. Select <span style="color:#ff9c00;">'''s1.cnt'''</span>. Press <span style="color:#3366ff;">'''Ctrl'''</span> and select <span style="color:#ff9c00;">'''s2.cnt'''</span>. Both names should then be displayed in the ''File Open'' dialog. Press <span style="color:#3366ff;">'''OK'''</span> to add the files to the file list.
  
<span style="color:#3366ff;"><span style="color:#00000a;">9. Highlight both names and press the </span></span><span style="color:#3366ff;">'''Del'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button to remove them from the list.</span></span>
+
9. Highlight both names and press the <span style="color:#3366ff;">'''Del'''</span> button to remove them from the list.
  
<span style="color:#3366ff;"><span style="color:#00000a;">10. '''Files can be loaded from a previously saved file list'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">. Press </span></span><span style="color:#3366ff;">'''Load File List '''</span><span style="color:#3366ff;"><span style="color:#00000a;">and select </span></span><span style="color:#ff9c00;">'''ERP-Aud-Ex1.flist'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, the list you saved in step 6 above.</span></span>
+
10. '''Files can be loaded from a previously saved file list'''. Press <span style="color:#3366ff;">'''Load File List '''</span>and select <span style="color:#ff9c00;">'''ERP-Aud-Ex1.flist'''</span>, the list you saved in step 6 above.
  
  
 +
'''B. Setting up the batch'''
  
<div style="color:#00000a;"></div>
+
1. We will add three commands, '''Paradigm''', '''Artifact Scan''', and '''Average''', to create a batch that will be applied to the two files in the file list.
  
<span style="color:#3366ff;"><span style="color:#00000a;">'''B. Setting up the batch'''</span></span>
+
2. Click on the '''Batch Tab'''.
 
+
 
+
# <div style="margin-left:1.259cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">We will add three commands, </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Paradigm'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">, </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Artifact Scan'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">, and </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Average'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">, to create a batch that will be applied to the two files in the file list.</span></span></div>
+
# <span style="color:#3366ff;"><span style="color:#00000a;">Click on the</span></span><span style="color:#3366ff;"><span style="color:#00000a;">''''' ''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">Batch Tab'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">.</span></span>
+
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (8).gif]]
 
[[Image:Batch processing (8).gif]]
  
  
# <span style="color:#3366ff;"><span style="color:#00000a;">Press the </span></span><span style="color:#3366ff;">'''Add Command'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button to obtain the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Select Command''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> window:</span></span>
+
3. Press the <span style="color:#3366ff;">'''Add Command'''</span> button to obtain the ''Select Command'' window:
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (9).gif]]
 
[[Image:Batch processing (9).gif]]
  
  
<span style="color:#3366ff;"><span style="color:#00000a;">&nbsp;</span></span># <span style="color:#3366ff;"><span style="color:#00000a;">Click on </span></span><span style="color:#3366ff;">'''Paradigm'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> and then on </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> (alternatively, double-click on </span></span><span style="color:#3366ff;">'''Paradigm'''</span><span style="color:#3366ff;"><span style="color:#00000a;">). Hit </span></span><span style="color:#3366ff;">'''Browse'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, navigate to the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Auditory''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> folder, and select </span></span><span style="color:#ff9c00;">'''AEP_Intensity.pdg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, the paradigm for the auditory intensity experiment.</span></span>
+
4. Click on <span style="color:#3366ff;">'''Paradigm'''</span> and then on <span style="color:#3366ff;">'''OK'''</span> (alternatively, double-click on <span style="color:#3366ff;">'''Paradigm'''</span>). Hit <span style="color:#3366ff;">'''Browse'''</span>, navigate to the ''Auditory'' folder, and select <span style="color:#ff9c00;">'''AEP_Intensity.pdg'''</span>, the paradigm for the auditory intensity experiment.
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
 
+
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (10).gif]]</div>
+
 
+
 
+
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK '''</span><span style="color:#3366ff;"><span style="color:#00000a;">to obtain the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Load Paradigm Task''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> window.</span></span>
+
  
 +
[[Image:Batch processing (10).gif]]
  
  
<div style="color:#00000a;"></div>
+
5. Press <span style="color:#3366ff;">'''OK'''</span> to obtain the ''Load Paradigm Task'' window.
  
 
[[Image:Batch processing (11).gif]]
 
[[Image:Batch processing (11).gif]]
  
  
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;">, and the first task in the batch is ready, and listed in the Batch Command window. If you want to modify the command, double-click on it to open the above window, that allows to browse for a different paradigm file.</span></span>
+
6. Press <span style="color:#3366ff;">'''OK'''</span>, and the first task in the batch is ready, and listed in the Batch Command window. If you want to modify the command, double-click on it to open the above window, that allows to browse for a different paradigm file.
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (12).gif]]
 
[[Image:Batch processing (12).gif]]
  
  
# <span style="color:#3366ff;"><span style="color:#00000a;">Next, we add the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Artifact Scan'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> command. Click on the </span></span><span style="color:#3366ff;">'''Add Command'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button, and select </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Artifact Scan.''</span></span>
+
7. Next, we add the '''Artifact Scan''' command. Click on the <span style="color:#3366ff;">'''Add Command'''</span> button, and select ''Artifact Scan.''
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (13).gif]]
 
[[Image:Batch processing (13).gif]]
  
  
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">Press</span></span><span style="color:#3366ff;">''' OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to open the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Artifact Scan Task''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> window. We want to be able to view the results of the scan, and adjust thresholds and bad channels if necessary. Therefore, check the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Wait after scan''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> checkbox.</span></span>
+
8. Press <span style="color:#3366ff;">'''OK'''</span> to open the ''Artifact Scan Task'' window. We want to be able to view the results of the scan, and adjust thresholds and bad channels if necessary. Therefore, check the ''Wait after scan'' checkbox.
  
 +
[[Image:Batch processing (14).gif]]
  
  
<div style="color:#00000a;"></div>
+
9. Press <span style="color:#3366ff;">'''OK'''</span> to close the ''Artifact Scan Task'' window. Our batch now contains two commands.
 
+
<div style="margin-left:1.136cm;margin-right:0cm;">[[Image:Batch processing (14).gif]]</div>
+
 
+
 
+
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to close the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Artifact Scan Task''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> window. Our batch now contains two commands.</span></span>
+
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (15).gif]]
 
[[Image:Batch processing (15).gif]]
  
  
# <span style="color:#3366ff;"><span style="color:#00000a;">Finally, we will add an </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Average'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> command. Press the </span></span><span style="color:#3366ff;">'''Add Command'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button and select </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Average''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">. Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to open the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Average Task ''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">window.</span></span>
+
10. Finally, we will add an '''Average''' command. Press the <span style="color:#3366ff;">'''Add Command'''</span> button and select ''Average''. Press <span style="color:#3366ff;">'''OK'''</span> to open the ''Average Task ''window.
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (16).gif]]
 
[[Image:Batch processing (16).gif]]
  
  
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">With the default settings, the average would be saved to the same directory as the data. The file name mask is set by default so that in this example the two averages would be saved to </span></span><span style="color:#ff9c00;">'''s1-av.fsg '''</span><span style="color:#3366ff;"><span style="color:#00000a;">and </span></span><span style="color:#ff9c00;">'''s2-av.fsg'''</span><span style="color:#3366ff;"><span style="color:#00000a;">. We will save the averaged files to subdirectory </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''"Averages''</span></span><span style="color:#3366ff;"><span style="color:#00000a;">" of the data directory. Uncheck the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Use default target''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> check box, change the File name mask to </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''%basename%_av-test'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> in order not to overwrite the predefined files.</span></span>
+
11. With the default settings, the average would be saved to the same directory as the data. The file name mask is set by default so that in this example the two averages would be saved to <span style="color:#ff9c00;">'''s1-av.fsg '''</span>and <span style="color:#ff9c00;">'''s2-av.fsg'''</span>. We will save the averaged files to subdirectory ''"Averages''" of the data directory. Uncheck the ''Use default target'' check box, change the File name mask to '''%basename%_av-test''' in order not to overwrite the predefined files.
 
+
 
+
 
+
<div style="color:#00000a;margin-left:1.136cm;margin-right:0cm;"></div>
+
 
+
<div style="color:#00000a;margin-left:1.136cm;margin-right:0cm;"></div>
+
  
 
[[Image:Batch processing (17).gif]]
 
[[Image:Batch processing (17).gif]]
  
  
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK '''</span><span style="color:#3366ff;"><span style="color:#00000a;">to close the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Average Task''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> window. Our batch is now complete. &nbsp;</span></span>
+
12. Press <span style="color:#3366ff;">'''OK '''</span>to close the ''Average Task'' window. Our batch is now complete.
 
+
 
+
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (18).gif]]
 
[[Image:Batch processing (18).gif]]
  
  
<div style="color:#00000a;"></div># <div style="margin-left:1.131cm;margin-right:0cm;"><span style="color:#3366ff;"><span style="color:#00000a;">We will now save the batch so that it can be used again. Press the </span></span><span style="color:#3366ff;">'''Save Batch'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> button, and save to the file </span></span><span style="color:#ff9c00;">'''ERP-Aud-ex1.bbat'''</span><span style="color:#3366ff;"><span style="color:#00000a;">. Note that an easy way to generate new averaging batches is to load a previously save batch and edit the commands -- it may only be necessary to edit the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Paradigm'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> command to select the relevant paradigm file, and maybe to adjust the target directory in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">'''Average'''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> command.</span></span></div>
+
13. We will now save the batch so that it can be used again. Press the <span style="color:#3366ff;">'''Save Batch'''</span> button, and save to the file <span style="color:#ff9c00;">'''ERP-Aud-ex1.bbat'''</span>. Note that an easy way to generate new averaging batches is to load a previously save batch and edit the commands -- it may only be necessary to edit the '''Paradigm''' command to select the relevant paradigm file, and maybe to adjust the target directory in the '''Average''' command.
# <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Batch''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> Window to start the batch running. As requested, the batch pauses after the artifact scan:. </span></span>
+
  
 
+
14. Press <span style="color:#3366ff;">'''OK'''</span> in the ''Batch'' Window to start the batch running. As requested, the batch pauses after the artifact scan:.
 
+
<div style="color:#00000a;"></div>
+
  
 
[[Image:Batch processing (19).gif]]
 
[[Image:Batch processing (19).gif]]
  
 +
You may now adjust the number of rejected trials, e.g. by moving the vertical red bar to the left or exclude bad channels.
  
<span style="color:#3366ff;"><span style="color:#00000a;">You may now adjust the number of rejected trials, e.g. by moving the vertical red bar to the left, or exclude bad channels. &nbsp;</span></span>
 
  
 +
15. Press <span style="color:#3366ff;">'''OK'''</span> to continue with averaging.
  
# <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to continue with averaging.</span></span>
+
[[Image:Batch processing (20).gif]]
  
  
 +
16. Note that, in the background, the ''Batch Running'' window is providing feedback about the current file and current task.
  
<div style="color:#00000a;"></div>
+
[[Image:Batch processing (6).jpg|400px]]
  
<div style="margin-left:1.136cm;margin-right:0cm;">[[Image:Batch processing (20).gif]]<span style="color:#3366ff;"><span style="color:#00000a;"> &nbsp;</span></span></div>
 
  
 +
17. The batch will stop again after the next artifact scan. Press <span style="color:#3366ff;">'''OK'''</span> to allow the batch to run to the end.
  
# <span style="color:#3366ff;"><span style="color:#00000a;">Note that, in the background, the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Batch Running''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> window is providing feedback about the current file and current task. &nbsp;</span></span>
+
[[Image:Batch processing (21).gif|400px]]
  
  
 +
18. Press <span style="color:#3366ff;">'''View Log'''</span> to view the batch log.
  
<div style="color:#00000a;"></div>
+
19. The batch log gives feedback about the number of epochs that were averaged for each file.
  
<div style="color:#00000a;"></div>
+
20. Finally, press <span style="color:#3366ff;">'''OK'''</span> to return to the main BESA Research display. Open the averages in the ''Averages'' subdirectory to confirm that they were generated properly.
  
[[Image:Batch processing (6).jpg]]
+
=== Example: Merging files using the Export Command ===
  
 +
Here we will demonstrate the use of the '''Export '''command to merge two files. We will combine the two averages from the previous example (Data averaging in the auditory intensity experiment) into one target file.
  
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">The batch will stop again after the next artifact scan. Press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to allow the batch to run to the end. &nbsp;</span></span>
 
 
 
 
<div style="color:#00000a;"></div>
 
 
[[Image:Batch processing (21).gif]]
 
 
 
<div style="color:#00000a;"></div># <span style="color:#3366ff;"><span style="color:#00000a;">Press </span></span><span style="color:#3366ff;">'''View Log'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to view the batch protocol. If you are using Internet Explorer or Netscape family (Mozilla, Firefox) browsers, and JavaScript is enabled, you will first see just batch titles defined by the date and time the batch was started. The most recent title is at the top of the list. For other browsers, or if JavaScript was not enabled, all protocol texts are expanded as in 19 (below).</span></span>
 
 
 
 
 
 
<div style="margin-left:1.136cm;margin-right:0cm;">[[Image:Batch processing (22).gif]]</div>
 
 
 
# <span style="color:#3366ff;"><span style="color:#00000a;">Click on the first title to expand its protocol. Here, for example, the protocol gives feedback about the number of epochs that were averaged for each file.</span></span>
 
 
 
 
<div style="color:#00000a;"></div>
 
 
[[Image:Batch processing (23).gif]]
 
 
 
# <span style="color:#3366ff;"><span style="color:#00000a;">Finally, press </span></span><span style="color:#3366ff;">'''OK'''</span><span style="color:#3366ff;"><span style="color:#00000a;"> to return to the main BESA Research display. Open the averages in the </span></span><span style="color:#3366ff;"><span style="color:#00000a;">''Averages''</span></span><span style="color:#3366ff;"><span style="color:#00000a;"> subdirectory to confirm that they were generated properly.</span></span>
 
 
 
 
<div style="color:#00000a;"></div>
 
 
==== Example: Merging files using the Export Command ====
 
 
Here we will demonstrate the use of the '''Export '''command to merge two files. We will combine the two averages from the previous example ([mk:@MSITStore:C:\Users\Alexa\Documents\work\Manual\BESA%20Help\Combine-Conditions.chm::/Data_averaging_in_the_auditory_intensity_experiment.htm Data averaging in the auditory intensity experiment]) into one target file.
 
  
 
'''A. Generate the file list'''
 
'''A. Generate the file list'''
  
 
+
# Start BESA Research and load the two data files <span style="color:#ff9c00;">'''S1_av-test.fsg'''</span> and <span style="color:#ff9c00;">'''S2_av-test.fsg'''</span> that were saved in the previous example.
# <div style="margin-left:1.259cm;margin-right:0cm;">Start BESA Research and load the two data files <span style="color:#ff9c00;">'''S1_av-test.fsg'''</span> and <span style="color:#ff9c00;">'''S2_av-test.fsg'''</span> that were saved in the previous example.</div>
+
# Select ''Process / Batch Scripts....''The two file names should be displayed in the file list.
# <div style="margin-left:1.259cm;margin-right:0cm;">Select ''Process / Batch Scripts....''The two file names should be displayed in the file list.</div>
+
 
# In the file list, make sure that <span style="color:#ff9c00;">'''s1_av-test.fsg '''</span>is the first file in the list. If it is not, highlight the file, and move it up using <span style="color:#3366ff;">'''Ctrl+up'''</span>, or right click and select ''Move Up'' in the context menu.
 
# In the file list, make sure that <span style="color:#ff9c00;">'''s1_av-test.fsg '''</span>is the first file in the list. If it is not, highlight the file, and move it up using <span style="color:#3366ff;">'''Ctrl+up'''</span>, or right click and select ''Move Up'' in the context menu.
 
 
  
  
Line 878: Line 837:
 
'''B. Generate the batch'''
 
'''B. Generate the batch'''
  
 +
1. Press the <span style="color:#3366ff;">'''Add Command'''</span> button, and select the '''Export''' command.
  
# <div style="margin-left:1.259cm;margin-right:0cm;">Press the <span style="color:#3366ff;">'''Add Command'''</span> button, and select the '''Export''' command.</div>
+
2. Press <span style="color:#3366ff;">'''OK'''</span> to open the ''Export Task'' window.
# Press <span style="color:#3366ff;">'''OK'''</span> to open the ''Export Task'' window.
+
 
+
 
+
 
+
 
+
  
  
Line 891: Line 846:
  
  
# Press the <span style="color:#3366ff;">'''Select Options'''</span>... button to open the ''Export Dialog''.
+
3. Press the <span style="color:#3366ff;">'''Select Options'''</span>... button to open the ''Export Dialog''.
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (25).gif]]</div>
+
 
+
 
+
# Since we are combining averages, select ''Hires (no compression)'' in the '''Target data format''' drop-down list (If we were merging raw data files, it is better to select compression. Press <span style="color:#3366ff;">'''OK '''</span>to close the dialog. Check'' Append if file already exists'', so that the files will be merged. Enter '''s1+s2''' in the target file name mask edit box. This ensures that both files will be saved to the same target: <span style="color:#ff9c00;">'''S1+S2.fsg'''</span>.
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
  
  
 +
[[Image:Batch processing (25).gif]]
  
  
 +
4. Since we are combining averages, select ''Hires (no compression)'' in the '''Target data format''' drop-down list (If we were merging raw data files, it is better to select compression. Press <span style="color:#3366ff;">'''OK '''</span>to close the dialog. Check'' Append if file already exists'', so that the files will be merged. Enter '''s1+s2''' in the target file name mask edit box. This ensures that both files will be saved to the same target: <span style="color:#ff9c00;">'''S1+S2.fsg'''</span>.
  
  
Line 995: Line 858:
  
  
# Press <span style="color:#3366ff;">'''OK '''</span>to close the ''Export Task'' window. The '''Export '''command is displayed. &nbsp;
+
5. Press <span style="color:#3366ff;">'''OK '''</span>to close the ''Export Task'' window. The '''Export '''command is displayed. &nbsp;
 
+
 
+
 
+
  
  
Line 1,004: Line 864:
  
  
# <div style="margin-left:1.259cm;margin-right:0cm;">Optionally, you may save the batch file by pressing <span style="color:#3366ff;">'''Save Batch'''</span>.</div>
+
6. Optionally, you may save the batch file by pressing <span style="color:#3366ff;">'''Save Batch'''</span>.
# Press <span style="color:#3366ff;">'''OK'''</span> to run the batch, and <span style="color:#3366ff;">'''OK'''</span> in the ''Batch Completed'' window to return to the
+
 
+
 
+
 
+
<div style="margin-left:0cm;margin-right:0cm;">BESA main window.</div># Finally, open the file <span style="color:#ff9c00;">'''S1+S2.fsg'''</span> to confirm that it contains the two merged files.
+
  
 +
7. Press <span style="color:#3366ff;">'''OK'''</span> to run the batch, and <span style="color:#3366ff;">'''OK'''</span> in the ''Batch Completed'' window to return to the BESA main window.
  
 +
8. Finally, open the file <span style="color:#ff9c00;">'''S1+S2.fsg'''</span> to confirm that it contains the two merged files.
  
  
Line 1,021: Line 878:
  
  
 +
<span style="color:#ff0000;">Note that </span><span style="color:#ff0000;">''<nowiki>*.fsg</nowiki>''</span><span style="color:#ff0000;"> files can also be merged using the </span><span style="color:#ff0000;">''Combine Conditions''</span><span style="color:#ff0000;"> dialog. </span>
  
  
 +
== Combine Conditions, Channels ==
  
<span style="color:#ff0000;">Note that </span><span style="color:#ff0000;">''<nowiki>*.fsg</nowiki>''</span><span style="color:#ff0000;"> files can also be merged using the </span><span style="color:#ff0000;">''Combine Conditions''</span><span style="color:#ff0000;"> dialog. </span>
 
  
 
+
=== Combine Condition Scripts ===
=== Combine Conditions, Channels ===
+
 
+
==== Combine Condition Scripts ====
+
  
 
With the Combine-Conditions module you can do a variety of operations on BESA averages (files with the extension <span style="color:#ff9c00;">'''<nowiki>*.fsg</nowiki>'''</span>, and other segment files, such as <span style="color:#ff9c00;">'''<nowiki>*.mul</nowiki>'''</span>, <span style="color:#ff9c00;">'''<nowiki>*.avr</nowiki>'''</span>, <span style="color:#ff9c00;">'''<nowiki>*.swf</nowiki>'''</span>):
 
With the Combine-Conditions module you can do a variety of operations on BESA averages (files with the extension <span style="color:#ff9c00;">'''<nowiki>*.fsg</nowiki>'''</span>, and other segment files, such as <span style="color:#ff9c00;">'''<nowiki>*.mul</nowiki>'''</span>, <span style="color:#ff9c00;">'''<nowiki>*.avr</nowiki>'''</span>, <span style="color:#ff9c00;">'''<nowiki>*.swf</nowiki>'''</span>):
 
 
 
  
 
* Create grand averages
 
* Create grand averages
Line 1,046: Line 898:
 
* Determine peaks, mean amplitudes, or integrals on data averages
 
* Determine peaks, mean amplitudes, or integrals on data averages
 
* These operations can be performed on one or more files simultaneously. Results of an operation are stored in a single target file.
 
* These operations can be performed on one or more files simultaneously. Results of an operation are stored in a single target file.
 
 
 
 
 
 
  
 
The module includes four tabbed windows:
 
The module includes four tabbed windows:
  
 
+
* File List: Define a list of files on which the operations will be performed.
* <div style="margin-left:1.259cm;margin-right:0cm;">File List: Define a list of files on which the operations will be performed.</div>
+
* Condition List: List the condition names, define target condition names, and how input conditions are combined into target conditions.
* <div style="margin-left:1.259cm;margin-right:0cm;">Condition List: List the condition names, define target condition names, and how input conditions are combined into target conditions.</div>
+
* Channel List: List the channel names, define target channel names, and how input channels are combined into target channels.
* <div style="margin-left:1.259cm;margin-right:0cm;">Channel List: List the channel names, define target channel names, and how input channels are combined into target channels.</div>
+
* Run Scripts: Define global options for the output (e.g. spatial interpolation, resampling, copy/merge or average, peak analysis). Start the operation.
* <div style="margin-left:1.259cm;margin-right:0cm;">Run Scripts: Define global options for the output (e.g. spatial interpolation, resampling, copy/merge or average, peak analysis). Start the operation.</div>
+
 
* Note that in all four tabs, configurations can be saved for future use, and the <span style="color:#3366ff;">'''Load Previous'''</span> button restores the most recently used configuration.
 
* Note that in all four tabs, configurations can be saved for future use, and the <span style="color:#3366ff;">'''Load Previous'''</span> button restores the most recently used configuration.
  
 
+
=== Condition List Tab ===
 
+
 
+
 
+
==== Condition List Tab ====
+
  
 
List the condition names, define target condition names, and how input conditions are combined into target conditions.
 
List the condition names, define target condition names, and how input conditions are combined into target conditions.
 
  
 
The first column of the&nbsp;list box shows a list of all the condition names found in the source files.
 
The first column of the&nbsp;list box shows a list of all the condition names found in the source files.
Line 1,079: Line 919:
  
 
When first selecting the tab, each column shows each condition name found in the source files (as in the example below). In the list box, there is a "+1" along the diagonal. The result of this selection is that target conditions will have the same name as source conditions. Right click on source condition labels to view properties (e.g. no. of samples, time range, sampling rate).
 
When first selecting the tab, each column shows each condition name found in the source files (as in the example below). In the list box, there is a "+1" along the diagonal. The result of this selection is that target conditions will have the same name as source conditions. Right click on source condition labels to view properties (e.g. no. of samples, time range, sampling rate).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
  
Line 1,109: Line 925:
  
 
'''Editing the condition list'''
 
'''Editing the condition list'''
 
  
 
* Target condition names can be edited, inserted or deleted by clicking on the label at the top of each column.
 
* Target condition names can be edited, inserted or deleted by clicking on the label at the top of each column.
 
* Click on a box within the list to toggle between "+1", "-1" and blank. These correspond to the operations:
 
* Click on a box within the list to toggle between "+1", "-1" and blank. These correspond to the operations:
 
+
** "+1" = add
* "+1" = add
+
** "-1" = subtract
* "-1" = subtract
+
** blank = do nothing
* blank = do nothing
+
 
+
 
* Right click on a box for further operations: conditions can be weighted by a given factor other than 1.
 
* Right click on a box for further operations: conditions can be weighted by a given factor other than 1.
 
 
 
  
  
 
'''Divide result by sum of PLUS factors'''
 
'''Divide result by sum of PLUS factors'''
  
 
+
* Normally, when creating an average over conditions, the sum is divided by the number of conditions or a weighted average is generated (see below). &nbsp;If "''Divide the result by the sum of PLUS factors''" is unchecked, the conditions will be summed rather than averaged.
* <div style="margin-left:1.259cm;margin-right:0cm;">Normally, when creating an average over conditions, the sum is divided by the number of conditions, or a weighted average is generated (see below). &nbsp;If "''Divide result by sum of PLUS factors''" is unchecked, the conditions will be summed rather than averaged.</div>
+
 
* Note that, when making differences between conditions, no such division is required. BESA Research will uncheck the checkbox automatically if subtraction ("-1") is specified somewhere in the condition list.
 
* Note that, when making differences between conditions, no such division is required. BESA Research will uncheck the checkbox automatically if subtraction ("-1") is specified somewhere in the condition list.
 
 
 
 
 
 
 
 
 
  
  
 
'''Weighting of averages'''
 
'''Weighting of averages'''
 
  
 
* Below the list, click on the ''Weighted Average'' row to toggle "YES" and "NO". "YES" means that averages will be weighted by the number of epochs contributing to the average. For instance, if average A contained 100 epochs and average B contained 200 epochs, the weighted average will be computed as
 
* Below the list, click on the ''Weighted Average'' row to toggle "YES" and "NO". "YES" means that averages will be weighted by the number of epochs contributing to the average. For instance, if average A contained 100 epochs and average B contained 200 epochs, the weighted average will be computed as
  
 +
<div style="margin-left:1cm;margin-right:0cm;">(100 * A + &nbsp;200 * B) / (100 + 200)</div>
  
 +
<div style="margin-left:1cm;margin-right:0cm;">Select "NO" for an unweighted average. For the above example, the average is computed as</div>
  
 +
<div style="margin-left:1cm;margin-right:0cm;">(A + B) / 2</div>
  
 +
<div style="margin-left:1cm;margin-right:0cm;">Weighted averages are not permitted if one of the boxes contains a negative value.</div>
  
(100 * A + &nbsp;200 * B) / (100 + 200)
+
* Values other than +1 or -1 in the boxes apply a different kind of weighting. For instance, we want to compute the difference between the means of conditions A, B, C and D, E. Use a right-click to specify the fraction 1/3 for each of A, B, and C, and -1/2 for each of D and E (see example below).
 
+
<div style="margin-left:0cm;margin-right:0cm;">Select "NO" for an unweighted average. For the above example, the average is computed as</div>
+
 
+
(A + B) / 2
+
 
+
<div style="margin-left:0cm;margin-right:0cm;">Weighted averages are not permitted if one of the boxes contains a negative value.</div>
+
 
+
 
+
* Values other than +1 or -1 in the boxes apply a different kind of weighting. For instance, we want to compute the difference between the means of conditions A, B, C and D, E. Use a right click to specify the fraction 1/3 for each of A, B, and C, and -1/2 for each of D and E (see example below).
+
 
+
 
+
 
+
  
  
 
[[Image:Batch processing (29).gif]]
 
[[Image:Batch processing (29).gif]]
 
 
  
  
 
'''Save the current condition list'''
 
'''Save the current condition list'''
 
  
 
* Press the <span style="color:#3366ff;">'''Save Condition List'''</span> button.
 
* Press the <span style="color:#3366ff;">'''Save Condition List'''</span> button.
 
 
 
  
  
 
'''Load a condition list'''
 
'''Load a condition list'''
 
  
 
* Press the <span style="color:#3366ff;">'''Load Condition List'''</span>&nbsp;button.
 
* Press the <span style="color:#3366ff;">'''Load Condition List'''</span>&nbsp;button.
 
 
 
  
  
 
'''Load previous settings'''
 
'''Load previous settings'''
 
  
 
* Press the <span style="color:#3366ff;">'''Load Previous'''</span> button
 
* Press the <span style="color:#3366ff;">'''Load Previous'''</span> button
 
 
 
  
  
 
'''Feedback'''
 
'''Feedback'''
  
 
+
* Conditions that have different numbers of electrodes (averaging across different files) can only be combined if channels are interpolated to a standard set of electrodes.
* <div style="margin-left:1.259cm;margin-right:0cm;">Conditions that have different numbers of electrodes (averaging across different files) can only be combined if channels are interpolated to a standard set of electrodes.</div>
+
* Conditions that have different durations or sampling rates can only be combined if the sampling rate and durations are made the same.
* <div style="margin-left:1.259cm;margin-right:0cm;">Conditions that have different durations or sampling rates can only be combined if the sampling rate and durations are made the same.</div>
+
 
* Feedback about the above situations is displayed by the presence of tick marks above the list box.
 
* Feedback about the above situations is displayed by the presence of tick marks above the list box.
  
 
+
=== Channel List Tab ===
 
+
 
+
 
+
==== Channel List Tab ====
+
  
 
List the channel names, define target channel names, and how input channels are combined into target channels.
 
List the channel names, define target channel names, and how input channels are combined into target channels.
 
  
 
Note that this tab is very similar in usage to the '''Condition List Tab'''. Note also that some of the functions performed in this tab could also be done in the Montage Editor. It may be a matter of convenience whether you choose to perform these operations here or in the Montage Editor.
 
Note that this tab is very similar in usage to the '''Condition List Tab'''. Note also that some of the functions performed in this tab could also be done in the Montage Editor. It may be a matter of convenience whether you choose to perform these operations here or in the Montage Editor.
 
  
 
The first column of the list box shows a list of all the channel names found in the source files.
 
The first column of the list box shows a list of all the channel names found in the source files.
  
Rows of the list box define the ''source'' channel. Columns define the'' target'' channel
+
Rows of the list box define the ''source'' channel. Columns define the'' target'' channel.
  
.
 
  
 
'''Initial setting'''
 
'''Initial setting'''
Line 1,238: Line 1,007:
  
 
Some examples:
 
Some examples:
 
  
 
* Reorder or relabel channels
 
* Reorder or relabel channels
Line 1,245: Line 1,013:
 
* Extract a selection of channels for peak analysis or mean amplitudes
 
* Extract a selection of channels for peak analysis or mean amplitudes
 
* Create grand averages across files with different channel configurations, just using channels in common among the files
 
* Create grand averages across files with different channel configurations, just using channels in common among the files
 
 
 
  
  
Line 1,256: Line 1,021:
  
  
* <div style="margin-left:1.259cm;margin-right:0cm;">Target channel names can be edited, inserted or deleted by clicking on the label at the top of each column.</div>
+
* Target channel names can be edited, inserted or deleted by clicking on the label at the top of each column.
* <div style="margin-left:1.259cm;margin-right:0cm;">Click on a box within the list to toggle between "+1", "-1" and blank. These correspond to the operations:</div>
+
* Click on a box within the list to toggle between "+1", "-1" and blank. These correspond to the operations:
 
+
** "+1" = add
* "+1" = add
+
** "-1" = subtract
* "-1" = subtract
+
** blank = do nothing
* blank = do nothing
+
* Right click on a box for further operations: channels can be weighted by a given factor other than 1.
 
+
* Right click on a box for further operations: channels can be weighted by a given factor other
+
 
+
 
+
 
+
<div style="margin-left:1.27cm;margin-right:0cm;">than 1.</div>
+
  
  
 
'''Divide result by sum of PLUS factors'''
 
'''Divide result by sum of PLUS factors'''
  
 
+
* Normally, when creating an average over channels, the sum is divided by the number of channels or a weighted average is generated (see below). &nbsp;If "Divide result by the sum of PLUS factors" is unchecked, the channels will be summed rather than averaged.
* Normally, when creating an average over channels, the sum is divided by the number of channels, or a weighted average is generated (see below). &nbsp;If "Divide result by sum of PLUS factors" is unchecked, the channels will be summed rather than averaged.
+
 
+
 
+
 
+
 
* Note that, when making differences between channels, no such division is required. BESA Research will uncheck the checkbox automatically if subtraction ("-1") is specified somewhere in the channel list.
 
* Note that, when making differences between channels, no such division is required. BESA Research will uncheck the checkbox automatically if subtraction ("-1") is specified somewhere in the channel list.
  
  
 +
'''Save the current channel list'''
  
 
+
* Press the <span style="color:#3366ff;">'''Save Channel List'''</span> button.
 
+
'''Save the current channel list'''* Press the <span style="color:#3366ff;">'''Save Channel List'''</span> button.
+
 
+
  
  
 
'''Load a channel list'''
 
'''Load a channel list'''
 
  
 
* Press the <span style="color:#3366ff;">'''Load Channel List&nbsp;'''</span>button.
 
* Press the <span style="color:#3366ff;">'''Load Channel List&nbsp;'''</span>button.
 
 
 
  
  
 
'''Load previous settings'''
 
'''Load previous settings'''
 
  
 
* Press the <span style="color:#3366ff;">'''Load Previous'''</span> button
 
* Press the <span style="color:#3366ff;">'''Load Previous'''</span> button
  
 
+
=== Run Scripts Tab ===
 
+
 
+
 
+
==== Run Scripts Tab ====
+
  
 
Define global options for the output (e.g. spatial interpolation, resampling, copy/merge or average, peak detection. Start the operation.
 
Define global options for the output (e.g. spatial interpolation, resampling, copy/merge or average, peak detection. Start the operation.
Line 1,314: Line 1,058:
  
 
'''Load or Save Settings'''
 
'''Load or Save Settings'''
 
  
 
* You can save the current settings of this tab to a file (*.run) which can be loaded later.
 
* You can save the current settings of this tab to a file (*.run) which can be loaded later.
 
* When you run the script, the current settings are saved automatically to a file "<span style="color:#ff9c00;">'''PreviousSettings.run'''</span>".
 
* When you run the script, the current settings are saved automatically to a file "<span style="color:#ff9c00;">'''PreviousSettings.run'''</span>".
 
 
 
  
  
 
'''Load Previous'''
 
'''Load Previous'''
 
  
 
* Press this button to load the previous settings (from "<span style="color:#ff9c00;">'''PreviousSettings.run'''</span>").
 
* Press this button to load the previous settings (from "<span style="color:#ff9c00;">'''PreviousSettings.run'''</span>").
  
  
 +
'''Averages to Generate'''
  
 
+
* '''Generate separate averages for each source file'''. Averages are performed over conditions within the source file, and are then appended to the target file.
 
+
* '''Combine data from source files'''. Conditions are combined over all source files into a single target average.
'''Averages to Generate'''* <div style="margin-left:1.259cm;margin-right:0cm;">'''Generate separate averages for each source file'''. Averages are performed over conditions within the source file, and are then appended to the target file.</div>
+
* '''No averages, just copy'''. Files are copied and merged to the target file. Use this option for renaming conditions, merging files, removing unwanted averages (see below), changing the sampling rate and interval.
* <div style="margin-left:1.259cm;margin-right:0cm;">'''Combine data from source files'''. Conditions are combined over all source files into a single target average.</div>
+
* '''Peaks and mean amplitudes'''. Specify time ranges for peaks, mean amplitudes, or integrals (areas).
* <div style="margin-left:1.259cm;margin-right:0cm;">'''No averages, just copy'''. Files are copied and merged to the target file. Use this option for renaming conditions, merging files, removing unwanted averages (see below), changing the sampling rate and interval.</div>
+
* <div style="margin-left:1.259cm;margin-right:0cm;">'''Peaks and mean amplitudes'''. Specify time ranges for peaks, mean amplitudes, or integrals (areas).</div>
+
 
* <span style="color:#ff0000;">Note: When generating or copying averages (first three options), filters and baseline settings are turned off. For Peaks and mean amplitudes, filters and baseline settings are specified in the dialog.</span>
 
* <span style="color:#ff0000;">Note: When generating or copying averages (first three options), filters and baseline settings are turned off. For Peaks and mean amplitudes, filters and baseline settings are specified in the dialog.</span>
 
 
 
  
  
 
'''Spatial Interpolation'''
 
'''Spatial Interpolation'''
 
  
 
* '''Interpolate to Standard 81 electrodes'''. The target file will contain only electrodes (other channels are omitted), using the Standard 81 configuration (as in other export functions within BESA Research). This cannot be selected if the source data contain less than 16 EEG channels.
 
* '''Interpolate to Standard 81 electrodes'''. The target file will contain only electrodes (other channels are omitted), using the Standard 81 configuration (as in other export functions within BESA Research). This cannot be selected if the source data contain less than 16 EEG channels.
 
 
 
 
* '''Interpolate Bad Channels'''. Bad electrode channels in the source file will be interpolated. If the above option is deselected and bad channels exist in one or more of the source files, this option is always on.
 
* '''Interpolate Bad Channels'''. Bad electrode channels in the source file will be interpolated. If the above option is deselected and bad channels exist in one or more of the source files, this option is always on.
 
 
 
 
  
 
<span style="color:#ff0000;">BESA Research can interpolate EEG, and MEG if the sensors are axial gradiometers or magnetometers. If other channels are marked as bad in one or more of the source files, these will be defined as bad in the target file. This applies to MEG planar gradiometers, to polygraphic data, and to ICR channels.</span>
 
<span style="color:#ff0000;">BESA Research can interpolate EEG, and MEG if the sensors are axial gradiometers or magnetometers. If other channels are marked as bad in one or more of the source files, these will be defined as bad in the target file. This applies to MEG planar gradiometers, to polygraphic data, and to ICR channels.</span>
Line 1,359: Line 1,086:
  
 
'''Temporal Interpolation'''
 
'''Temporal Interpolation'''
 
  
 
* '''Spline to New Sampling Rate and Interval'''. Data can be converted to a new sampling rate, and the interval can be changed.
 
* '''Spline to New Sampling Rate and Interval'''. Data can be converted to a new sampling rate, and the interval can be changed.
 
+
** If the sampling rate is reduced, the data will be low-pass filtered at 1/3 sampling frequency before reduction.
 
+
** If the sampling interval is changed, the prestimulus and poststimulus intervals are limited by the smallest intervals in the conditions contributing to the averages. These limits are shown below the edit boxes.
 
+
* If the sampling rate is reduced, the data will be low-pass filtered at 1/3 sampling frequency before reduction.
+
 
+
 
+
 
+
* If the sampling interval is changed, the prestimulus and poststimulus intervals are limited by the smallest intervals in the conditions contributing to the averages. These limits are shown below the edit boxes.
+
 
+
 
+
 
+
  
  
Line 1,378: Line 1,095:
  
  
 +
[[Image:Batch processing (31).gif]]
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[[Image:Batch processing (31).gif]]
 
  
  
 
'''Peaks:'''
 
'''Peaks:'''
 
  
 
* Select the time range between which peaks are to be determined.
 
* Select the time range between which peaks are to be determined.
Line 1,408: Line 1,107:
 
* Specify whether peaks are to be defined at one latency: if so, select the channel on which peaks are to be detected.
 
* Specify whether peaks are to be defined at one latency: if so, select the channel on which peaks are to be detected.
 
* Specify whether you want to find positive or negative peaks.
 
* Specify whether you want to find positive or negative peaks.
 
 
 
  
  
 
'''Mean amplitudes and areas:'''
 
'''Mean amplitudes and areas:'''
 
  
 
* Select the time range over which the mean amplitudes or areas are to be determined.
 
* Select the time range over which the mean amplitudes or areas are to be determined.
Line 1,420: Line 1,115:
 
* Define the filter settings.
 
* Define the filter settings.
 
* Note that when computing areas, data are first rectified (made positive) and then summed over the time range.
 
* Note that when computing areas, data are first rectified (made positive) and then summed over the time range.
 
 
 
  
  
 
'''Output options of the analysis:'''
 
'''Output options of the analysis:'''
  
 
+
* A single ASCII file that contains the result of the analysis for all data sets, conditions, and channels including header and information lines.
* <div style="margin-left:1.259cm;margin-right:0cm;">A single ASCII file that contains the result of the analysis for all data sets, conditions, and channels including header and information lines</div>
+
* A sparse output suitable for import in SPSS. Each variable (e.g. a latency, a channel amplitude) constitutes one column of the output file.
* <div style="margin-left:1.259cm;margin-right:0cm;">A sparse output suitable for import in SPSS. Each variable (e.g. a latency, a channel amplitude) constitutes one column of the output file.</div>
+
 
* Direct transfer to MATLAB into a struct besa_peak. For more information on the data transfer from BESA Research to MATLAB, please refer to help chapter ''“The MATLAB interface”.''
 
* Direct transfer to MATLAB into a struct besa_peak. For more information on the data transfer from BESA Research to MATLAB, please refer to help chapter ''“The MATLAB interface”.''
 
 
 
 
 
  
  
 
'''Starting the Operation'''
 
'''Starting the Operation'''
  
 
+
* Press <span style="color:#3366ff;">'''OK'''</span>&nbsp;to start the operation. After the operation is completed, and the "Open target file in BESA" box is checked, BESA Research will open the target file. &nbsp;"Open target file in BESA" cannot be checked if "Peaks and mean amplitudes" was selected - then the result of the operation will be an ASCII file or a MATLAB transfer.
* <div style="margin-left:1.259cm;margin-right:0cm;">Press <span style="color:#3366ff;">'''OK'''</span>&nbsp;to start the operation. After the operation is completed, and the "Open target file in BESA" box is checked, BESA Research will open the target file. &nbsp;"Open target file in BESA" cannot be checked if "Peaks and mean amplitudes" was selected - then the result of the operation will be an ASCII file or a MATLAB transfer.</div>
+
 
* You will be asked for the name of the target file (unless a MATLAB transfer of peak data has been performed).
 
* You will be asked for the name of the target file (unless a MATLAB transfer of peak data has been performed).
 
 
 
  
  
 
'''Restrictions'''
 
'''Restrictions'''
  
 
+
* Depending on source file configurations, not all options above are selectable. For instance, if two files contain different numbers of electrodes, and the "''Ignore Settings in this Tab''" checkbox is checked in the '''''Channel List''''' Tab, spatial interpolation to Standard 81 is enforced in the target. Similarly, if different sampling rates are used in different files, temporal interpolation is enforced.
* <div style="margin-left:1.259cm;margin-right:0cm;">Depending on source file configurations, not all options above are selectable. For instance, if two files contain different numbers of electrodes, and the "''Ignore Settings in this Tab''" checkbox is checked in the '''''Channel List''''' Tab, spatial interpolation to Standard 81 is enforced in the target. Similarly, if different sampling rates are used in different files, temporal interpolation is enforced.</div>
+
 
* You are not allowed to add files to the file list if the channel configuration is different, and the data cannot be combined with Standard 81 interpolation. Since Standard 81 interpolation is only possible for EEG, multiple files without EEG can only be loaded if they have the same number of channels.
 
* You are not allowed to add files to the file list if the channel configuration is different, and the data cannot be combined with Standard 81 interpolation. Since Standard 81 interpolation is only possible for EEG, multiple files without EEG can only be loaded if they have the same number of channels.
  
 +
=== How to Create Grand Averages ===
  
  
 
+
* Open the files you want to average in BESA Research.
 
+
* Start the Combine Conditions Module (''ERP / Combine Conditions...).''
==== How to Create Grand Averages ====
+
* Click on the '''Condition List Tab'''. By default, the target conditions receive the same name as the source conditions. To average across different conditions, click in the list boxes to obtain "+1" for each source condition to combine, and rename the target condition to define a meaningful name for the average.
 
+
* Click on the '''Run Scripts Tab'''.
* <div style="margin-left:1.259cm;margin-right:0cm;">Open the files you want to average in BESA Research.</div>
+
* If you have more than one file, specify whether averages should be generated across files ('''Combine data from source files''') or within files ('''Generate separate averages for each source file''').
* <div style="margin-left:1.259cm;margin-right:0cm;">Start the Combine Conditions Module (''ERP / Combine Conditions...).''</div>
+
* Select other options if required (spatial or temporal resampling).
* <div style="margin-left:1.259cm;margin-right:0cm;">Click on the '''Condition List Tab'''. By default, the target conditions receive the same name as the source conditions. To average across different conditions, click in the list boxes to obtain "+1" for each source condition to combine, and rename the target condition to define a meaningful name for the average.</div>
+
* <div style="margin-left:1.259cm;margin-right:0cm;">Click on the '''Run Scripts Tab'''.</div>
+
* <div style="margin-left:1.259cm;margin-right:0cm;">If you have more than one file, specify whether averages should be generated across files ('''Combine data from source files''') or within files ('''Generate separate averages for each source file''').</div>
+
* <div style="margin-left:1.259cm;margin-right:0cm;">Select other options if required (spatial or temporal resampling).</div>
+
 
* Press <span style="color:#3366ff;">'''OK'''</span>.
 
* Press <span style="color:#3366ff;">'''OK'''</span>.
  
  
  
 +
=== How to Generate Differences Between Conditions ===
  
  
==== How to Generate Differences Between Conditions ====
+
* Open the files you want to operate on in BESA Research.
 
+
* Start the Combine Conditions Module (''ERP / Combine Conditions...).''
* <div style="margin-left:1.259cm;margin-right:0cm;">Open the files you want to operate on in BESA Research.</div>
+
* Click on the '''Condition List Tab'''. By default, the target conditions receive the same name as the source conditions. To create differences, click in the list boxes to obtain "+1" for one of the source conditions, and "-1" for the source condition to subtract, and rename the target condition to define a meaningful name for the difference.
* <div style="margin-left:1.259cm;margin-right:0cm;">Start the Combine Conditions Module (''ERP / Combine Conditions...).''</div>
+
* Click on the '''Run Scripts Tab'''.
* <div style="margin-left:1.259cm;margin-right:0cm;">Click on the '''Condition List Tab'''. By default, the target conditions receive the same name as the source conditions. To create differences, click in the list boxes to obtain "+1" for one of the source conditions, and "-1" for the source condition to subtract, and rename the target condition to define a meaningful name for the difference.</div>
+
* If you have more than one file, specify whether averages should be generated across files ('''Combine data from source files''') or within files ('''Generate separate averages for each source file''').
* <div style="margin-left:1.259cm;margin-right:0cm;">Click on the '''Run Scripts Tab'''.</div>
+
* Select other options if required (spatial or temporal resampling).
* <div style="margin-left:1.259cm;margin-right:0cm;">If you have more than one file, specify whether averages should be generated across files ('''Combine data from source files''') or within files ('''Generate separate averages for each source file''').</div>
+
* <div style="margin-left:1.259cm;margin-right:0cm;">Select other options if required (spatial or temporal resampling).</div>
+
 
* Press <span style="color:#3366ff;">'''OK'''</span>. An average of the differences is generated. If only one example of each condition exists, e.g. in a grand average file, the result is the difference between conditions.
 
* Press <span style="color:#3366ff;">'''OK'''</span>. An average of the differences is generated. If only one example of each condition exists, e.g. in a grand average file, the result is the difference between conditions.
  
  
  
 +
=== How to Merge Files ===
  
 
==== How to Merge Files ====
 
  
 
* Open the files you want to merge in BESA Research.
 
* Open the files you want to merge in BESA Research.
Line 1,493: Line 1,169:
 
* Click on the '''Run Scripts Tab'''. Select "''No averages, just copy''".
 
* Click on the '''Run Scripts Tab'''. Select "''No averages, just copy''".
 
* Press <span style="color:#3366ff;">'''OK'''</span>.
 
* Press <span style="color:#3366ff;">'''OK'''</span>.
 
 
 
  
  
 
'''Notes'''
 
'''Notes'''
 
  
 
* If the source files have different electrode configurations, use the Standard 81 configuration for the target.
 
* If the source files have different electrode configurations, use the Standard 81 configuration for the target.
Line 1,506: Line 1,178:
  
  
 
+
=== How to Remove Unwanted Averages ===
 
+
==== How to Remove Unwanted Averages ====
+
 
+
  
  
 
'''Removing one or more unwanted segments'''
 
'''Removing one or more unwanted segments'''
 
  
 
* Normally, all conditions are read from a source file. To exclude one or more segments from operations in the Combine Conditions module, mark the segments as artifacts in the main program display. It is sufficient for the beginning or the end of an artifact interval to be within the segment for the segment to be excluded.
 
* Normally, all conditions are read from a source file. To exclude one or more segments from operations in the Combine Conditions module, mark the segments as artifacts in the main program display. It is sufficient for the beginning or the end of an artifact interval to be within the segment for the segment to be excluded.
Line 1,522: Line 1,190:
 
* Press<span style="color:#3366ff;">''' OK'''</span>.
 
* Press<span style="color:#3366ff;">''' OK'''</span>.
 
* The target file contains the copied data without the conditions that were marked as averages.
 
* The target file contains the copied data without the conditions that were marked as averages.
 
 
 
  
  
 
'''Removing one or more unwanted conditions (by label)'''
 
'''Removing one or more unwanted conditions (by label)'''
 
  
 
* Open the file you want to operate on in BESA Research.
 
* Open the file you want to operate on in BESA Research.
Line 1,535: Line 1,199:
 
* Deselect the target conditions you want to omit (replace the "+1" by a blank).
 
* Deselect the target conditions you want to omit (replace the "+1" by a blank).
 
* Click on the '''Run Scripts Tab'''. Select "''No averages, just copy''".
 
* Click on the '''Run Scripts Tab'''. Select "''No averages, just copy''".
 
 
 
 
 
 
* Press<span style="color:#3366ff;">''' OK'''</span>.
 
* Press<span style="color:#3366ff;">''' OK'''</span>.
 
* The target file contains the copied data without the conditions that were marked as artifacts.
 
* The target file contains the copied data without the conditions that were marked as artifacts.
Line 1,545: Line 1,204:
  
  
 +
=== How to Rename Conditions ===
  
 
==== How to Rename Conditions ====
 
  
 
* Open the file you want to operate on in BESA Research.
 
* Open the file you want to operate on in BESA Research.
Line 1,558: Line 1,216:
  
  
 +
=== How to Change the Sampling Rate ===
  
 
==== How to Change the Sampling Rate ====
 
  
 
* Open the file(s) you want to change in BESA Research.
 
* Open the file(s) you want to change in BESA Research.
Line 1,571: Line 1,228:
  
  
 +
=== Example: Create grand average and combinations of conditions ===
  
 
==== Example: Create grand average and combinations of conditions ====
 
  
 
In this example, we will generate a grand average of the results of the Auditory Intensity Experiment. The experiment includes averages from five different stimulus intensities. We will create a grand average over each intensity, but also include means over the two lowest and the two highest intensities, and the difference between these two combinations.
 
In this example, we will generate a grand average of the results of the Auditory Intensity Experiment. The experiment includes averages from five different stimulus intensities. We will create a grand average over each intensity, but also include means over the two lowest and the two highest intensities, and the difference between these two combinations.
Line 1,580: Line 1,236:
 
'''A. File selection'''
 
'''A. File selection'''
  
 
+
# Start BESA Research and open files <span style="color:#ff9c00;">'''S1_av.fsg - S10_av.fsg'''</span> in the ''Examples\ERP-Auditory-Intensity'' folder. The files contain the individual averaged data of the 10 subjects who participated in this study.
# <div style="margin-left:1.259cm;margin-right:0cm;">Start BESA Research and open files <span style="color:#ff9c00;">'''S1_av.fsg - S10_av.fsg'''</span> in the ''Examples\ERP-Auditory-Intensity'' folder. The files contain the individual averaged data of the 10 subjects who participated in this study.</div>
+
 
# Select ''ERP / Combine Conditions...'' The file list should display the two files, with feedback about the number of averages and conditions. 8 epochs are found. See the ''“Data averaging in the auditory intensity'' ''experiment”'' example for examples how to manipulate the file list.
 
# Select ''ERP / Combine Conditions...'' The file list should display the two files, with feedback about the number of averages and conditions. 8 epochs are found. See the ''“Data averaging in the auditory intensity'' ''experiment”'' example for examples how to manipulate the file list.
 
 
 
 
 
 
 
 
 
 
 
  
  
Line 1,602: Line 1,246:
  
  
# Click on the '''Condition List Tab'''. The initial window defines target conditions with the same name as the source conditions. To generate the grand average over these conditions we could proceed without further changes to the '''Run Scripts Tab'''. However, we want to modify the condition list and create a condition that contains the grand averaged difference between the''' High''' and '''Low''' conditions.
+
1. Click on the '''Condition List Tab'''. The initial window defines target conditions with the same name as the source conditions. To generate the grand average over these conditions we could proceed without further changes to the '''Run Scripts Tab'''. However, we want to modify the condition list and create a condition that contains the grand averaged difference between the''' High''' and '''Low''' conditions.
  
  
Line 1,609: Line 1,253:
  
  
# Click on the '''All '''column label. In the resulting window, rename condition '''All''' to''' Difference'''. Then press <span style="color:#3366ff;">'''OK'''</span>.
+
2. Click on the '''All '''column label. In the resulting window, rename condition '''All''' to''' Difference'''. Then press <span style="color:#3366ff;">'''OK'''</span>.
 
+
 
+
 
+
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (33).gif]]</div>
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
# The last column is now labeled '''Difference.''' Left-click twice onto the ‘'''+1’''' entry that links this condition to the '''All '''input condition. This will remove the link and leave the field blank. To define the ‘Difference’ condition as the average of ‘High’ minus ‘Low’ over subjects, left-click once into the field linking input '''High''' with target '''Difference''' to generate an entry ‘'''+1’''' in this field. Left-click twice into the field linking input '''Low '''with target '''Difference''' to generate an entry '-'''1'''’.
+
  
  
 +
[[Image:Batch processing (33).gif]]
  
  
 +
3. The last column is now labeled '''Difference.''' Left-click twice onto the ‘'''+1’''' entry that links this condition to the '''All '''input condition. This will remove the link and leave the field blank. To define the ‘Difference’ condition as the average of ‘High’ minus ‘Low’ over subjects, left-click once into the field linking input '''High''' with target '''Difference''' to generate an entry ‘'''+1’''' in this field. Left-click twice into the field linking input '''Low '''with target '''Difference''' to generate an entry '-'''1'''’.
  
  
Line 1,667: Line 1,282:
  
  
# Press <span style="color:#3366ff;">'''Save Condition List'''</span> and save the list to <span style="color:#ff9c00;">'''ER</span><span style="color:#ff9c00;">P-aud-ex1.clist'''</span>. This condition combination can thus be loaded later using the <span style="color:#3366ff;">'''Load Condition List'''</span> button.
+
4. Press <span style="color:#3366ff;">'''Save Condition List'''</span> and save the list to <span style="color:#ff9c00;">'''ER</span><span style="color:#ff9c00;">P-aud-ex1.clist'''</span>. This condition combination can thus be loaded later using the <span style="color:#3366ff;">'''Load Condition List'''</span> button.
 
+
 
+
 
+
  
  
Line 1,676: Line 1,288:
  
  
# <div style="margin-left:1.259cm;margin-right:0cm;">Click on the '''Run Script Tab'''.</div>
+
# Click on the '''Run Script Tab'''.
 
# The default tab settings are ready for generating the grand average ('''Combine data from source file''' and '''Open target file in BESA''' should be checked). Just press <span style="color:#3366ff;">'''OK'''</span>. Enter <span style="color:#ff9c00;">'''All_Subjects_cc-test.fsg'''</span> as file name and press<span style="color:#3366ff;">''' Save'''</span>.
 
# The default tab settings are ready for generating the grand average ('''Combine data from source file''' and '''Open target file in BESA''' should be checked). Just press <span style="color:#3366ff;">'''OK'''</span>. Enter <span style="color:#ff9c00;">'''All_Subjects_cc-test.fsg'''</span> as file name and press<span style="color:#3366ff;">''' Save'''</span>.
  
  
 +
The resulting file contains the 8 target conditions, 60db, 70dB, 80dB, 90dB, 100dB, Low, High, and Difference.
  
  
  
 
+
=== Example: Average files from different experiments ===
 
+
The resulting file contains the 8 target conditions, 60db, 70dB, 80dB, 90dB, 100dB, Low, High, and Difference.
+
 
+
 
+
==== Example: Average files from different experiments ====
+
  
 
This example is intended to illustrate several features of the ''Combine Conditions'' Dialog, such as electrode interpolation and resampling. We will combine an average from the Auditory Intensity experiment with one from the P300 auditory experiment. In this particular case, it is not a very meaningful thing to do, but it shows what is possible. For instance, the same experiment may have been performed using different sampling rates or electrode combinations. This example shows how such data may be combined.
 
This example is intended to illustrate several features of the ''Combine Conditions'' Dialog, such as electrode interpolation and resampling. We will combine an average from the Auditory Intensity experiment with one from the P300 auditory experiment. In this particular case, it is not a very meaningful thing to do, but it shows what is possible. For instance, the same experiment may have been performed using different sampling rates or electrode combinations. This example shows how such data may be combined.
Line 1,695: Line 1,303:
 
'''A. File selection'''
 
'''A. File selection'''
  
 
+
# Start BESA Research and open the file <span style="color:#ff9c00;">'''All_Subjects_GA.fsg'''</span> in the ''Examples\ERP-Auditory-Intensity'' folder. The file contains the grand average data from the auditory intensity experiment.
# <div style="margin-left:1.259cm;margin-right:0cm;">Start BESA Research and open the file <span style="color:#ff9c00;">'''All_Subjects_GA.fsg'''</span> in the ''Examples\ERP-Auditory-Intensity'' folder. The file contains the grand average data from the auditory intensity experiment.</div>
+
# Open the file <span style="color:#ff9c00;">'''RareFrequentResponseLeft.fsg'''</span> in the ''Examples\ERP-P300-Auditory'' folder. This file contains averages from the P300 auditory experiment.
# <div style="margin-left:1.259cm;margin-right:0cm;">Open the file <span style="color:#ff9c00;">'''RareFrequentResponseLeft.fsg'''</span> in the ''Examples\ERP-P300-Auditory'' folder. This file contains averages from the P300 auditory experiment.</div>
+
 
# Select ''ERP / Combine Conditions... ''Note that the files have different sampling rates and different numbers of electrodes.
 
# Select ''ERP / Combine Conditions... ''Note that the files have different sampling rates and different numbers of electrodes.
 
 
 
 
  
 
[[Image:Batch processing (36).gif]]
 
[[Image:Batch processing (36).gif]]
Line 1,709: Line 1,312:
 
'''B. Define conditions'''
 
'''B. Define conditions'''
  
 
+
1. Click on the '''Condition List Tab'''. Note that the feedback text at the bottom of the window displays the text "Standard 81 interpolation required to generate average; Across files: resampling or change in time range required to generate average". The condition labels show all the names from both files.
# Click on the '''Condition List Tab'''. Note that the feedback text at the bottom of the window displays the text "Standard 81 interpolation required to generate average; Across files: resampling or change in time range required to generate average". The condition labels show all the names from both files.
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
  
 
[[Image:Batch processing (37).gif]]
 
[[Image:Batch processing (37).gif]]
  
  
# We will exclude most conditions, and just combine the most similar conditions from the two experiments: the "Standard" and the "80dB" conditions. Click on the title of the first column,''' Blink'''. Select “''Delete all conditions to the right of this column”'', and press <span style="color:#3366ff;">'''OK'''</span>.
+
2.  We will exclude most conditions, and just combine the most similar conditions from the two experiments: the "Standard" and the "80dB" conditions. Click on the title of the first column,''' Blink'''. Select “''Delete all conditions to the right of this column”'', and press <span style="color:#3366ff;">'''OK'''</span>.
  
 +
[[Image:Batch processing (38).gif]]
  
  
<div style="margin-left:1.27cm;margin-right:0cm;"></div>
+
3. Click on the title again, and rename the target condition to "Standard".
  
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (38).gif]]</div>
+
[[Image:Batch processing (39).gif]]
  
  
# Click on the title again, and rename the target condition to "Standard".
+
4. Click twice in the first line to remove the "+1" entry there. Click once in the third row ("Frequent"), and in the 7th row ("80dB"), to display "+1" at each entry. Thus, just two of the conditions will be combined into one target condition.
  
 +
[[Image:Batch processing (40).gif]]
  
 
<div style="margin-left:1.27cm;margin-right:0cm;"></div>
 
 
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (39).gif]]</div>
 
 
 
# Click twice in the first line to remove the "+1" entry there. Click once in the third row ("Frequent"), and in the 7th row ("80dB"), to display "+1" at each entry. Thus, just two of the conditions will be combined into one target condition.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[[Image:Batch processing (40).gif]]
 
  
  
 
'''C. Run the script'''
 
'''C. Run the script'''
  
 +
1. Click on the '''Run Script Tab'''.
  
# Click on the '''Run Script Tab'''.  
+
[[Image:Batch processing (41).gif]]
  
  
 
+
2. Note that '''Interpolate to Standard 81 electrodes''' is checked and grayed: since two different electrode sets are to be combined, we can only do this by interpolating electrodes. Also, both '''Spline to new sampling rate''' and '''Clip interval '''are checked and grayed. Again, these settings are required in order to be able to average the two data files together. The sampling rate is set to the higher of the two selections. The time range is set to the largest possible range that can be clipped from the two data sets. For now, leave these settings as they are, and press <span style="color:#3366ff;">'''OK'''</span>. Save the target to <span style="color:#ff9c00;">'''TestCombineExpts_CC-std81.fsg'''</span>.
<div style="margin-left:1.27cm;margin-right:0cm;"></div>
+
 
+
<div style="margin-left:1.27cm;margin-right:0cm;">[[Image:Batch processing (41).gif]]</div>
+
  
  
# Note that '''Interpolate to Standard 81 electrodes''' is checked and grayed: since two different electrode sets are to be combined, we can only do this by interpolating electrodes. Also, both '''Spline to new sampling rate''' and '''Clip interval '''are checked and grayed. Again, these settings are required in order to be able to average the two data files together. The sampling rate is set to the higher of the two selections. The time range is set to the largest possible range that can be clipped from the two data sets. For now, leave these settings as they are, and press <span style="color:#3366ff;">'''OK'''</span>. Save the target to <span style="color:#ff9c00;">'''TestCombineExpts_CC-std81.fsg'''</span>.
+
{{BESAManualNav}}

Latest revision as of 14:54, 11 March 2024

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


Combine Conditions and Batch Module: Introduction

Functions of this module are started by selecting the menu operations "ERP / Combine Conditions..." and "Process / Batch Scripts...".

  • Combine Condition Scripts provides various operations on BESA averages.
  • Batch Scripts provides batch operations on all data files.
  • Note that a batch script can also be performed on the current file by selecting "Process / Run Batch..." or by typing the shortcut key "R".


File List Tab

Define a list of files on which the operations will be performed. The tab is the same for Combine Conditions Scripts and for Batch Scripts. Combine Conditions Scripts only allows you to open BESA average files (e.g. *.fsg and *.avr, but also .mul, .raw, .swf, and .foc if the files have a defined pre-stimulus interval), whereas Batch Scripts allows you to open any data file whose format is known to BESA Research.

When the Combine-Conditions or the Batch module is started, all currently opened (Combine-Conditions: averages only) files are displayed in the list.

To the right of each file name, the number of electrodes, total number of channels, and the sampling rate used in the file are displayed. In the Combine-Conditions module, the number of Epochs (segments) and the number of differently-named conditions are also shown.


Add files to the list

  • Press the Add File button.
  • Drag one or more files from Windows Explorer onto the window.


Remove files from the list

  • Right click on the file name and confirm the delete operation in the resulting dialog.
  • Mark one or more file names in the list (e.g. hold down the Ctrl key to mark multiple files). Right click to obtain the context menu and select "Delete", or just press the Del key.


Reorder files within the current file list

  • Right click on the file name and select "Move Up" or "Move Down".
  • Mark one or more file names in the list (e.g. hold down the Ctrl key to mark multiple files). Right click to obtain the context menu and select "Move Up" or "Move Down", or hold down the Ctrl key and press the Up and Down arrows.


Sort the current file list alphabetically

  • Click on the File bar above the list


Save the current file list

  • Press the Save File List button.


Load a file list

  • Press the Load File List button, or the Load Previous button to load the most recently used file list.


Which conditions are read from a source file? (Combine-Conditions module only)

  • Normally, all conditions are read from a source file. To exclude one or more segments from operations in the Combine Conditions module, mark the segments as artifacts in the main program display. It is sufficient for the beginning or the end of an artifact interval to be within the segment for the segment to be excluded.


File list from Combine Conditions:


Batch processing (1).png


Don't try to open here... (Batch only)

By default, this checkbox is unchecked.

In the checked state, BESA Research doesn't check if it can open the file. Use this function only if the file is ASCII and you want to use the ImportASCII batch command.


File List from Batch Scripts:


Batch processing (2).png

Batch Processing

Batch Processing Scripts

With Batch Scripts, you can define a set of operations (e.g. Artifact Scan, Average, etc.) and apply these to several data files.

These operations include

  • Load Paradigm
  • Artifact Scan
  • Average
  • Export (and Merge)
  • File Open (switch to another data file)
  • Set filters
  • Specify a montage (used, for example, for export to current montage)
  • Run automatic eye and EKG artifact correction
  • Define artifact topographies
  • Turn artifact correction and view on and off
  • Read and write events
  • Edit default block epoch (for export around triggers)
  • Edit triggers (for export around triggers)
  • Mark a block for export, or send the block to Source Analysis or Top View
  • Convert patterns to triggers
  • Attach auxiliary files (e.g. elp, sfp) to the data file
  • Send to MATLAB
  • Specify display configurations for the BESA Research Main, SA, and Top View windows
  • and more - see the full list of Batch Commands


An additional set of commands are available for operations in the Source Analysis Module, allowing to load, create and fit dipole models, and save the results.

A further set of commands apply to Time-Frequency Analysis, allowing to start TFC, change the display, save results, and run the beamformer or DICS analyses on a selected time-frequency range.


Batch commands1.png

These operations will be extended in future program releases.

The module includes two tabbed windows:

  • File List: Define a list of files on which the operations will be performed.
  • Batch: Define or load batch commands. Run the batch.

Batch Tab

Load or define batch commands, and then apply them to the files in the File List.

Batch processing (4).png


Add Command

  • Press Add Command to add a new command to the batch. The following dialog is opened, showing the available commands:


Batch commands1.png


  • Select the desired command and press OK or double-click on the command. A dialog box is opened, allowing to specify individual command parameters.
  • If you click on "Apply at beginning of batch" or "Apply at end of batch", the command will only be run at the beginning or the end of a batch. You can use this, for example, at the end of a batch to start a MATLAB script to perform statistics on the results of the batch.


Load and Save Batch

  • Press Load Batch to load a previously defined batch or Save Batch to save the current batch to a file (*.bbat).


Load Previous

  • Press Load Previous to load the most recently used batch file. Whenever a batch is run, the current set of commands is written to the file Previous.bbat in the Scripts/Batch subdirectory. This file is loaded when you press Load Previous.


Clear All

  • Clears all commands from the window.


View Log File

  • Each time a batch is run, BESA Research adds information about the batch to a log file, with headings showing the date and time the batch was started. The file is opened automatically in Internet Explorer if errors occurred during processing. Otherwise you may open the file by pressing the View Log File button here or in the dialog that is displayed at the end of batch processing.
  • The log file is saved in xml format, and a JavaScript is used to format the display in web browsers. JavaScript should be enabled in the browser to obtain an optimal display of the results. If JavaScript is enabled, the log file is displayed as a list of headings for each batch. Click on a heading to display the results of the corresponding batch.
  • To open the log file in the Notepad, hold the Shift key down when pressing the View Log File button.


Batch Command List

  • Double-click on a command to edit it. See Batch Commands for descriptions of the dialogs that are opened to edit each command.
  • Right click on a command to open a context menu allowing more options.


Batch processing (5).png


  • Delete, Move Up, and Move Down can also be applied to multiple selections.
  • If you have made a multiple selection, the Del button will delete all the marked commands. Ctrl plus Up or Down cursor keys will move the marked commands up or down.
  • Toggle Comment will add or remove a semicolon (;) in front of the command, to deactivate or reactivate the command.
  • Toggle Command Only at Start/End will add or remove the text "Start_" or "End_" in front of the command. With these prefixes, the command will only be performed when the first file ("Start_") or the last file ("End_") in the file list is being processed.


Single Step Mode

  • Check this item to step through the batch, one command at a time. A dialog is opened after each command, allowing to run the next command, continue the batch without single steps, or stop running the batch. See the “Pause” command for further details.
  • During a batch, press and hold down the Pause or Delete key to interrupt the batch and enter Single Step Mode. Press and hold down the Esc key to cancel the batch.


Changes in batch written to database

  • Checked by default. If this item is unchecked, file display settings, such as Montage setting and Artifact correction display, are not written to the database. When the file is next opened in BESA Research, the settings made in the batch are not retained.


Leave files in the file list open after running the batch

  • If this item is checked, files in the file list will remain open after the batch. This is useful, for instance, if you want to open a set of files, specifying the same montage and/or filter settings for each file.


Press OK to start running the batch. Each command is then applied in succession to each file in the File List.

Note that, while a batch is running press and hold down the Pause or Delete key to interrupt the batch and enter Single Step Mode. Press and hold down the Esc key to cancel the batch.


The log file

A protocol of each batch is written to the log file Batch.txt. (e.g. C:\Users\Public\Documents\BESA\Research_7_1\Scripts\Log\Batch.txt)

When you press the View Log File button, the file is opened in the Batch Log dialog. The Batch Log dialog will be opened automatically if there was an error during batch processing, unless you have used the BatchError batch command to suppress this behaviour.

Backup of the log file

When the log file is written, a backup of the previous version is written to Batch.txt.bak.

If the size of the log file exceeds 200 KB, it is renamed to Batch.txt_date_time (e.g. Batch.txt_2004-10-08_10-53-32), and a new version of Batch.txt is created.

Placeholders

A powerful feature of the batch commands is the ability to define file names and specify standard paths using placeholders. These are text strings enclosed by percentage (%) signs. They can be used in all batch commands where file names are specified.


Basename

Placeholder Description Example
%basename% replaced by the basename of the currently opened file. If the data file is named "f-spike.fsg", "%basename%-export.fsg" will be interpreted as "f-spike-export.fsg".
%basename-n% replaced by the basename of the currently opened file, but removing the last "n" characters from the name. If the data file is named "dongle-BB.fsg", "%basename-3%" will be replaced by "dongle", because the last 3 characters of the basename have been removed.
%-nbasename% replaced by the basename of the currently opened file, but removing the first "n" characters from the name. If the data file is named "BB-dongle.fsg", "%-3basename%" will be replaced by "dongle", because the first 3 characters of the basename have been removed.
%orgbasename% replace by basename of the current file in the file list (it has the same meaning as %basename% if no MAINFileOpen batch command was used in command list)
%base% replace by basename of the current file without the path
%orgbase% replace by basename of the current file in the file list without the path
%ext% replace by extension of the current file
%orgext% replace by extension of the current file in the file list
%basefolder% replace by folder of the current file
%orgbasefolder% replace by folder of the current file in the file list
%t% Log batch command only: time since start of batch on current file
%T% Log batch command only: current date and time
%label% Replace label of the most recent marked block by the block label, not including no. of averages
%LABEL% Replace label of the most recent marked block by the block label, including no. of averages
%scripts% replaced by the path to the Scripts folder. "%scripts%Batch" is where batches are saved by default; "%scripts%MATLAB" is the location of the standard MATLAB scripts used by BESA Research.
%montages% replaced by the path to the Montages folder.
%examples% replaced by the path to the Examples folder.


Placeholders for folders

The following placeholders are the same as those used in the [Folders] section of Besa.ini:

The strings enclosed by percent signs (%) are placeholders for the following folders in English-language versions of Windows. Folder names are different for the system and for other language settings. BESA Research will substitute the placeholders by the appropriate folder name for the Windows system and the system language:


  • Windows 10 (English)
%localapp% = ""C:\Users[user]\AppData\Local\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Desktop as ""Desktop[user]\AppData\Local\BESA\Research_7_1".
%publicprog% = "Documents\BESA\Research_7_1".
%privateprog% = ""C:\Users\[user]\Documents\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as "Desktop\[User]\Documents\BESA\Research_7_1".
%progdir% = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_7_1".
%besaroot% is the same as %progdir%


  • Windows 7 (English):
%localapp% = "C:\Users\[user]\AppData\Local\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Desktop as "Desktop\[user]\AppData\Local\BESA\Research_7_1".
%publicprog% = "C:\Users\Public\Public Documents\BESA\Research_7_1". This folder is directly accessible from the Windows Explorer under "Libraries\Documents\Public Documents\BESA\Research_7_1".
%privateprog% = "C:\Users\[user]\Documents\BESA\Research_7_1", where [user] is the logon name of the current user. This folder is directly accessible from the Windows Explorer as ""Libraries\Documents\My Documents\Research_7_1" or "Desktop\[User]\My Documents\BESA\Research_7_1".
%progdir% = the BESA Research root folder. In a default installation, this is "C:\Program Files\BESA\Research_7_1".
%besaroot% is the same as %progdir%  


Batch Commands

Batch commands are selected when the "Add Command" button is pressed in the "Batch" Tab. The commands are subdivided into five categories: General commands, commands for the Main module, for the Source Analysis module, imaging commands in the Source Analysis module, and commands for Time-Frequency Analysis. The commands have prefixes, GEN, MAIN, SA, SAIMAGE, and TFC), which identify the category. For compatibility with older program versions, old batches without the prefixes are accepted.

Detailed descriptions of each batch command are available in the electronic help chapter “Batch Processing and Combining Conditions / Batch Processing / Batch Commands”.


General commands - prefixed with "GEN" (can be used anywhere):

GENBatchError used to change program behavior when errors occur
GENBatchWindowPosition set the position of the batch window relative to the main window
GENComment comment in the batch script: no batch functionality
GENMATLABcommand send a command string to MATLAB
GENMATLABwaitForVariable tells BESA to wait until Matlab has created a variable with the specified name.
GENPause pause batch operations, allowing step-by-step operations
GENFor/GENEndFor a programming language-like FOR loop
GENRunProcess runs a command-line process, e.g. an external program to perform part of the data analysis in the batch
GENsaveBitmap save a screenshot of the Source Analysis or the 3D window
SetVariable the value of the variable is inserted into subsequent batch commands where the text contains the name flanked by % signs
GENWindowPosition set window size and positions to a selection of standard settings, e.g. for bitmap export


Commands for the Main Module - prefixed with "MAIN":

MAINArtifactCorrect run automatic artifact correction
MAINArtifactMethod specify the method for artifact correction
MAINArtifactOn turn artifact correction an artifact view on or off
MAINArtifact Scan run an artifact scan as from the Paradigm Dialog
MAINAuxiliaryFiles associate auxiliary files (e.g. *.ela, *.sfp) with the data file
MAINAverage average the data
MAINBaseline specify the parameters for baseline correction
MAINDefineArtifactTopography define an artifact topography
MAINEditDefaultEpoch edit the default block epoch
MAINEventRead read events from an ASCII event file
MAINEventWrite write events to an ASCII event file
MAINExport export or append data in the selected target format
MAINExportToBESAConnectivity export data segments to BESA Connectivity
MAINFFT calculates the FFT spectrum of the marked data interval
MAINFFTmean starts an averaging procedure that calculates the mean spectral properties in pre-defined regions
MAINFFTsave saves FFT data (generated using the FFT Average option in the Average command) to disk (*.fma)
MAINFileOpen close the current file and open a new file to which the remaining batch commands will be applied
MAINFileClose close the currently open file in a batch, provided it is not the current file in the File List
MAINFilter set filters
MAINfMRIArtifact turns on the fMRI artifact removal
MAINGoTo jumps with the cursor to the specified time point
MAINICA starts ICA decomposition of data on the current screen
MAINICAsave saves selected ICA components as topographies in a file
MAINICAselect opens component selection dialog for managing ICA components
MAINImportASCII import an ASCII file into a *.fsg file.
MAINMarkBlock mark a data block (optionally send to Source Analysis)
MAINMarkChannels mark one or more channels, as given by the list
MAINMaxInInterval within the current marked block, search for the largest absolute value on the specified channel
MAINMontage change the montage (used by the Export command when saving to current montage)
MAINParadigm load a paradigm file
MAINPatternToTrigger convert a tag into a trigger
MAINPolygraphicFilters sets filters for polygraphic or added channels
MAINScale set amplitude and time scales
MAINSearchAverageView start search average view
MAINSendToMATLAB send data to MATLAB
MAINSMTApply load and apply Schmitt trigger settings file to the data set
MAINSplineConstant set the spline constant used in spherical spline maps and channel interpolation
MAINTriggerRecode the command recodes a specified trigger number to a new number
MAINTriggerSelect edit the trigger list (cf. Edit / Trigger Values...)
MAINTriggerTagDelete delete one or more triggers or tags
MAINViewAverageBuffer turn on the Average Buffer View and place the specified buffer number to the left in the display
MAINViewChannelType select the channel type to display, and select channel types for mapping, export, etc
MAINViewSelected turns selected view on or off


General commands for Source Analysis - prefixed with "SA" (but see also MarkBlock, which is used to send a block of data to SA and open the SA window):

SAAddSource add a dipole or regional source to a model
SAChannelTypeForFit switch between EEG, magnetometers or axial gradiometers, and planar gradiometers
SAConvertSource convert a source from dipole to regional source, or from regional source to dipole
SAcorticalClara run Cortical CLARA
SAcorticalLoreta run Cortical LORETA
SADelete delete current solution or all solutions or remove current fit interval or cursor
SADICS start DICS computation (if DICS has been precomputed in the time-frequency image command)
SADisplayMRI switch MRI display on/off and select small or large window
SAElectrodeConfiguration equivalent to pressing the Org or Std button in the Channel box of the Source analysis window
SAExit close Source Module
SAFit start fit
SAFitConstraint set fit constraints, e.g. Residual Variance, Energy, Maximum Distance, Image Weighting, and their weights.
SAFitInterval set fit or baseline interval
SAHeadModel set the head model
SALabelSource set the label of the specified source number
SAMinimumNorm run a minimum norm analysis
SANewSolution open a new solution
SAOpenSolution open a solution from a file
SAPCA toggle PCA display of data or residual, and transfer a selected number of components to the source model
SARegularization set the regularization values both for discrete and distributed source images
SASaveBitmap save a screenshot of the Source Analysis or the 3D window
SASaveLeadfields save the leadfields of the current source model
SASaveModelWaveforms save model waveforms
SASaveResidualWaveforms save residual waveforms
SASaveRVandGFPWaveforms save residual variance and global field power waveforms
SASaveSolution save the current solution
SASaveSourceMontage save a source montage
SASaveSourceWaveforms save source waveforms
SASendToMATLAB send data, model, source waveforms, images, etc. to Matlab
SASetCursor set the cursor
SASetDefaultSourceType set the default source type (dipole or regional source)
SASetOrActivateSource Turn specified source on or off, or enable/disable source for fitting
SASetOrientation set orientation (of regional source)
SASwitchCondition switch to a specified condition


Commands for Distributed 3D Volume Images

SAIMAGEBeamformer switch between Single Source and Bilateral Beamformer image
SAIMAGEBeamformerTimeDomain start beamformer computation in the time domain
SAimageBrainAtlas turns on the Brain Atlas overlay on volumetric image
SAIMAGECLARA generate CLARA image
SAIMAGEClip clip image values under a threshold
SAIMAGEExport save the results of minimum norm or 3D imaging method
SAIMAGEGotoMax set the crosshair cursor at the nth maximum in the image
SAIMAGEImport load a 3D volume image from file
SAimageImportFMRI import fMRI image to Source Analysis Module
SAIMAGELAURA create LAURA image
SAIMAGELORETA create LORETA image
SAIMAGESLoreta create sLORETA image
SAimageSESAME start SESAME computation
SAIMAGESSLOFO create SSLOFO image
SAIMAGEUser-Defined create user-defined image
SAIMAGESaveLeadfields save the leadfields of all the voxel sources in a 3D image
SAIMAGEClip clip current 3D image
SAIMAGESmooth smooth current 3D image
SAIMAGESetCrosshair set the position of the crosshair in the 3D image


Commands for Time-Frequency Analysis (TFC)

TFCStartTFAnalysis (previously TFCgo) start TFC analysis using the current paradigm settings
TFCdisplay change the TFC display (e.g. power/amplitude, coherence)
TFCsave save numerical results to an ASCII file, or save a screenshot of the TFC window
TFCimage start beamformer analysis on a selected time-frequency range
TFCSendToMATLAB send TF results or single-trial data to MATLAB

How to Average Your Data in a Batch

Using batch processing, several files from an experiment can be averaged at a time.

Here we summarize the steps required:


Before running the batch

  • Create the paradigm, and save the paradigm file.
  • Open each individual data file to check the data:
    • Make sure auxiliary files are defined and loaded properly, and the data are displayed correctly.
    • Eyeball the data.
    • Define bad (and interpolated) channels.
    • Mark artifact time ranges.
    • If required, set up artifact correction for the file.
    • The data file can be closed again after this step.


Preparing the batch

  • Open at least one file and select Process / Batch Scripts.... The file(s) should be displayed in the file list. Alternatively, just select Process / Batch Scripts..., and add the files by
    • pressing the Add File button
    • dragging the files from Windows Explorer
    • Opening a previously saved list with Load File List


  • You can delete files from the list (press Del) or edit the file sequence using the right click context menu.
  • Select the Batch Tab.
  • Add commands to your script. For averaging, these would normally be
    • Paradigm -- to load the paradigm file
    • Artifact Scan -- to run the artifact scan
    • Average -- to perform the average


  • Save these commands (press Save Batch).
  • Test the commands on the files in the current file list: press OK
  • Look at the log file (press View Log File) to check the results of averaging.
  • Look at the data averages to make sure they have been done correctly.
  • Repeat these steps until averaging is working properly.


Running the batch

  • Select Process / Batch Scripts....
  • Open the files you want to average in the batch in the file list:
    • Any files that were open in BESA are included in the list
    • Files can be added using the Add File button
    • You may drag one or more files from Windows Explorer to the file list
    • Alternatively, load a previously saved file list.


  • Edit the file list, e.g. delete unwanted files (use the Del key or the right click context menu), or reorder the files (use Ctrl + cursor keys or context menu).
  • Note that the order of files in the list specifies the order in which they will be processed in the batch script. This order will be important if all results are saved to the same target file. Otherwise the file sequence is not important.
  • Optionally, save the file list (press Save Batch
  • Select the Batch Tab, and load the previously defined batch script with Load Batch.
  • Press OK to run the batch.

How to Merge and Compress raw data

Using the Export command in a batch, several data files can be merged into a single data file in BESA's data format (*.foc).

This can be useful if data from one subject have been collected in several data blocks, and you want to analyze all data blocks together.

Optionally, to save space, data can be saved in compressed format.


Files can be merged:

  • if they have identical channel configurations, or
  • there are at least 16 EEG channels, and the export format is Standard 81 (i.e. EEG channels are interpolated to 81 standard locations).


How to merge files:

  • Select Process / Batch Scripts...
  • Add all the files that are to be merged to the file list:
    • Any files that were open in BESA Research are included in the list
    • Files can be added using the Add File button
    • You may drag one or more files from Windows Explorer to the file list
    • Alternatively, load a previously saved file list (Load File List).
  • Rearrange the files in the file list to the sequence in which they should be merged.
  • Select the Batch Tab and insert an "Export" command, as described below.


The following dialog shows a possible configuration of the Export command:

Batch processing (4).gif


  • The parameters shown in the Information box are the settings chosen in the Export Dialog when the Select Options button has been pressed.
  • Append if file already exists must be checked in order to merge the files.
  • The target file name must be fixed, i.e. don't use the %basename% variable, because that will result in a different target file name for each source file.
  • There are two variables that can be used for the segment label:
    • %filename% will insert the basename of the source file into the segment label.
    • %c% will insert the file number into the segment label. The number gives the position of the file in the file list. For instance, "File %c%" will generate the label "File 2" for the second file in the list.

Example: Data averaging in the auditory intensity experiment

In this example, two raw data files, s1.cnt and s2.cnt, from the auditory intensity experiment will be batch averaged.

Please note that there are further tutorials covering this experiment. The first file is contaminated by many eyeblinks, and more epochs would be averaged if eye correction were used (see Viewlet demonstration on artifact correction on the BESA website). However, in this tutorial, we will just use artifact rejection.


A. Various ways of creating a File List

1. Files that were open in BESA Research are automatically added to the File List. Start BESA Research and open the files s1.cnt and s2.cnt in the directory Examples\ERP-Auditory-Intensity.

2. Select Process / Batch Scripts.... You should see the file names in the File List Tab something like this:

Batch processing (5).gif


3. You can resort the files in the file list alphabetically by clicking onto the File List column header:

Batch processing (6).gif


Alternatively, you can mark any file, hold down the Ctrl key and press the Up or Down arrow to move the file name up or down the list. This is the sequence in which files will be processed in the batch.

Batch processing (7).gif


4. Press Save File List and save the list you have created to ERP-Aud-Ex1.flist.

5. Highlight both names and press the Del button to remove them from the list.

6. Files can be dragged from Windows Explorer. Start Windows Explorer and navigate to the ERP-Auditory-Intensity subdirectory of your BESA Research examples folder (located in the Public Documents folder of your computer). Click on s1.cnt and drag it with the mouse onto the File List Tab. Let go of the mouse. BESA Research opens the file, and displays the name in the File List. Repeat for s2.cnt.

7. Highlight both names and press the Del button to remove them from the list.

8. Files can be added using the Add File button. Press Add File and navigate to the Examples\ERP-Auditory-Intensity subdirectory. Select s1.cnt. Press Ctrl and select s2.cnt. Both names should then be displayed in the File Open dialog. Press OK to add the files to the file list.

9. Highlight both names and press the Del button to remove them from the list.

10. Files can be loaded from a previously saved file list. Press Load File List and select ERP-Aud-Ex1.flist, the list you saved in step 6 above.


B. Setting up the batch

1. We will add three commands, Paradigm, Artifact Scan, and Average, to create a batch that will be applied to the two files in the file list.

2. Click on the Batch Tab.

Batch processing (8).gif


3. Press the Add Command button to obtain the Select Command window:

Batch processing (9).gif


4. Click on Paradigm and then on OK (alternatively, double-click on Paradigm). Hit Browse, navigate to the Auditory folder, and select AEP_Intensity.pdg, the paradigm for the auditory intensity experiment.

Batch processing (10).gif


5. Press OK to obtain the Load Paradigm Task window.

Batch processing (11).gif


6. Press OK, and the first task in the batch is ready, and listed in the Batch Command window. If you want to modify the command, double-click on it to open the above window, that allows to browse for a different paradigm file.

Batch processing (12).gif


7. Next, we add the Artifact Scan command. Click on the Add Command button, and select Artifact Scan.

Batch processing (13).gif


8. Press OK to open the Artifact Scan Task window. We want to be able to view the results of the scan, and adjust thresholds and bad channels if necessary. Therefore, check the Wait after scan checkbox.

Batch processing (14).gif


9. Press OK to close the Artifact Scan Task window. Our batch now contains two commands.

Batch processing (15).gif


10. Finally, we will add an Average command. Press the Add Command button and select Average. Press OK to open the Average Task window.

Batch processing (16).gif


11. With the default settings, the average would be saved to the same directory as the data. The file name mask is set by default so that in this example the two averages would be saved to s1-av.fsg and s2-av.fsg. We will save the averaged files to subdirectory "Averages" of the data directory. Uncheck the Use default target check box, change the File name mask to %basename%_av-test in order not to overwrite the predefined files.

Batch processing (17).gif


12. Press OK to close the Average Task window. Our batch is now complete.

Batch processing (18).gif


13. We will now save the batch so that it can be used again. Press the Save Batch button, and save to the file ERP-Aud-ex1.bbat. Note that an easy way to generate new averaging batches is to load a previously save batch and edit the commands -- it may only be necessary to edit the Paradigm command to select the relevant paradigm file, and maybe to adjust the target directory in the Average command.

14. Press OK in the Batch Window to start the batch running. As requested, the batch pauses after the artifact scan:.

Batch processing (19).gif

You may now adjust the number of rejected trials, e.g. by moving the vertical red bar to the left or exclude bad channels.


15. Press OK to continue with averaging.

Batch processing (20).gif


16. Note that, in the background, the Batch Running window is providing feedback about the current file and current task.

Batch processing (6).jpg


17. The batch will stop again after the next artifact scan. Press OK to allow the batch to run to the end.

Batch processing (21).gif


18. Press View Log to view the batch log.

19. The batch log gives feedback about the number of epochs that were averaged for each file.

20. Finally, press OK to return to the main BESA Research display. Open the averages in the Averages subdirectory to confirm that they were generated properly.

Example: Merging files using the Export Command

Here we will demonstrate the use of the Export command to merge two files. We will combine the two averages from the previous example (Data averaging in the auditory intensity experiment) into one target file.


A. Generate the file list

  1. Start BESA Research and load the two data files S1_av-test.fsg and S2_av-test.fsg that were saved in the previous example.
  2. Select Process / Batch Scripts....The two file names should be displayed in the file list.
  3. In the file list, make sure that s1_av-test.fsg is the first file in the list. If it is not, highlight the file, and move it up using Ctrl+up, or right click and select Move Up in the context menu.


B. Generate the batch

1. Press the Add Command button, and select the Export command.

2. Press OK to open the Export Task window.


Batch processing (24).gif


3. Press the Select Options... button to open the Export Dialog.


Batch processing (25).gif


4. Since we are combining averages, select Hires (no compression) in the Target data format drop-down list (If we were merging raw data files, it is better to select compression. Press OK to close the dialog. Check Append if file already exists, so that the files will be merged. Enter s1+s2 in the target file name mask edit box. This ensures that both files will be saved to the same target: S1+S2.fsg.


Batch processing (26).gif


5. Press OK to close the Export Task window. The Export command is displayed.  


Batch processing (27).gif


6. Optionally, you may save the batch file by pressing Save Batch.

7. Press OK to run the batch, and OK in the Batch Completed window to return to the BESA main window.

8. Finally, open the file S1+S2.fsg to confirm that it contains the two merged files.


C. Merge raw data


  1. Repeat the above task to merge the two raw data files S1.cnt and S2.cnt into a single target file S1+S2.foc. In this case, select one of the compression options as the target data format. Note that you would not normally want to merge two files from different subjects. However, several data blocks from the same subject can conveniently be merged using this method.


Note that *.fsg files can also be merged using the Combine Conditions dialog.


Combine Conditions, Channels

Combine Condition Scripts

With the Combine-Conditions module you can do a variety of operations on BESA averages (files with the extension *.fsg, and other segment files, such as *.mul, *.avr, *.swf):

  • Create grand averages
  • Combine averages (add, subtract, weighted/unweighted)
  • Merge files
  • Exclude unwanted averages
  • Rename conditions
  • Rename or resort channels
  • Generate averages or differences over selected channels
  • Transform the data: standard interpolated 81 electrodes, change sampling rate, change interval
  • Determine peaks, mean amplitudes, or integrals on data averages
  • These operations can be performed on one or more files simultaneously. Results of an operation are stored in a single target file.

The module includes four tabbed windows:

  • File List: Define a list of files on which the operations will be performed.
  • Condition List: List the condition names, define target condition names, and how input conditions are combined into target conditions.
  • Channel List: List the channel names, define target channel names, and how input channels are combined into target channels.
  • Run Scripts: Define global options for the output (e.g. spatial interpolation, resampling, copy/merge or average, peak analysis). Start the operation.
  • Note that in all four tabs, configurations can be saved for future use, and the Load Previous button restores the most recently used configuration.

Condition List Tab

List the condition names, define target condition names, and how input conditions are combined into target conditions.

The first column of the list box shows a list of all the condition names found in the source files.

Rows of the list box define the source conditions. Columns define the target conditions.


Initial setting

When first selecting the tab, each column shows each condition name found in the source files (as in the example below). In the list box, there is a "+1" along the diagonal. The result of this selection is that target conditions will have the same name as source conditions. Right click on source condition labels to view properties (e.g. no. of samples, time range, sampling rate).


Batch processing (28).gif


Editing the condition list

  • Target condition names can be edited, inserted or deleted by clicking on the label at the top of each column.
  • Click on a box within the list to toggle between "+1", "-1" and blank. These correspond to the operations:
    • "+1" = add
    • "-1" = subtract
    • blank = do nothing
  • Right click on a box for further operations: conditions can be weighted by a given factor other than 1.


Divide result by sum of PLUS factors

  • Normally, when creating an average over conditions, the sum is divided by the number of conditions or a weighted average is generated (see below).  If "Divide the result by the sum of PLUS factors" is unchecked, the conditions will be summed rather than averaged.
  • Note that, when making differences between conditions, no such division is required. BESA Research will uncheck the checkbox automatically if subtraction ("-1") is specified somewhere in the condition list.


Weighting of averages

  • Below the list, click on the Weighted Average row to toggle "YES" and "NO". "YES" means that averages will be weighted by the number of epochs contributing to the average. For instance, if average A contained 100 epochs and average B contained 200 epochs, the weighted average will be computed as
(100 * A +  200 * B) / (100 + 200)
Select "NO" for an unweighted average. For the above example, the average is computed as
(A + B) / 2
Weighted averages are not permitted if one of the boxes contains a negative value.
  • Values other than +1 or -1 in the boxes apply a different kind of weighting. For instance, we want to compute the difference between the means of conditions A, B, C and D, E. Use a right-click to specify the fraction 1/3 for each of A, B, and C, and -1/2 for each of D and E (see example below).


Batch processing (29).gif


Save the current condition list

  • Press the Save Condition List button.


Load a condition list

  • Press the Load Condition List button.


Load previous settings

  • Press the Load Previous button


Feedback

  • Conditions that have different numbers of electrodes (averaging across different files) can only be combined if channels are interpolated to a standard set of electrodes.
  • Conditions that have different durations or sampling rates can only be combined if the sampling rate and durations are made the same.
  • Feedback about the above situations is displayed by the presence of tick marks above the list box.

Channel List Tab

List the channel names, define target channel names, and how input channels are combined into target channels.

Note that this tab is very similar in usage to the Condition List Tab. Note also that some of the functions performed in this tab could also be done in the Montage Editor. It may be a matter of convenience whether you choose to perform these operations here or in the Montage Editor.

The first column of the list box shows a list of all the channel names found in the source files.

Rows of the list box define the source channel. Columns define the target channel.


Initial setting

When first selecting the tab, each column shows each channel name found in the source files (as in the example below). In the list box, there is a "+1" along the diagonal. The result of this selection is that target channel will have the same name as source channel.


Combining files

If files with different channel configurations are included in the File List, the rows and columns of the Channel List Tab will only contain the labels for the channels that are in common among the files.

If the files in the File List have a different sequence of channels, the sequence of the first file in the list will be adopted in the Channel List.

Thus, for the initial setting, unless the "Ignore Settings in this Tab" checkbox is checked, the target grand average or peak/amplitude analysis, etc. will be applied using only channels that are in common among the input files, and using the channel sequence of the first file in the File List. By changing the target channels or by changing the entries in the Channel List, new channels consisting of averages or differences can be generated.


What can the Channel List be used for?

Some examples:

  • Reorder or relabel channels
  • Create channel differences
  • Create averages over channel groups, e.g. for peak analysis
  • Extract a selection of channels for peak analysis or mean amplitudes
  • Create grand averages across files with different channel configurations, just using channels in common among the files


Batch processing (30).gif


Editing the channel list


  • Target channel names can be edited, inserted or deleted by clicking on the label at the top of each column.
  • Click on a box within the list to toggle between "+1", "-1" and blank. These correspond to the operations:
    • "+1" = add
    • "-1" = subtract
    • blank = do nothing
  • Right click on a box for further operations: channels can be weighted by a given factor other than 1.


Divide result by sum of PLUS factors

  • Normally, when creating an average over channels, the sum is divided by the number of channels or a weighted average is generated (see below).  If "Divide result by the sum of PLUS factors" is unchecked, the channels will be summed rather than averaged.
  • Note that, when making differences between channels, no such division is required. BESA Research will uncheck the checkbox automatically if subtraction ("-1") is specified somewhere in the channel list.


Save the current channel list

  • Press the Save Channel List button.


Load a channel list

  • Press the Load Channel List button.


Load previous settings

  • Press the Load Previous button

Run Scripts Tab

Define global options for the output (e.g. spatial interpolation, resampling, copy/merge or average, peak detection. Start the operation.


Batch processing (7).jpg


Load or Save Settings

  • You can save the current settings of this tab to a file (*.run) which can be loaded later.
  • When you run the script, the current settings are saved automatically to a file "PreviousSettings.run".


Load Previous

  • Press this button to load the previous settings (from "PreviousSettings.run").


Averages to Generate

  • Generate separate averages for each source file. Averages are performed over conditions within the source file, and are then appended to the target file.
  • Combine data from source files. Conditions are combined over all source files into a single target average.
  • No averages, just copy. Files are copied and merged to the target file. Use this option for renaming conditions, merging files, removing unwanted averages (see below), changing the sampling rate and interval.
  • Peaks and mean amplitudes. Specify time ranges for peaks, mean amplitudes, or integrals (areas).
  • Note: When generating or copying averages (first three options), filters and baseline settings are turned off. For Peaks and mean amplitudes, filters and baseline settings are specified in the dialog.


Spatial Interpolation

  • Interpolate to Standard 81 electrodes. The target file will contain only electrodes (other channels are omitted), using the Standard 81 configuration (as in other export functions within BESA Research). This cannot be selected if the source data contain less than 16 EEG channels.
  • Interpolate Bad Channels. Bad electrode channels in the source file will be interpolated. If the above option is deselected and bad channels exist in one or more of the source files, this option is always on.

BESA Research can interpolate EEG, and MEG if the sensors are axial gradiometers or magnetometers. If other channels are marked as bad in one or more of the source files, these will be defined as bad in the target file. This applies to MEG planar gradiometers, to polygraphic data, and to ICR channels.


Temporal Interpolation

  • Spline to New Sampling Rate and Interval. Data can be converted to a new sampling rate, and the interval can be changed.
    • If the sampling rate is reduced, the data will be low-pass filtered at 1/3 sampling frequency before reduction.
    • If the sampling interval is changed, the prestimulus and poststimulus intervals are limited by the smallest intervals in the conditions contributing to the averages. These limits are shown below the edit boxes.


Peaks and Mean Amplitudes


Batch processing (31).gif


Peaks:

  • Select the time range between which peaks are to be determined.
  • Select the montage on which the peaks are to be determined.
  • Define the filter settings.
  • Define the baseline settings.
  • Specify whether peaks are to be defined at one latency: if so, select the channel on which peaks are to be detected.
  • Specify whether you want to find positive or negative peaks.


Mean amplitudes and areas:

  • Select the time range over which the mean amplitudes or areas are to be determined.
  • Select the montage on which the mean amplitudes or areas are to be determined.
  • Define the filter settings.
  • Note that when computing areas, data are first rectified (made positive) and then summed over the time range.


Output options of the analysis:

  • A single ASCII file that contains the result of the analysis for all data sets, conditions, and channels including header and information lines.
  • A sparse output suitable for import in SPSS. Each variable (e.g. a latency, a channel amplitude) constitutes one column of the output file.
  • Direct transfer to MATLAB into a struct besa_peak. For more information on the data transfer from BESA Research to MATLAB, please refer to help chapter “The MATLAB interface”.


Starting the Operation

  • Press OK to start the operation. After the operation is completed, and the "Open target file in BESA" box is checked, BESA Research will open the target file.  "Open target file in BESA" cannot be checked if "Peaks and mean amplitudes" was selected - then the result of the operation will be an ASCII file or a MATLAB transfer.
  • You will be asked for the name of the target file (unless a MATLAB transfer of peak data has been performed).


Restrictions

  • Depending on source file configurations, not all options above are selectable. For instance, if two files contain different numbers of electrodes, and the "Ignore Settings in this Tab" checkbox is checked in the Channel List Tab, spatial interpolation to Standard 81 is enforced in the target. Similarly, if different sampling rates are used in different files, temporal interpolation is enforced.
  • You are not allowed to add files to the file list if the channel configuration is different, and the data cannot be combined with Standard 81 interpolation. Since Standard 81 interpolation is only possible for EEG, multiple files without EEG can only be loaded if they have the same number of channels.

How to Create Grand Averages

  • Open the files you want to average in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions. To average across different conditions, click in the list boxes to obtain "+1" for each source condition to combine, and rename the target condition to define a meaningful name for the average.
  • Click on the Run Scripts Tab.
  • If you have more than one file, specify whether averages should be generated across files (Combine data from source files) or within files (Generate separate averages for each source file).
  • Select other options if required (spatial or temporal resampling).
  • Press OK.


How to Generate Differences Between Conditions

  • Open the files you want to operate on in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions. To create differences, click in the list boxes to obtain "+1" for one of the source conditions, and "-1" for the source condition to subtract, and rename the target condition to define a meaningful name for the difference.
  • Click on the Run Scripts Tab.
  • If you have more than one file, specify whether averages should be generated across files (Combine data from source files) or within files (Generate separate averages for each source file).
  • Select other options if required (spatial or temporal resampling).
  • Press OK. An average of the differences is generated. If only one example of each condition exists, e.g. in a grand average file, the result is the difference between conditions.


How to Merge Files

  • Open the files you want to merge in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions.
  • Click on the Run Scripts Tab. Select "No averages, just copy".
  • Press OK.


Notes

  • If the source files have different electrode configurations, use the Standard 81 configuration for the target.
  • If the source files have different sampling rates or intervals, use Temporal Interpolation.


How to Remove Unwanted Averages

Removing one or more unwanted segments

  • Normally, all conditions are read from a source file. To exclude one or more segments from operations in the Combine Conditions module, mark the segments as artifacts in the main program display. It is sufficient for the beginning or the end of an artifact interval to be within the segment for the segment to be excluded.
  • Open the file you want to operate on in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions.
  • Click on the Run Scripts Tab. Select "No averages, just copy".
  • Press OK.
  • The target file contains the copied data without the conditions that were marked as averages.


Removing one or more unwanted conditions (by label)

  • Open the file you want to operate on in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions.
  • Deselect the target conditions you want to omit (replace the "+1" by a blank).
  • Click on the Run Scripts Tab. Select "No averages, just copy".
  • Press OK.
  • The target file contains the copied data without the conditions that were marked as artifacts.


How to Rename Conditions

  • Open the file you want to operate on in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions. Click on column headings to rename the target conditions.
  • Click on the Run Scripts Tab. Select "No averages, just copy".
  • Press OK.
  • The target file contains the copied data with the renamed conditions.


How to Change the Sampling Rate

  • Open the file(s) you want to change in BESA Research.
  • Start the Combine Conditions Module (ERP / Combine Conditions...).
  • Click on the Condition List Tab. By default, the target conditions receive the same name as the source conditions.
  • Click on the Run Scripts Tab. Select "No averages, just copy".
  • Select "Spline to New Sampling Rate and Interval" and type the new sampling rate into the edit box.
  • Press OK.


Example: Create grand average and combinations of conditions

In this example, we will generate a grand average of the results of the Auditory Intensity Experiment. The experiment includes averages from five different stimulus intensities. We will create a grand average over each intensity, but also include means over the two lowest and the two highest intensities, and the difference between these two combinations.


A. File selection

  1. Start BESA Research and open files S1_av.fsg - S10_av.fsg in the Examples\ERP-Auditory-Intensity folder. The files contain the individual averaged data of the 10 subjects who participated in this study.
  2. Select ERP / Combine Conditions... The file list should display the two files, with feedback about the number of averages and conditions. 8 epochs are found. See the “Data averaging in the auditory intensity experiment” example for examples how to manipulate the file list.


Batch processing (32).gif


B. Define conditions


1. Click on the Condition List Tab. The initial window defines target conditions with the same name as the source conditions. To generate the grand average over these conditions we could proceed without further changes to the Run Scripts Tab. However, we want to modify the condition list and create a condition that contains the grand averaged difference between the High and Low conditions.


Batch processing (8).jpg


2. Click on the All column label. In the resulting window, rename condition All to Difference. Then press OK.


Batch processing (33).gif


3. The last column is now labeled Difference. Left-click twice onto the ‘+1’ entry that links this condition to the All input condition. This will remove the link and leave the field blank. To define the ‘Difference’ condition as the average of ‘High’ minus ‘Low’ over subjects, left-click once into the field linking input High with target Difference to generate an entry ‘+1’ in this field. Left-click twice into the field linking input Low with target Difference to generate an entry '-1’.


Batch processing (35).gif


4. Press Save Condition List and save the list to ERP-aud-ex1.clist. This condition combination can thus be loaded later using the Load Condition List button.


C. Run the script


  1. Click on the Run Script Tab.
  2. The default tab settings are ready for generating the grand average (Combine data from source file and Open target file in BESA should be checked). Just press OK. Enter All_Subjects_cc-test.fsg as file name and press Save.


The resulting file contains the 8 target conditions, 60db, 70dB, 80dB, 90dB, 100dB, Low, High, and Difference.


Example: Average files from different experiments

This example is intended to illustrate several features of the Combine Conditions Dialog, such as electrode interpolation and resampling. We will combine an average from the Auditory Intensity experiment with one from the P300 auditory experiment. In this particular case, it is not a very meaningful thing to do, but it shows what is possible. For instance, the same experiment may have been performed using different sampling rates or electrode combinations. This example shows how such data may be combined.


A. File selection

  1. Start BESA Research and open the file All_Subjects_GA.fsg in the Examples\ERP-Auditory-Intensity folder. The file contains the grand average data from the auditory intensity experiment.
  2. Open the file RareFrequentResponseLeft.fsg in the Examples\ERP-P300-Auditory folder. This file contains averages from the P300 auditory experiment.
  3. Select ERP / Combine Conditions... Note that the files have different sampling rates and different numbers of electrodes.

Batch processing (36).gif


B. Define conditions

1. Click on the Condition List Tab. Note that the feedback text at the bottom of the window displays the text "Standard 81 interpolation required to generate average; Across files: resampling or change in time range required to generate average". The condition labels show all the names from both files.

Batch processing (37).gif


2. We will exclude most conditions, and just combine the most similar conditions from the two experiments: the "Standard" and the "80dB" conditions. Click on the title of the first column, Blink. Select “Delete all conditions to the right of this column”, and press OK.

Batch processing (38).gif


3. Click on the title again, and rename the target condition to "Standard".

Batch processing (39).gif


4. Click twice in the first line to remove the "+1" entry there. Click once in the third row ("Frequent"), and in the 7th row ("80dB"), to display "+1" at each entry. Thus, just two of the conditions will be combined into one target condition.

Batch processing (40).gif


C. Run the script

1. Click on the Run Script Tab.

Batch processing (41).gif


2. Note that Interpolate to Standard 81 electrodes is checked and grayed: since two different electrode sets are to be combined, we can only do this by interpolating electrodes. Also, both Spline to new sampling rate and Clip interval are checked and grayed. Again, these settings are required in order to be able to average the two data files together. The sampling rate is set to the higher of the two selections. The time range is set to the largest possible range that can be clipped from the two data sets. For now, leave these settings as they are, and press OK. Save the target to TestCombineExpts_CC-std81.fsg.