You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
it's because the .csv reader expects onsets to be timestamps. We should be
done is raise a meaning warning / error when onsets is not timestamps in
.csv eg suggesting to use .txt
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?
but then you have one parameter that only makes sense for one file type as
the others are unambiguous
renaming a file to .txt is easy enough I would say
@pytest.fixture(scope='session')defdummy_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)
returnfname
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.
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
@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.
Activity
agramfort commentedon Mar 31, 2019
cbrnr commentedon Apr 1, 2019
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?
agramfort commentedon Apr 1, 2019
massich commentedon Apr 1, 2019
It is true that this would lead to a vector of 0s
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_timeand 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.cbrnr commentedon Apr 1, 2019
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.
Sure it's easy, but it is still confusing.
cbrnr commentedon Apr 1, 2019
@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.
agramfort commentedon Apr 1, 2019