Using Python toolboxes in PsychoJS

Hi there,

I am planning an online study and trying to decide if PsychoPy is a good fit for the experiment.

The main part of the study involves measuring an individual’s heart rate from a video recording of their face. There are several openly available python toolboxes which allow you to do this in real time (e.g. GitHub - phuselab/pyVHR: Python framework for Virtual Heart Rate), but not in JavaScript.

Would it be possible to incorporate these kinds of toolboxes into an online PsychoPy experiment? My main concern is that the python toolboxes may have several dependencies or specialised functions that might not convert well to PsychoJS.

Thanks for your help!
Jamie

Hi Jamie,

If you are using a specialised python toolbox I am afraid that won’t automatically translate to JavaScript. You are totally right that you would need a Javascript equivalent of the toolbox. From a quick scan I can see some JS libraries that might be appropriate e.g. GitHub - prouast/heartbeat-js: JavaScript implementation of Remote Photoplethysmography – Measuring pulse rate using facial video. may I ask if you’ve checked these out and why you’re concerned they might not be the right fit?

Thanks!
Becca

Hi Becca,

Thank you for your reply!

On the face of it, it seems that the Python toolboxes (the one I linked and others) are a bit more robust and offer more tools for analysing heart data, so I just wanted to check if it was possible to implement those in an online task. Thank you for clarifying.

I have seen that JavaScript toolbox, and we’re currently testing to see if it validates against our lab measures of heart rate such as ECG. If it works then we’ll likely take that forward into our online study!

Best wishes,
Jamie

Did you find a good solution for this? We’re looking at the moment for the same thing.