General notes on timing
ANSLAB has a very simple way to allow processing of selected
intervals of measured data: when a data file is read, ANSLAB looks
for an m-file with the same name as the data file, in the folder
where the data file is stored. If this m-file exists, it is read
and timing is based on the T-variable defined in the m-file.
For instance, if for a data file
F:\tex\raw\tex00101.acq
an m-file
F:\tex\raw\tex00101.m
exists and it contains the following text:
T = [...
2 0 1800 1800;...
1 1800 1903.519 103.519;...
3 NaN NaN NaN;...
8 2130 2475.2 345.2 ];
ANSLAB will recognize 4 valid segment definitions. The first
segment belongs to condition '2' and begins at 0 seconds after
file start and ends at 1800 seconds after file start, thus has a
length of 1800 seconds.
The second interval (of condition '1') starts at 1800 and ends at 1903.519 seconds
after file begins, spanning 103.519 seconds.
The third line is a segment that cannot be loaded, as begin and end time and duration are not valid timing
values, but will be filled with missing data when used for statistical exports, icg, spectral
or crossspectral analysis.
The fourth line again is a valid segment of condition 8.
You can create such timing files manually, or use the 'marker'-analysis type to generate timing files automatically
(see
marker).
Moreover, you can do this quickly for a list of files using the
batch mode
of ANSLAB.
While a normal timing file has the extension '.m', in case of some analyses special timing files are needed (if using timing fields
is not enabled; see below). That is, in case of the (cross-)spectral, ICG, and coherence analysis the file extensions to be
used are '.spectral.m', '.icg.m', and '.coherence.m', respectively.
[
Top]
Timing fields
As of version 2.6, ANSLAB supports multiple timing 'fields' in a single file. For instance, the above file
could also look like this:
T = [...
2 0 1800 1800;...
1 1800 1903.519 103.519;...
3 NaN NaN NaN;...
8 2130 2475.2 345.2 ];
T.spectral = [...
2 0 600 600;...
1 600 1200 600;...
3 1200 1800 600;...
8 1800 2400 600 ];
thus containing an additional timing field 'spectral'.
Having multiple timing fields in a single file saves you the hassle of
managing and copying back and forth different versions of timing
files that you need for different type of tasks, such as value
export, spectral analysis, icg analysis, reflexive startle
analysis or trial extraction.
However, it is important to point out that this is an optional
feature, which, by default is disabled for all analysis types.
[
Top]
Modifying timing files
Because timing files are so important for so many tasks in ANSLAB, there are two powerful tools to modify
and adjust these timing files to your specific needs:
timing file modification
and
timing file recoding.
These are rule based replacement tools for changing the condition values and the time values of
segments in a timing field. You can also collapse multiple segments to single segments or split a single
segment into several parts.
Timing file modification
Use this command to modify existing timing files by specifiying a modification term for each line (interval) or each
condition (trigger value) in the timing files. This tool can help you create smaller subsegments, collapse segments or
modify segments by adding constant offsets.
To start the modifcation process, first load a filematrix containing the paths of the timing files you wish to modify.
Then select the
timing file modification item from the tools menu. You are prompted to select a definition
file, that specifies how each line or condition is to be changed. Allowed commands in the definition file are
subdivide n; |
|
X |
Subdivide the segment into n equally sized parts. |
subdivfixed n m; |
|
X |
Subdivide a segment into m parts of n seconds (filling overlap segments with NaN's). |
collapse start; |
X |
X |
Define a starting segment for collapsing two or more successive segments into one larger segment. Nested collapsing is not allowed.
That is, a collapse start command must have an according collapse end command before
the next collapse start command
|
collapse; |
X |
X |
Collapse the current segment into a larger one (must be located after a collapse start command). |
collapse end; |
X |
|
Define the last segment to be included into collapsing (must be located after by a collapse start command). |
leave; |
X |
X |
Leave the current segment unchanged. |
drop; |
X |
X |
Remove current segment. |
offset; |
|
|
Postpone segment to start at its original offset (the length of the segment remains the same). |
setlength n; |
|
|
Set the segment to a length of n seconds, starting at the original onset. |
add [n, m]; |
|
|
Add n seconds to the beginning and m seconds to the end of the current segment. Negative values
for the parameters are also allowed, resulting in a shift back in time for the start or end of a segment. |
fromonset [n, m]; |
|
|
Changes the current segment to start n seconds after the original onset and end m seconds after the original onset.
Negative values for parameter n are also allowed, resulting in a shift back in time for the start of the new segment. |
fromoffset [n, m]; |
|
|
Changes the current segment to start n seconds after the original offset and end m seconds after the original offset.
Negative values for parameter n are also allowed, resulting in a shift back in time for the start of the new segment
(this command is a shortcut for the command sequence 'offset; fromonset [n, m];'). |
addbaseline n m; |
|
|
Allows to add a baseline segment starting n seconds before the original onset. Since a new segment
is inserted before the original segment, the original segment is not modified. The parameter m is optional
and allows to specify a new marker for the newly inserted baseline segment. If not specified,
the baseline segment will be created with the original condition number. If a simple number is specified
(i.e. 100) the condition of the new baseline segment will be set to that number. If a sign (either + or -) is specified
before the number (i.e. +100) the value of m will be added/subtracted from the original condition number
to get the condition number for the baseline segment. It is important that the sign is immediately followed
by the number (i.e. spaces are not allowed between the sign and the number). |
In general, multiple commands are allowed on a line of a modification file and are processed one after another. But there are some
exceptions which can be seen in the columns
First and
Last. If the column
First/
Last contains
a 'X' for a certain command this means that the command must always be used as the first/last command on a line.
Commands where both columns contain a 'X' are not allowed to be combined with other commands (i.e. these commands
must be the only commands on a line).
Important: the first line of a timing file modification file is always ignored as it is reserved for comments
(for better readability the first line should start with a '%').
A sample definition file for line based modification could look like this:
%sample modification definition file
collapse start;
collapse;
collapse end; add [-1,+1];
drop;
subdivide 3;
leave;
subdivide 2;
subdivfixed 1.5 20;
setlength 3.333;
fromonset [-2, 8];
offset;
This timing file modification file will cause ANSLAB to collapse segments in line 1, 2 and 3, enlarging the resulting segment by adding
-1 second to the begin and +1 second to the end, leave out segment 4, subdivide line 5 into three equally
sized parts, leave the segment in line 6 unchanged, and subdivide the line 7 in two equally
sized parts. Line 8 will be subdivided in 20 parts of 1.5 seconds (filling overlap segments with NaN's).
Line 9 will be set to a length of 3.333 seconds from the given onset, line 10 will be changed to start 2
seconds before the original onset to 8 seconds after the original onset. Line 11 is postponed to start with it's original offset.
By applying the timing file modification from the example above to the timing file
T = [...
1 0 10.6539 10.6539;...
2 10.6539 21.3077 10.6539;...
3 21.3077 31.9616 10.6539;...
4 31.9616 42.6154 10.6539;...
5 42.6154 53.2693 10.6539;...
6 53.2693 63.9231 10.6539;...
7 63.9231 74.577 10.6539;...
8 74.577 84.577 10;...
9 84.577 94.577 10;...
10 94.577 104.577 10;...
11 94.577 99.577 5];
the timing file will be changed to
T = [...
1 -1 32.9616 33.9616;...
2 42.6154 46.1667 3.5513;...
3 46.1667 49.718 3.5513;...
4 49.718 53.2693 3.5513;...
5 53.2693 63.9231 10.6539;...
6 63.9231 69.2501 5.327;...
7 69.2501 74.577 5.327;...
8 74.57 76.07 1.5;...
8 75.57 77.07 1.5;...
8 76.57 78.07 1.5;...
8 77.57 79.07 1.5;...
8 78.57 80.07 1.5;...
8 79.57 81.07 1.5;...
8 80.57 82.07 1.5;...
8 81.57 83.07 1.5;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
8 NaN NaN NaN;...
9 84.577 87.910 3.333;...
10 92.577 102.577 10;...
11 99.577 104.577 5];
As already indicated above, the timing file modification works based on conditions
too. If for example, a file contains a few different conditions only but hundreds
of lines and each condition should be modified the same way, it would be cumbersome and
error prone to create a timing file modification file containing as many lines as the input timing files.
Therefore ANSLAB also allows to use condition-based timing file modificaton. The only difference
to a line-based timing file modification file, as discussed above, is that in this case
the first column in a timing file modification file must contain condition numbers.
The commands specified next to the condition numbers are then applied to each
row in the input timing files with the same condition number.
A sample definition file for a condition-based timing file modification could look like this:
%sample modification definition file
1 drop;
3 subdivide 3;
2 leave;
4 subdivide 2;
5 subdivfixed 1.5 20;
7 setlength 3.333;
8 fromonset [-2, 8];
6 offset;
Important: when using condition-based modification, ensure that the definition file
contains a modification rule for each condition the modification will encounter across all timing files to be modified.
For conditions which should not get modified use the
leave; command.
Timing file recoding
Use this command to modify the condition numbers in existing timing files by specifiying a replacement list. Every condition number in
every file is then replaced according to the replacement list. To start the modifcation process, first load a filematrix containing the
paths of the timing files you wish to modify. Then select the
timing file recoding item from the tools menu. You are then prompted to select a text file, that
specifies how the replacements are to be made.
This file must be a two column tab-delimited text file, the first column containing the original condition number and the second column the value which will
replace the original. A sample definition file can be found in the 'anslabutil'-folder in the ' timing'-subfolder, and it's content is shown here:
1 1
2 1
3 2
4 2
5 3
5 3
Using this example timing file recoding file, an original timing file
T = [...
1 0 10.6539 10.6539;...
2 10.6539 21.3077 10.6539;...
3 21.3077 31.9616 10.6539;...
4 31.9616 42.6154 10.6539;...
5 42.6154 53.2693 10.6539;...
6 53.2693 63.9231 10.6539;...
7 63.9231 74.577 10.6539];
is changed to
T = [...
1 0 10.6539 10.6539;...
1 10.6539 21.3077 10.6539;...
2 21.3077 31.9616 10.6539;...
2 31.9616 42.6154 10.6539;...
3 42.6154 53.2693 10.6539;...
3 53.2693 63.9231 10.6539;...
7 63.9231 74.577 10.6539];
[
Top]
Analyzing event-related designs
To analyze event-related designs with ANSLAB, you should first of all process
all your data files as if you were interested in overall mean values, that is to say, edit artifacts and extract event traces
over the entire file. If you have only a small amount of relevant data segments and have marked segments of interest with a
dedicated marker channel, you can reduce the work by loading this marker channel as 'optional channel' and editing only segments
that you jump to by using the 'find peak'-function from the navigation section.
Once you have processed all the files of interest, you must create timing files for every data file as described above
(see
marker for a detailed description). This can be automatized using the batchmode of
ANSLAB, activating the 'marker'-option in the dynamic 'batch'-module of ANSLAB menu window.
Later in the process ANSLAB will take every segment listed in the timing files and extract a given number of seconds before and after the
start of the segment. The ending time is ignored in this case, to avoid signal length differences due to timing rounding errors in
the extracted trials. Thus, you can select a subset of segments to include in the extraction, by changing the timing file. Moreover, the first
column of the T-variable can be used to determine the naming of the averaged segments later on.
You can automatically modifiy a set of timing files using the
timing file modification tool and the
timing file recoding
tool described above.
Once you have prepared all this, use the
extract trials-item
from the event-menu, to extract data segments, corresponding to the trials in your experiment.
[
Top]