Skip to content

Analog signal data not read from TDT SEV #1129

Open

Description

@grahamfindlay

Hi, all. I have never used neo directly before, so I apologize if this is just user error. But I have read through docs and code, and I think what I'm seeing is unexpected behavior.

I have a TDT tank containing a single TDT block using SEV (rather than TEV) format. I can successfully create a TdtIO object, read the .Tbk and .tsq files, which seem to reflect the right streams, with the right names, and the right numbers of channels. But it seems as if these header files are not being parsed properly, because the AnalogSignal objects that I get have incorrect sampling rates (1.0 Hz, vs the actual ~610Hz), incorrect durations (0.0s vs several hours), and no actual data (e.g. anasig.shape is (0, 4) for a 4 channel signal). I notice that the TdtIO._sigs_lengths dict is {0: {0: 0, 1: 0}}, which it seems should reflect the size of the data. But there doesn't at first glance appear to be anything wrong with the '.Tbk' and '.tsq' parsing, so perhaps the issue lies somewhere in between.

Here's a demonstration: read_tdt_using_neo.pdf. The data are ~800MB. Let me know if you'd like a copy in order to reproduce the issue.

Thanks,
Graham

Activity

  1. changed the title [-]Issues reading analog signals from TDT SEV[/-] [+]Analog signal data not read from TDT SEV[/+] on Jun 15, 2022
  2. samuelgarcia commented on Jun 16, 2022

    @samuelgarcia
    Contributor

    Hhi Graham,
    I did this reader very long time ago.
    I don't remember any detail.
    @JuliaSprenger : have refactor a bit recently. Maybe she will be able to help.

  3. JuliaSprenger commented on Jun 16, 2022

    @JuliaSprenger
    Member

    Hi @grahamfindlay, thanks for reporting this. My first suspicion would be that the .sev files are not detected by the io, as they are containing an additional _EEGf identifier in the filename, that is not present for the other files. Could you try renaming some of your sev files to just FCSV_EEG-220215-173221_Paul-220607-102425_Ch{1..4}.sev?

  4. grahamfindlay commented on Jun 16, 2022

    @grahamfindlay
    Author

    Thanks, both. 4 of the .sev files have _EEGf identifiers, and 4 have _EEGr identifiers. If I were to delete these identifiers from both sets of files, then the two sets would have identical filenames (i.e. the filenames are identical apart from these identifiers), so I can't do that. What I did instead, was:

    1. Delete the _EEGf identifiers, and leave the _EEGr identifiers in place. This was unsuccessful (Sorry for the ugly pandoc/nbconvert formatting >.<)
      attempt1.pdf

    2. Delete the _EEGf identifiers, and delete the _EEGr files entirely. This was also unsuccessful.
      attempt2.pdf

    Perhaps it would be possible to use TDT's Python package to handle ingest of their data & headers/metadata, and massage this into the standardized neo format?

  5. JuliaSprenger commented on Jun 23, 2022

    @JuliaSprenger
    Member

    I will extend the TDTIO to include also the _EEGf and _EEGr type postfixes in the internal channel identifiers.

  6. added this to the milestone on Jun 23, 2022
  7. grahamfindlay commented on Jun 23, 2022

    @grahamfindlay
    Author

    The "EEGr" and "EEGf" identifiers correspond to stream names, and are set by the user. In my case they are abbreviations for "EEG raw" and "EEG filtered", but likely ever user has their own stream identifiers based on how they've configured their recording project. So it will be necessary to accept arbitrary identifiers.

    I have tried to reverse engineer TDT file formats before, and they can be quite complicated. There are really several different formats depending on recording software / hardware version, user choices, etc. That's why using their python package may save a lot of time, if possible.

  8. grahamfindlay commented on Aug 2, 2022

    @grahamfindlay
    Author

    @JuliaSprenger One of my colleagues is also not able to load his TDT data using v0.10.2 because of another issue:
    Neo assumes that the path to the .Tbk file will be of the form <tank>/<block>/<tank>_<block>.Tbk, when apparently it is common practice to rename the tank and block directories after recording, because TDT adds timestamps to these names that make them very long. Apparently the TDT python package has no issue with this directory structure, and only cares that there is a .Tbk file at the block path that you provide it with.

    Example: /Volumes/opto_loc/Data/ACR_exp/ACR_9/ACR_exp-220614-083228_ACR_9-220617-083308.Tbk'
    At the time of recording, the user requested the tank name "ACR_exp" and the block name was "ACR_9". Then TDT added the time and datestamps when saving to disk, and the user subsequently stripped them from from the directory names.

    At first I thought that it doesn't make sense to expect support for post-recording modification of the tank and block names, but given that these are the names the user actually requests from the software, and the timestamped versions do not appear anywhere else in the file metadata, and TDT's own python package has no issue with this, and it seems to be common behavior, perhaps it would make sense to follow their lead and not check .Tbk filename against the parent and grandparent directory names.

  9. grahamfindlay commented on Aug 5, 2022

    @grahamfindlay
    Author

    Update: Found another person with this same issue involving .Tbk naming.

  10. modified the milestones: , 0.11.0 on Aug 30, 2022
  11. modified the milestones: 0.11.0, 0.12.0 on Sep 29, 2022
  12. removed this from the 0.12.0 milestone on Apr 2, 2023
  13. 2 remaining items

  14. modified the milestones: 0.12.0, on Apr 2, 2023
  15. modified the milestones: , 0.13.0 on Jul 19, 2023
  16. modified the milestones: 0.13.0, 0.14.0 on Feb 23, 2024
  17. modified the milestones: 0.14.0, 0.15.0 on Jan 17, 2025
  18. M-Hisham commented on Mar 13, 2025

    @M-Hisham

    I have similar experience too. I wish we can depend on the official TDT lib to handle this.

    SpikeInterface/spikeinterface#1882 (comment)

  19. zm711 commented on Mar 18, 2025

    @zm711
    Contributor

    @M-Hisham, if you're willing to share small files we could try to work on this more to update our reader. We always need test data to reverse engineer file formats.

  20. grahamfindlay commented on Mar 18, 2025

    @grahamfindlay
    Author

    @zm711 Having once gone through the nightmare of trying to reverse-engineer the many undocumented flavors of file format that TDT has, I strongly suggest just using their tdt package to read what's needed by neo. It seems like there's already precedent for this, e.g. using pynwb to read NWB, or using igor2 to read IGOR files. And as with those, it could be an extra, if you're worried about dependency bloat.

  21. zm711 commented on Mar 18, 2025

    @zm711
    Contributor

    Thanks Graham. We've gone back and forth. There is some desire to remove all external package dependencies and reverse-engineer everything and some desire to use open source tools. I'll read up on the package and bring it up at our maintenance meeting and see what people think.

    It's a bit weird, both their matlab and python repo's have GNU licenses, but it looks like the source code is closed source (which isn't compatible). Maybe I could download the tdt package and see what license is included in the package. I think for something that is (closed?) source I would probably lean toward not being dependent on something we don't fully know.

    But like I said I will bring this up since I don't think we have the maintainer time right now to fully work on tdt.

  22. M-Hisham commented on Mar 20, 2025

    @M-Hisham

    @M-Hisham, if you're willing to share small files we could try to work on this more to update our reader. We always need test data to reverse engineer file formats.

    Hello I have shared some files in the original TDT format here

    the sev files stream is named as "RSn1"

    The main data we are interested in is in the SEV files, each file contain the data stream for one channel.
    The folder size is around 1GB, sorry for that, but I wasn't sure if loading the data correctly would still work with less channels.

  23. zm711 commented on Mar 21, 2025

    @zm711
    Contributor

    @M-Hisham thanks. I take Graham's point seriously. I'll take a look in the next couple weeks, but no guarantee if the format is too complicated. We have a group meeting in a couple weeks so if I can't get something working I'll bring it up with the group then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions