Open jodeleeuw opened 7 years ago
I like this a lot and might give it a try. Two things I'm wondering about:
1) What do you think about making the API more similar to the if_node
? Like so:
var if_node = {
timeline: [if_trial],
conditional_function: function() {
return jsPsych.data.getLastTrialData().correct;
}
}
var select_node = {
timeline: [trial0, trial1, ...],
select_function: function() {
return jsPsych.data.getLastTrialData().correct ? 0 : 1;
}
}
2) What is a clean way to make a decision based on several previous trials, e.g., based on the average RT? I guess the switch_function
would just use the getLastTimlineData()
method and check whatever condition it wants to check. One alternative would be to process the data before, and have the switch_function
work on that aggregated data. Hmm, I'm pretty sure I am overthinking this one :)
@eweitnauer In your select_node
is the timeline a set of timelines? For example, if select_function
returns 0 does timeline[0]
run? I worry that this is confusing because it changes how the timeline
parameter operates, but then again adding another parameter as in my original spec is also potentially confusing.
For the switch function, I think the user could grab any data they want. So if you want to make a decision based on the average RT for the last 10 trials, you just do:
select_function: function() {
var average_rt = jsPsych.data.get().last(10).select('rt').mean();
if(average_rt < 500) {
return 0;
} else {
return 1;
}
}
@jspsych/core maybe this should be added to 8.0 as well?
Crazy (and certainly unfinished) thought: Can we allow timeline-returning functions as timelines?
A simple use case: Suppose there is a two-alternative trial with a correct and incorrect response. If the subject chooses the correct response then a positive feedback message should display. If the subject chooses the incorrect response a negative feedback message should display.
To accomplish this right now, you would need two conditional_functions. Instead, how about something like this: