EDF File Format provider
OverviewReads files with file header EDF FILEversion 1992 and writes EDF files (ver. 1992) in 16 bit resolution.
SettingsThis stream interface offers settings that specify how the interface should work. Those settings are available in the properties dialog as well as in variable parameters.
Default value: 1(-100/100);2(-100/100);3(-1000/1000);
Defines the physical minimum and maximum in units of the physical dimension. Format: n(x/y);n+1(x/y); where n = channel number (starts with 1), and x/y means x = min and y = max. Some known channel names (e.g. EOG) may lead to a special automatic default range, to get the default min/max for that channel name (see manual). You may write ALL(x/y) to specify all channels to have a range; and RANGE[a/b](x/y), to let channel a until b have the specified range.
Defines the transducer type of the electrode. Format: n(T);n+1(T); where n = channel number (starts with 1), and T = transducer type text (e.g. AgAgCl electrode). Use ALL(T) to set the same text for all channels. Use RANGE[a/b](T) to set the text for channel a until b.
Defines the prefiltering of each channel. Format: n(P);n+1(P); where n = channel number (starts with 1), and P = prefiltering text (e.g. HP:0.1Hz LP:75Hz). Use ALL(P) to set the same text for all channels. Use RANGE[a/b](P) to set the text for channel a until b.
DescriptionIf you want to record using this well known file format, then you have to consider this:
The format stores sample values in only 16 bit width. Polybench works with 64-bit values. In order to get the Polybench samples into the EDF file, the values are scaled so that they fit in the EDF format, as is described by Bob Kemp et al. in their EDF file format specification. As a result, the samples that you read from an EDF file may have a small deviation from the original values, because the resolution of the values have become smaller.
You have to specify yourself how the signals need to be scaled, because an optimal scaling depends on the range in which your signal is moving. You can specify this in the Storage operator (link) properties, after you have selected the EDF file format. The signal range has to be specified for every channel (or you may define all channels having an equal range).
Note that if you take the range too large, that you get a very bad resolution of your signal (your signal may even dissolve and look like a zero-signal afterwards). If you take the range too small, then signals that exceed the range are cut off! So, if you specify the physical range 1(-1000/1000); and your signal on channel 1 get higher than 1000, then in the file the signal will be cut off to the value of 1000.
EDF does not store annotations. If you require other software to read any event markers (called annotations in EDF), then you need to use EDF+. However, in Polybench the EDF files may still have event markers. Those event markers are stored in a separate CSV file and can be edited afterwards.
Full specification of EDFThe original article about this file format was published by Elsevier and provides some background information and examples:
Bob Kemp, Alpo Vaerri, Agostinho C. Rosa, Kim D. Nielsen and John Gade "A simple format for exchange of digitized polygraphic recordings" - Electroencephalography and Clinical Neurophysiology, 82 (1992): 391-393.
One data file contains one uninterrupted digitized polygraphic recording. A data file consists of a header record followed by data records. The variable-length header record identifies the patient and specifies the technical characteristics of the recorded signals. The data records contain consecutive fixed-duration epochs of the polygraphic recording.
The first 256 bytes of the header record specify the version number of this format, local patient and recording identification, time information about the recording, the number of data records and finally the number of signals (ns) in each data record. Then for each signal another 256 bytes follow in the header record, each specifying the type of signal (e.g. EEG, body temperature, etc.), amplitude calibration and the number of samples in each data record (from which the sampling frequency can be derived since the duration of a data record is also known). In this way, the format allows for different gains and sampling frequencies for each signal. The header record contains 256 + (ns * 256) bytes. Figure 1 shows its detailed format.
The information in the ASCII strings must be left-justified and filled out with spaces. Midnight time is 00:00:00. The duration of each data record is recommended to be a whole number of seconds and its size (number of bytes) is recommended not to exceed 61440. Only if a 1s data record exceeds this size limit, the duration is recommended to be smaller than 1s (e.g. 0.01).
The digital minimum and maximum of each signal should specify the extreme values that can occur in the data records. These often are the extreme output values of the A/D converter. The physical (usually also physiological) minimum and maximum of this signal should correspond to these digital extremes and be expressed in the also specified physical dimension of the signal. These 4 extreme values specify offset and amplification of the signal.
Following the header record, each of the subsequent data records contains 'duration' seconds of 'ns' signals, with each signal being represented by the specified (in the header) number of samples. In order to reduce data size and adapt to commonly used software for acquisition, processing and graphical display of polygraphic signals, each sample value is represented as a 2-byte integer in 2's complement format. Figure 1 shows the detailed format of each data record.
Gains, electrode montages and filters should remain fixed during the recording. Of course, these may all be digitally modified during replay of the digitized recording.
Below is the detailed digital format of the header record (upper block, ascii's only) and of each subsequent data record (lower block, integers only). Note that each one of the ns signals is characterized separately in the header.
8 ascii : version of this data format (0)
80 ascii : local patient identification
(mind item 3 of the additional EDF+ specs)
80 ascii : local recording identification
(mind item 4 of the additional EDF+ specs)
8 ascii : startdate of recording (dd.mm.yy)
(mind item 2 of the additional EDF+ specs)
8 ascii : starttime of recording (hh.mm.ss)
8 ascii : number of bytes in header record
44 ascii : reserved
8 ascii : number of data records (-1 if unknown,
obey item 10 of the additional EDF+ specs)
8 ascii : duration of a data record, in seconds
4 ascii : number of signals (ns) in data record
ns * 16 ascii : ns * label (e.g. EEG Fpz-Cz or Body temp)
(mind item 9 of the additional EDF+ specs)
ns * 80 ascii : ns * transducer type (e.g. AgAgCl electrode)
ns * 8 ascii : ns * physical dimension (e.g. uV or degreeC)
ns * 8 ascii : ns * physical minimum (e.g. -500 or 34)
ns * 8 ascii : ns * physical maximum (e.g. 500 or 40)
ns * 8 ascii : ns * digital minimum (e.g. -2048)
ns * 8 ascii : ns * digital maximum (e.g. 2047)
ns * 80 ascii : ns * prefiltering (e.g. HP:0.1Hz LP:75Hz)
ns * 8 ascii : ns * nr of samples in each data record
ns * 32 ascii : ns * reserved
nr of samples * integer : first signal in the data record
nr of samples * integer : second signal
nr of samples[ns] * integer : last signal
Typical settings of the physical limits of the signals
Application min. value max. value
BIP -100 uV 100 uV
DIG 0 32
EAG -100 uV 100 uV
ECG -100 uV 100 uV
EEG 50 uV -50 uV
EGG -100 uV 100 uV
EMG -100 uV 100 uV
EOG -125 uV 125 uV
ExG -100 uV 100 uV
FLOW -180 l/min 180 l/min
FiO2 21 % 100 %
Hypnogram -0.9 6.9
Pulse 30 BPM 250 BPM
SaO2 75 % 100 %
Saw -64 64
SpO2 90 % 100 %
Defaults range settings are min. = -1000 and max. = 1000, if the signal is not as called above.