Skip to content

Handling flags and time offset (-ftime option) for >1000 Hz data #36

@flyingfalling

Description

@flyingfalling

I noticed that the current version has no mechanism for returning appropriate floating point time for sample rates >1000 Hz. Currently it provides the (edf2asc etc.) default of simply doubling up "time", without adding the 0.5 offset that is specified by the "SAMPLE_ADD_OFFSET" bit (SAMPLE_ADD_OFFSET = 0x0002 # if this flag is set for the sample add .5ms to the sample time), see edf_data.pyx.

When running edf2asc for example, the "-ftime" flag causes 0.5 msec to be added to time for every sample with the SAMPLE_ADD_OFFSET flag set (which is for every other sample when recorded at 2000 Hz). And time is returned as a floating point number rather than large integer.

A slightly separate issue: the 'flags' column is returned in the samples dataframe as a floating point column instead of the (16-bit) integer flags it should (and it is shadowing pandas.DataFrame.flags...making things confusing to the casual coder accessing via df.flags attr instead of df['flags']...).

I'm trying to work on a fix for this (and will require adding a default-off option argument in read_edf).

Thoughts?

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