-
Notifications
You must be signed in to change notification settings - Fork 16
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
NsxFile() incorrectly loads data when indexing for less than a full file #6
Comments
Hi @tlancaster-blackrock , is there an update for when this issue might be patched? Just spent a day tracking down this issue to report it before checking Github to find it's already been posted Thanks for the help! |
Hey @cboulay, I just gave it a test and found some differences between the latest commit on the from Python-Utilities import brpylib
fpath = 'test.ns5'
nsx = brpylib.NsxFile(fpath)
all_data = nsx.getdata()
ch1_data = nsx.getdata(elec_ids=[1]) Notable differences:
It's possible I am missing some updated instruction for how to use these functions, so please let me know if I am misusing them. I hope the feedback helps! |
Very helpful, thanks! I think I can fix 1 and 3 easily. However, I might need a different test file for the other 2. |
I am having similar issues. In #22, the results from querying individual channels simply gives me the entire array instead. In the latest commit of
Sorry for being a pest about this issue if it's something that's already quite acutely on your radar! |
Issue originally raised by Lukas Kunz:
It seems to me that this function reads the data with flipped dimensions. Hence, the output is not channels x time, but rather time x channels. This is not really problematic when reading all channels at once, because one can then simply transpose the data array to obtain the correct dimensions. However, when reading only one channel (e.g., nsxFileContent = nsxFileObj.getdata(1, 0)), then incorrect data is returned because getdata() internally seems to index the data as if they had the correct dimensions (channels x time), although they do not, as described above (time x channels).
microFile = glob.glob(sessions[iSess] + '\Micro*.ns5')
nsxFileObj = NsxFile(microFile[0])
nsxFileContent = nsxFileObj.getdata('all', 0)
nsxFileObj.close()
microData = nsxFileContent['data'][0].T
The python utilities only load the correct data when loading the entire file at once (which can be a problem when the ns5 file is very large).
Loading only a subset of channels (1, 2, ..., n-1) will lead to incorrect data based on internal incorrect indexing (the data for channel i will represent a mixture of data from various channels and various time points). This cannot be corrected by the user post-hoc.
The text was updated successfully, but these errors were encountered: