-
Notifications
You must be signed in to change notification settings - Fork 126
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
sample_rate vs sample_frequency: how to continue? #247
Comments
I agree with you, and since |
I prefer |
Any more opinions? @DimitriPapadopoulos @holgern @LucaCerina @cfranklin11 |
BTW I'm also fine with A as long as there's only one term (eventually after a deprecation cycle). |
I would go with A. |
A. Does not make sense to talk about samples / record for end users |
I've changed jobs since submitting my PR, so don't work with EDFs anymore. I'll defer to those who still work with them on a day-to-day basis. Just to offer some context, the changes introduced in PR #121, were due to the fact that where I worked we had a lot of EDFs whose sample frequency wasn't per second, which led to incorrect calculations when working with |
Out of curiosity, what unit for the sampling frequency did you use? |
It's been a few years, so my memory is a little fuzzy on the details, but it did vary from study to study. Most of the studies had the usual 1 sample per second, but a sizeable minority didn't. The non-standard frequencies weren't always whole numbers, but I think they were generally between 1 and 2 per second (inclusive). |
But in this case they were still all per second (i.e., Hz), which is the standard unit of frequency. It is perfectly fine (and very common) that the sampling frequency is not an integer. What I don't understand is if there are cases where the sampling frequency is not in units of Hz (1 / s), as @skjerns writes in the first comment. Even In summary, I can only echo what has already been stated by several people, end users do not care about how things are implemented internally, they want to be able to specify a sampling frequency (which is also referred to as sampling rate). In my opinion, consistency with edflib is not important. FWIW, edfio also uses |
There is confusions about the two terms and how they are implemented in
pyedflib
and alsoedflib
. I'd like you'r opinion on how to continue. @DimitriPapadopoulos @cbrnr @holgern @raphaelvallat @LucaCerina @cfranklin11EDF specs
In the specs the following is defined:
*
8 ascii : duration of a data record, in seconds
-> we call this internallyrecord_duration
*
ns * 8 ascii : ns * nr of samples in each data record (per channel)
-> we call this internallysmp_per_record
There is no
sample_frequency
orsample_rate
within the EDF specs. However, these can be derived by dividingsmp_per_record
byrecord_duration
.edflib
edflib, introduces
samplefrequency
(equal tosmp_per_record/record_duration
, not always Hz) andsamplerate
(Hz), which is not actually implemented to set, just mentioned in the docstrings. There's an inconsistency asHz
is defined ascycle per second
, but this isn't always reflected inedflib
:pyedflib
In
pyedflib
,sample_rate
was initially likeedflib
'ssamplefrequency
. Later,sample_frequency
was introduced to represent Hz, simplifying the user experience. The definition ofsample_frequency
in Hz is also how it is done in `python-edf.Solutions
In principle I think nobody cares about the
record_duration
or how things are implemented internally. People want to set and retrieve a sampling rate in Hz and be done. You should not have to think about therecord_duration
unless you have good reason to. Imo the decision to be made is which of the two terms to keep.Options:
A) Keep both terms, eventually removing
sample_rate
. This is user-friendly but inconsistent withedflib
.B) Revert to
sample_rate
only, aligning withedflib
but disrupting recent changes. Treatsample_rate
as Hz.C) Align with
edflib
: usesample_frequency
forsmp_per_record
andsample_rate
for Hz, which could confuse users.Personally I think A&B seem to be the best options, with A the least disrupting. If the unfortunate introduction of
sample_frequency
would not have been done, I would favour B, but that's too late now. What do you think?The text was updated successfully, but these errors were encountered: