Once you have installed edfAsc, you start the program in the usual way (calling the program from the text interface or clicking the icon). We are going to use the file Calib.rec. This file is also available at edf site.
. To get it follow the link located at the text ..here are two small EDF calibration recordings.. . You have to download and unzip the file edfcalib.zip
First of all we can glance the header of the file using edfEdit. This is the header
The screen of edfEdit is shown in figure 3.1
A lot of things can be learned from the header of an EDF file. Looking at the
header we know that it includes one signal with two data records. Each data
record lasts 10 seconds and includes 1000 samples. So it is sampled at 100
Hz. The signal is expressed in
V. We can also see a lot of information
about how the file was obtained.
Now we want to convert the signal to an ASCII file. These are the steps in edfAsc
That's all. A file called Calib.rec.txt was created. Let's see the first ten lines of the file
The first column is the time in seconds. In this case the sampling period is
0.01 s (the signal was sampled at 100 Hz). The second column contains the
signal in the units detailed in the header. We are going to plot the signal
using Scilab. You can find more
information on the use of Scilab in Clinical Neurophysiology in our site
The result is shown in figure 3.2
An ASCII file can be a somewhat inefficient structure. Notice that the ASCII
file is ten times bigger than the EDF file.
It is not only a matter of space. Reading an ASCII file is a very slow
process. Because of this reason,
edfAsc
can also export float values. The resulting file can be read very fast by a lot of programs. On the
next chapter we will face this issue some examples of how to import
this kind of files in practice.
je@unit1:~/tmp/tutorial> cat Calib.rec.txt | head -n 10
0.000000e+00 -5.000000e+01
1.000000e-02 -5.000000e+01
2.000000e-02 -5.000000e+01
3.000000e-02 -5.000000e+01
4.000000e-02 -5.000000e+01
5.000000e-02 -5.000000e+01
6.000000e-02 -5.000000e+01
7.000000e-02 -5.000000e+01
8.000000e-02 -5.000000e+01
9.000000e-02 -5.000000e+01
-->signal = fscanfMat("Calib.rec.txt");
-->plot2d(signal(:,1),signal(:,2))
je@unit1:~/tmp/tutorial> ls -l Calib.*
-rw-r--r-- 1 je users 4512 2002-10-04 14:47 Calib.rec
-rw-r--r-- 1 je users 52990 2004-10-05 19:58 Calib.rec.txt
Now we are going to use the file Calib.rec.txt to create an EDF file called NewCalib.edf. Notice that since the original file contains two columns (time and values) the EDF file will have two signals. These are the steps needed to do it.
We can see the result with RASCHlab The screen of RASCHlab is shown in figure 3.3
Notice that units are not set by the program. The names of the signals as well as other parameters of the header should be modified using edfEdit.
Also notice that time is included as a line. We should prepare the text file to include/eliminate the signals that we want to include in the EDF file. A simple way to do it is by using awk.
Using grep, awk, sed, head and tail you can
easily modify a text file. These applications are also available on Windows OS
je@unit1:~/tmp/tutorial> cat Calib.rec.txt | head -n 4
0.000000e+00 -5.000000e+01
1.000000e-02 -5.000000e+01
2.000000e-02 -5.000000e+01
3.000000e-02 -5.000000e+01
je@unit1:~/tmp/tutorial> cat Calib.rec.txt | awk '{print $2}' | head -n 4
-5.000000e+01
-5.000000e+01
-5.000000e+01
-5.000000e+01
je@unit1:~/tmp/tutorial> cat Calib.rec.txt | awk '{print $2}' > one_channel.txt
je@unit1:~/tmp/tutorial>