-
Notifications
You must be signed in to change notification settings - Fork 248
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
IntanIO problem with one file per stream format #1556
Comments
That looks like a scaling error. I'll look into this later today. Which version one file-per channel or one file per stream? What script did you run? I want to make sure the scaling happened correctly so I need to see what code you specifically ran to get this :) |
The simulated data were generated using Intan version 3.3.1. Here is the code: import os
from neo import io
import matplotlib.pyplot as plt
# Load rhd file
data_rhd = io.IntanIO(r'F:\MATLAB\RHD_test\RHD_test.rhd')
raw_chunk_rhd = data_rhd.get_analogsignal_chunk(block_index=0,
stream_index=0,
seg_index=0)
rhd = data_rhd.rescale_signal_raw_to_float(raw_chunk_rhd, stream_index=0)
plt.plot(rhd[:,3])
#Load dat file
data_dat = io.IntanIO(r'F:\MATLAB\DAT_test\info.rhd')
raw_chunk_dat = data_dat.get_analogsignal_chunk(block_index=0,
stream_index=0,
seg_index=0)
dat= data_dat.rescale_signal_raw_to_float(raw_chunk_dat, stream_index=0)
plt.plot(dat[:,3])
#Load from numpy
def load_dat(filename, num_channels):
fileinfo = os.stat(filename)
num_samples = fileinfo.st_size // (num_channels * 2)
with open(filename, 'rb') as f:
v = np.fromfile(f, dtype=np.int16, count=num_channels * num_samples)
v = v.reshape((num_samples, num_channels)).T
v = v * 0.195
return v
data_wiht_numpy = load_dat(r'F:\MATLAB\DAT_test\amplifier.dat', 64)
plt.plot(data_wiht_numpy[3]) The scale is correct but not the wavefoms with .dat files. |
Linked a PR that should fix it! |
Great! |
Which page is the problem on?
IntanIO
What is the problem?
IntanIO reads problematic. The function works well with rhd files but is problematic with dat files. Here are the pictures of the result.
When reading .dat file from numpy directly(Fig 1), everything goes well. But the IntanIO seems wrongly loaded data. I doubt whether the data type is causing this problem. [.rhd, uint16; .dat, int16].
Suggestions for fixing the problem
Could you please provide more information about reading .dat files?
The text was updated successfully, but these errors were encountered: