psychopy.org | Reference | Downloads | Github

jsQUEST: A Bayesian adaptive psychometric method for measuring thresholds in online experiments

Please let me introduce jsQUEST I developed.
This is a JavaScript library for a Bayesian adaptive psychometric method for measuring thresholds in online experiments.

GitHub repository

How to use jsQUEST

I’m currently trying to use jsQUEST with PsychoJS, but it’s not working yet.
Does anyone know how to load an external JavaScript file to a PsychoJS file? Or is there any documentation available on how to do that?
I can manually rewrite the file output by PsychoPy builder, but it will be automatically rewritten when I upload it to Pavlovia.

As you know, QUEST is implemented in the desktop version (offline) of PsychoPy.
Ideally, jsQUEST would be formally integrated into the PsychoPy builder and work together with PsychoJS.
I would love to help with this, but unfortunately, I am not a PsychoPy developer and have no knowledge of it.

I would be very happy if PsychoPy developers would be interested in jsQUEST.

1 Like

Try the following in a Before Experiment code component tab

import jsQUEST from 'https://www.hes.kyushu-u.ac.jp/~kurokid/QUEST/jsQUEST.js';

1 Like

Hey! In the repo I see that a numeric.js and (perhaps) an interp1.umd.min.js need to be imported too. In PsychoJS we lean heavily on ES6-style modules, but I guess that should work out. Let me try something out…

1 Like

Hey again! Here you can find a demo of jsQUEST in PsychoJS: Thomas Pronk / demo_jsQUEST · GitLab

Note that I needed to use a different way of importing jsQUEST than I described above. The alternative approach acts more like including a JS file into a web-page than importing an ES6 module. It works like a charm, but for future development, I’d recommend packaging the library as a module. That makes it a bit easier to import and is a bit safer when jsQUEST is used in relatively complex applications.

2 Likes

Thank you for your cooperation. I am very impressed that you even made a program!

I have one question.

I understood that the QuestCreate function must be called as window.QuestCreate. But you called other functions (e.g., QuestQuantile and QuestUpdate) without the window. Could you explain the difference?

I removed the window. prefix in QuestCreate and that worked just fine. I guess that (from within an ES6 module) retrieving from the global namespace does not require any window-prefix. Only assigning to the global namespace does. Thanks you very much for reviewing my code and asking that question; I just learned something new about JS :slight_smile:

Next up I’d like to do two things:

  1. Add an experiment to our cross-browser testing system. Then we can test if this demo (and by extension, your library) works across a bunch of different platforms. See this list.
  2. Turn this demo into a more concrete use case; present some trials, register some responses, and update jsQUEST accordingly.

Thank you for your reply.

I don’t know much about the test system, I’ll take a look later.

I realized that jsQUEST should be coded as a module to enable the import function.
I can update jsQUEST, but it seems to be difficult to update numeric.js. Anyway, I’ll try it.

Another concern is that there may be users who need jsQUEST in the current (traditional) code.
If I change jsQUEST to a module, this will probably only work online.
I’m also thinking of running jsQUEST with an experimental library other than PsychoJS (e.g. jsPsych). The current code can be used with jsPsych both online and offline mode.I think I should keep this feature.

No worries about the test system. I’ll just add a demo to the batch and report back to you if I encounter any issues.

About packaging. Yes, that can be bit of a challenge, given that are so many different ways of doing it. Also, I’m not really an expert in it, but we’ve got one in our team we can consult. Let me ask around. This topic might be of interest to a broader audience than only PsychoJS users. Might it be useful to discuss it in your GitHub repo?

Thank you again.

I’m still struggling with the numeric.js module. The contributors of this module stopped developing it a long time ago.
If anyone can help me, it would be greatly appreciated.

If you a GitHub account, I’m thinking of discussing this further in my GitHub repository
If not, I will continue to discuss in this thread.

My pleasure! I made an issue on GitHub for discussing the modularization of jsQUEST. Shall we discuss PsychoJS+jsQUEST-specific topics in this thread then?

1 Like

I added a little test to my demo, which compares the output of jsQUEST to output of the Python implementation in PsychoPy. The estimates seem quite close to eachother, so I guess that checks out!

Well to be honest, I guess they do, but I’m not 100% sure. I’m not very experienced with QUEST, so I’m not sure how much precision is needed. I’ll ask our Python devs. What do you think?

1 Like

demo_jsQUEST has been update to a version that is easier to import into PsychoJS. Also, I added a test to our end-to-end testing suite, which runs a small simulation, and then compares jsQUEST output with a Python implementation of QUEST. I’m happy to report that on all of the platforms in our suite the test has passed!

1 Like