question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding `minimum_trial_duration` parameter to plugins

See original GitHub issue

Background

I propose to add a paramater that I would call response_ends_trial_after_stimulus_duration that as the name says ends a trial when a response is given and the provided stimulus_duration elapsed. Currently, the parameter response_ends_trial ignores stimulus duration that can be fine in a lot circumstances but can be problematic for certain types of experiments.

For instance in the field of memory research, we typically want our stimulus to be presented for the same duration during a learning phase regardless whether a response is given. This is important as we want to be able contrast conditions that might come with different RTs. My proposed feature would ensure that even if Condition A is faster than Condition B, stimuli in both conditions are displayed for the same duration allowing me attribute a subsequent memory effect to something other than shorter presentation times in one of the conditions. At the same time, we also often want the possiblity to end a trial when a response is given.

Implementation

I’ve started adding this feature to my fork and create an example. So far, I’ve only added this parameter to /jspsych-html-keyboard-response.js.

Crucially, I made a change that automatically sets response_ends_trial to true because it would otherwise conflict with response_ends_trial_after_stimulus.

@becky-gilbert thankfully gave some advice to improve my original modification. The discussion can be found here.

PS

I am happy to make the changes to the other plugins as well depending on the feedback here.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
becky-gilbertcommented, Apr 9, 2021

Great! Thanks very much for the update. We’ll look at this ASAP and get back to you.

And as far as dealing with invalid/inconsistent parameter values, this can be a bit tricky and we don’t expect plugins to catch everything. But one option is to just show a warning in the console, something like this:

if (trial.minimum_trial_duration !== null && trial.trial_duration !== null && trial.minimum_trial_duration > trial.trial_duration) {
  console.warn("Warning in html-keyboard-response: minimum_trial_duration is greater than trial_duration, "+
    "so minimum_trial_duration will be used as the trial duration and the trial_duration parameter will be ignored.");
}
0reactions
JAQuentcommented, Apr 9, 2021

Good idea 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Parameters to Plug-ins - Documentation
Add a Parameter. The FxPlug SDK includes methods for adding these standard types of parameters: Floating-point, integer, and percent sliders.
Read more >
Plugin parameters - Figma Help Center
Developers can create plugins with parameters which allow plugins to accept user input from the quick actions menu. Adding parameters to your plugin...
Read more >
Adding Parameters to Our Plugin | Extending Joomla! with ...
In this chapter, Mark Dexter and Louis Landry examine how plugins work and the different types of events that can trigger plugins.
Read more >
Adding plugin parameters through config.xml in Visual Studio ...
Unfortunately, due to a Cordova issue, you can run into problems with plugin variables in Cordova < 5.0.0. Plugin variable information is lost...
Read more >
Tutorial: Adding plug-in parameters - JUCE: Class Index
Add parameters to your audio plug-in to allow control and automation from ... is based on the GainPlugin project in the JUCE/examples/Plugins directory....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found