-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exporting EDF with 1024 Hz sampling rate throws an error #49
Comments
The error message is
|
I think this is because there's a bit of a mis-match between what happens here: https://github.com/beacon-biosignals/OndaEDF.jl/blob/master/src/export_edf.jl#L31-L53 and what the spec says:
Specifically, we're trying to create one-sample records, with a duration of 1/1024 seconds. Instead, we may need to try to create longer records with more samples, maybe starting with a 1s record and only using fractional record sizes when the record size is too big. |
Okay, we already ARE doing this check: trying the least-common-multiple of the denominator of the sampling rates of the Samples that get passed in (which is gonna be 1 if they're all integer Hz values), and uses that as the seconds-per-record. then, it computes the byte size of records given that, and if it's too big, it tries something else. If there's a single Samples (with potentially multiple channels), it uses one sample per record; if there are multiple Samples, it uses the greatest common divisor of the numerators of the sample rates to find the smallest record that can still hold an integer number of samples from each Samples; note that these are equivalent in the case where the sample rates are all the same. We could try an alternative approach that involves finding the prime factors of the numerator instead (or prime factors of the GCD), figure out how much we have to reduce the record size by, and do a greedy thing to find a small integer scale that gets us below the record size constraint... |
Ask me on Slack for a private test case!
The text was updated successfully, but these errors were encountered: