Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed / non-char elements in EEG.event.type field #13

Open
zenBen opened this issue Nov 30, 2017 · 1 comment
Open

Mixed / non-char elements in EEG.event.type field #13

zenBen opened this issue Nov 30, 2017 · 1 comment
Assignees

Comments

@zenBen
Copy link
Member

zenBen commented Nov 30, 2017

Multiple functions perform operations on EEG.event.type field. Some functions compare type to a given string, e.g. 'blink'. Other CTAP functions add events where the type field is of type char.
These functions all expect type to be char, and thus {EEG.event.type} to be a cell array of strings.

However this field is often numeric, depending on the EEG recording system.

Three (or four?) solutions seem possible:

  1. convert EEG.event.type to be char when first loading data, in ctapeeg_load_data()
    • problem: this will be a permanent change to the data, which may be contrary to users' preferences
    • problem: introduces tricky 'hidden' code doing funny things at unexpected places
  2. convert EEG.event.type to be char 'in the loop', i.e. for the duration of each step set. Replace the converted field with the original before saving .set files, or convert back to numeric all elements which can be converted
    • problem: solution is messy, as conversion must take place after initial loading, and also after loading from intermediate stepset files = 2 separate places in CTAP_pipeline_looper()
  3. handle the issue 'on the spot', wherever operations are currently performed on {EEG.event.type}:
    3a. A helper function could be written that takes the field name required (type in this case), and returns the required cell array with all elements converted to char.
    3b. The required comparisons could be restricted to those parts of the {EEG.event.type} that are already char (on the assumption that if you are looking for, e.g. 'blinks', then events with numeric type can be safely excluded)

EDIT Have just discovered that due to the excellent way pop_epoch() is coded, having mixed values in EEG.event.type is going to always fail, ruling out solution 3a/b

EDIT Going with solution 1 for now. Pushed to dev

@zenBen
Copy link
Member Author

zenBen commented Jan 2, 2018

On reflection, seems like problems listed for solution 1 are not so bad, since it is not hard to convert back to numeric (str2double() or similar will just give NaN for entries that are not numbers, and isnan() can filter those). So going with solution 1 and closing

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

No branches or pull requests

2 participants