I have an edf file which has 30 EEG channels and sampling frequency of 250 Hz. The total signal duration is 1216.996 seconds, so when I read the eeg signal I expect to get 250 * 1216.996 = 304249 samples, but I get 304250 samples, how mne library interprets this and what should I do to get the exact number of samples.
there is most likely a rounding error happening. Your data is “digitized”, and as such, a measure in a continuous format (time in seconds) is not very meaningful. In fact, wherever you have the “total signal duration” data from → this is most likely being calculated through the number of samples in the data and the sampling frequency of the data.
You would have to make the signal exactly 1 sample longer. If you need to work with the file you have, then you cannot change the behavior. Why is this integer duration important for you?
I need to have exactly 15000 samples to fed to my neural network, some of the edf files have sampling frequency of 512 Hz and when I resample them and crop the signal to have just the 60 seconds I got exactly 15000 samples, but when the sampling frequency is 250 Hz, then I got for 60 second lasting signal 15001 sample and I want to get rid of that to not check manually if the sampling frequency is 512 Hz do not remove the last sample