Skip to content

Events files are read in with onset as the index, causing downstream issues #9

@tsalo

Description

@tsalo

In a few places within the package, events files are read in using pandas.read_csv, as below:

timing = pd.read_csv(event_files[0], header=0, index_col=0, sep='\t')

Setting index_col=0 means that the first column will be read in as the index, and in BIDS datasets that first column would generally be the "onset" column. Later, however, the "onset" column is directly referenced, but it won't be available since it'll be the index (see below).

blocks.append((cond_timing.loc[i]['onset'] / tr, ((cond_timing.loc[i]['onset'] + cond_timing.loc[i]['duration']) / tr) + 1))

I think the solution is to drop index_col=0 and header=0 from all read_csv calls targeting events files. Also, switching to read_table will let you drop sep="\t", so it would just be df = pd.read_table(events_file).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions