benjamin-heasly / pyramid

Declarative neuro data synthesis, processing, and trial alignment.
The Unlicense
0 stars 1 forks source link

Use trial get_one() and get_time() from trial expressions? #4

Open benjamin-heasly opened 3 months ago

benjamin-heasly commented 3 months ago

Trials have convenience methods get_one() and get_time(), for getting named values and times out of enhancements and/or buffer data. These are handy when used in custom Python classes.

Currently these are not available from trial expressions. Could we bind them as local variables when evaluating trial expressions?

Something like this might work:

locals = {
                **trial.numeric_events,
                **trial.text_events,
                **trial.signals,
                **trial.enhancements,
                'get_one': trial.get_one,
                'get_time': trial.get_time
            }

These might then be used in trial expressions along with named enhancements and buffer data.

task_id > 0 and get_one('foo') > 7 and get_time('bar') < 100