Skip to content

Commit 46fa1fc

Browse files
committed
Fix underlying2scaled formula: (data - offset) * scale
MATLAB's underlying2scaled does (d - offset) * scale, not d * scale + offset. With offset=32768 and scale=0.195, this converts raw Intan ADC values to microvolts correctly. https://claude.ai/code/session_01A7rAxYf5pSvs19iVJe3ncL
1 parent d70a268 commit 46fa1fc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ndi/daq/mfdaq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,8 @@ def readchannels_epochsamples_ingested(
766766
if count < data.shape[0]:
767767
data = data[:count, :]
768768

769-
# Apply offset and scale
770-
data = data * np.array(scale) + np.array(offset)
769+
# Apply offset and scale: underlying2scaled formula is (data - offset) * scale
770+
data = (data - np.array(offset)) * np.array(scale)
771771

772772
return data
773773

0 commit comments

Comments
 (0)