Closed guigautier closed 9 months ago
When working with time domain data one often thinks of data in terms of a sample frequency, i.e. how many samples are saved per second, i.e. smp/sec
. However, in the EDF format, not only the nominator (smp
) but also the denominator (sec
) can be set and determines how many samples are saved per block (also called 'record'). So if your signal has a sampling frequency of 50 Hz you could save 50 samples per block and set the DataRecordDuration
to 1 second. Alternatively, you could also save 100 samples per block and set the DataRecordDuration
to 2 seconds, as 100/2 is also 50 Hz. In the end this just determines how much data is saved per block within the file and allows for sample frequencies below 1 Hz, i.e. by setting the DataRecordDuration to 0.5 while saving one sample per block.
You can manually set the DataRecordDuration
by calling f.setDatarecordDuration(100000)
where f
is an isntance of EdfWriter
. Note that the value for the function needes to be in units of 10 microseconds, ie. 1 second = 100000
Please note that DataRecordDuration
and FileDuration
are two different things, the former noting how long a block of data is in the time dimension and the latter denotes how long the entire file is in the time dimension.
Hope that clarifies that a bit?
The current release unfortunately contains some mistake w.r.t this, however in most cases it should still work fine. Maybe in your case it would be best to work with the development branch.
Hi there,
I'm using PyEDFlib to read and write some EDF files, and I'm a bit confused about the
DataRecordDuration
. Specifically, when I call thewriteSamples()
method, by default the EDF file is write with a block duration of 1sec of time intervals.Could someone please clarify what the duration argument of the EDF header actually represents? Is there any way to use
pyedflib
to write EDF files with durations that are not a multiple of a second? I tried looking through the documentation and source code but didn't find anything that could help me.How can I force the number of
NSamples
?For example:
Thanks in advance for your help!