Running MouseView.js experiment using PsychoJS-PsychoPy
The PsychoPy Builder is a free tool to create experiments that can also write your experiment to JavaScript (PsychoJS) to run online. You can download PsychoPy here: psychopy.org. Most PsychoPy experiments are hosted online using pavlovia.org pavlovia.org
Let's talk through how to get your MouseView.js experiment up and running using PsychoPy.
#
Fork a demoA template of mouseview is already available for you to use and adapt here https://run.pavlovia.org/demos/mouseview_demo and the files can be accessed here https://gitlab.pavlovia.org/demos/mouseview_demo
To use it, sign into your pavlovia.org account (if you don't have one you can sign up for one for free). Go to https://gitlab.pavlovia.org/demos/mouseview_demo and select the "fork" icon, when it asks you what "namespace" you want to fork to select your username - now you have your own copy ready to use on pavlovia!
#
Edit the demo using PsychoPy BuilderOK so now you have a copy, you probably want to make edits. Be aware that this demo was made in a 2021 release of PsychoPy, so if you are running an older version you might need to update first. Once in builder, select the "search" icon (central globe with a magnifying glass on the toolbar). Look for "mouseview_demo" saved under your username and select "Sync".
Now you have a copy of the mouseview demo to build on yourself! (the changes that you make to this copy will not affect the original repository)
#
Make your edits!This demo is a spin off of the dynamic_selective_inspect demo in pavlovia https://run.pavlovia.org/demos/dynamic_selective_inspect/html/ which does something similar, but less cool. With mouseview you can dynamically manipulate the parameters of your mask in a much more flexible way.
#
General settingsBefore our search trial, the general settings for each parameter are initialized in the "init_mouseview_trial" routine. The parameters are set in the "init_mouse_view_code" code component as follows:
For more information on each parameter, see the mouseview article itself. MouseView is preprared in the the "intro_mouseview_trial" routine, where we import the MouseView library and create a "cover" that blocks the scene whilst the overlay is being created, preventing any sneak previews of your stimuli:
#
When the trail startsIn the mouseview_trial itself there are some snippets of code of iterest in the "mouseview_code" code component
At the begining of the routine we start the tracking:
Note, if you are just interested in mouse coordinates you can set "save mouse state" in mouseview_mouse to everyframe. In the end routine tab:
The routine is currently set to end on a click (because of the settings in the mouseview_mouse).
#
Changing mouseview parameters trial-by-trialIn the demo, alpha and blur are manipulated from a conditions file by having a column called "blur" and a column called "alphaLevel", in theory, this should be possible for any parameter of mouseview enabling the manipulation of viewing conditions on a trial-by-trial basis (for example to gradually increase task difficulty!).