the-siesta-group / edfio

Read and write EDF/EDF+ files.
Apache License 2.0
25 stars 5 forks source link

Add fallback for calculation of num_data_records to avoid floating point errors #3

Closed hofaflo closed 8 months ago

hofaflo commented 8 months ago

Currently, creating a new Edf with e.g. 8001 samples at 1000Hz and a data_record_duration of 0.001 fails, even though the signal duration of 8.001 would be divisible by 0.001. This PR introduces a fallback using decimal.Decimal to make the calculation of num_data_records more robust.