Contradicting input description in Readme
thbender opened this issue · 2 comments
Hi,
when trying to use your model on another dataset, I got confused with this sentence in the main Readme (and Zenodo descriptions of both test data and model):
"All signal are represented as 32 bits floating point numbers at the scale 1e-4V: so if the signal is in V it should be multiplied by 1000 before feeding it to the neural network model."
Did you mean 1e-3V? 1e-4 would be a factor of 10,000, but 1000 seemed to work on my data.
Looking at this issue, and the similar closed issues, the clear answer would be to say exactly how these 32-bit floating point numbers relate to the actual signal at the electrode.
"typical" 12-lead ecg signal is maybe two or three milliVolts peak to peak at the electrode, if these floats are the amplitude at the electrode in units of milliVolts (or Volts or microVolts) then we are done when these units are clearly stated.
But what is in a CSV or XML file is vendor specific, if you are "lucky" you get decimal numbers as strings in units of Volts, millVolts or microVolts and scaling is trivial.
What you often get is "A/D counts" that is an integer string. To turn this into the actual amplitude at the electrode you need to know the A/D converter full scale peak-to-peak range, and the number of bits in the conversion. Again this is vendor specific.
Assuming your system used a "modern" twos complement converter and not an "obsolete" offset binary or sign-magnitude technology, you calculate the signal amplitude at the electrode as follows
mV_at electrode = AtoD_counts * peak_to_peak_input range_in _mV / 2e+Nbits
for a 16-bit converter with a +/- 10 mV input range at the electrode:
signal_in_mV = AtoD_counts * 20 / 65536
20mV / 65536 = 0.000305 mV per A/D count, this is the scale_factor
signal_value = A_to_D_counts * scale factor
Hope this clarifies things a bit.
My issue is we are trying to convert the floating point numbers in the hdf5 database to run through our system for comparison and the peak-to-peak ecg amplitudes are looking about 2X too large if I simply assume the 32-bit floats are in units of mV, we are trying to understand why and how to correct it.
The preprocessing is also specified here: https://github.com/antonior92/ecg-preprocessing