Skip to content

BUG: "mne.read_annotations" #6107

Closed

Description

@psychoxiatao

Describe the bug

When I used the command 'mne.read_annotations' to read .csv file. The onset always is 0. However, the duration and description work well. If I change the file into .txt, it works correctly.

Activity

  1. agramfort commented on Mar 31, 2019

    @agramfort
    SponsorMember
  2. cbrnr commented on Apr 1, 2019

    @cbrnr
    Contributor

    I think a better solution would be to add an argument to indicate whether absolute or relative timestamps are present. Then we are independent of the file extension, which is a good thing because it is not clear why .csv should have absolute timestamps and .txt relative ones. Or maybe we can even auto-detect the format of the onsets?

  3. agramfort commented on Apr 1, 2019

    @agramfort
    SponsorMember
  4. massich commented on Apr 1, 2019

    @massich
    Contributor

    It is true that this would lead to a vector of 0s

    @pytest.fixture(scope='session')
    def dummy_annotation_csv_notimestamp_file(tmpdir_factory):
        """Create csv file for testing."""
        content = ("onset,duration,description\n"
                   "3.14, 42, AA \n"
                   "6.28, 48, BB")
    
        fname = tmpdir_factory.mktemp('data').join('annotations_txt.csv')
        fname.write(content)
        return fname

    we either support it or we throw an error when its not a datetime. The problem of this is that we take the first as the orig_time and that might lead to unwanted results.

    this example should give [0, 3.14] as onsets which I'm not sure if its good or not.

  5. cbrnr commented on Apr 1, 2019

    @cbrnr
    Contributor

    but then you have one parameter that only makes sense for one file type as
    the others are unambiguous

    The file extension shouldn't be important at all, so the parameter makes sense for any file type. I don't see the deeper motivation why CSV contains timestamps and TXT doesn't.

    renaming a file to .txt is easy enough I would say

    Sure it's easy, but it is still confusing.

  6. cbrnr commented on Apr 1, 2019

    @cbrnr
    Contributor

    @massich alright, this is a problem. Then maybe the docs should be clearer on the distinction between the two formats and (most importantly) if something is ambiguous we should throw an error.

  7. agramfort commented on Apr 1, 2019

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions