-
Notifications
You must be signed in to change notification settings - Fork 81
plugin-meye-config & extension-meye #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AdamVasarhelyi2
wants to merge
45
commits into
jspsych:main
Choose a base branch
from
AdamVasarhelyi2:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
17c9349
Add files via upload
AdamVasarhelyi2 ff25cfe
Delete packages/plugin-meye-config/dist/index.browser.js
AdamVasarhelyi2 9cb2fdd
Delete packages/extension-meye/dist/index.browser.js
AdamVasarhelyi2 e736e66
Delete packages/extension-meye/dist/index.browser.js.map
AdamVasarhelyi2 35c087d
Delete packages/extension-meye/dist/index.browser.min.js
AdamVasarhelyi2 f3e348a
Delete packages/extension-meye/dist/index.browser.min.js.map
AdamVasarhelyi2 f0dfa69
Delete packages/extension-meye/dist/index.cjs
AdamVasarhelyi2 8116578
Delete packages/extension-meye/dist/index.cjs.map
AdamVasarhelyi2 92f676d
Delete packages/extension-meye/dist/index.js
AdamVasarhelyi2 0822d04
Delete packages/extension-meye/dist/index.js.map
AdamVasarhelyi2 e3b0fc8
Delete packages/extension-meye/dist/index.d.ts
AdamVasarhelyi2 2a0b232
Delete packages/plugin-meye-config/dist/index.browser.js.map
AdamVasarhelyi2 eff7478
Delete packages/plugin-meye-config/dist/index.browser.min.js
AdamVasarhelyi2 3ae4066
Delete packages/plugin-meye-config/dist/index.cjs
AdamVasarhelyi2 d3029e1
Delete packages/plugin-meye-config/dist/index.cjs.map
AdamVasarhelyi2 d516d00
Delete packages/plugin-meye-config/dist/index.d.ts
AdamVasarhelyi2 fac0b99
Delete packages/plugin-meye-config/dist/index.js
AdamVasarhelyi2 3fbd3a0
Delete packages/plugin-meye-config/dist/index.js.map
AdamVasarhelyi2 28bdca0
Delete packages/plugin-meye-config/dist/index.browser.min.js.map
AdamVasarhelyi2 ef886dc
Use version 0.0.1 to allow update by changeset
jodeleeuw 4143f52
Use version 0.0.1 to allow update by changeset
jodeleeuw d7937f5
Change package name to follow contrib convention
jodeleeuw 915fabb
Change package name to follow contrib convention
jodeleeuw 686a3b8
Change plugin global name to match convention
jodeleeuw 5c038ac
Change class name to match convention
jodeleeuw 4383c70
use updated name
jodeleeuw 2ba17df
use updated name
jodeleeuw cebe98b
Use convention for extension global name
jodeleeuw 48fe57f
Use convention for extension class name
jodeleeuw 534a928
Use updated names
jodeleeuw 6ebb556
Use updated names
jodeleeuw c08c0e7
Merge remote-tracking branch 'my-fork/main'
cd023a9
added rule to ignore all dist folders
1182d07
Updated package-lock.json
f515286
Address recommendations
ee422ab
Improve GUI & update docs
b1aa961
Update docs & fix minor bugs
b9b8845
Major refactor, fix bugs, upgrade performance, update docs, and add m…
495698d
fix some typescript bugs and added config rules
jadeddelta 8004a8a
Merge branch 'main' into pr/AdamVasarhelyi2/73-1
jadeddelta 688269b
add changeset
jadeddelta ddbb762
Bug fixes and increased instruction conciseness.
8de3804
fix(ui): disable buttons under certain conditions
306e448
fix(UI): restore stylesheet after manual calibration
33642f3
fix(ui): remove and restore multiple stylesheets
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@jspsych-contrib/plugin-meye-config": major | ||
| "@jspsych-contrib/extension-meye": major | ||
| --- | ||
|
|
||
| initial release of meye tooling for jsPsych |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,4 +40,4 @@ jobs: | |
|
|
||
| - name: Update README list of plugins and extensions | ||
| run: npm run update-readme | ||
|
|
||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # meye extension | ||
|
|
||
| ## Overview | ||
|
|
||
| This extension collects pupillometric data using Meye, a deep-learning model developed by Fabio Carrara. He made it to run on a website for public use at https://www.pupillometry.it/, and this extension adapts it to JsPsych. After calibrating the extension with the meye plugin (which must be a trial called before any trial using the extension), this extension runs in the background when added to any trial thereafter. | ||
|
|
||
| Minimum requirements are a 720p 30fps webcam. | ||
|
|
||
| ## Compatibility | ||
|
|
||
| Developed using jsPsych v7.3 | ||
|
|
||
| ## Documentation | ||
|
|
||
| Documentation can be found in the /docs folder. | ||
|
|
||
| ## Author / Citation | ||
|
|
||
| Adam Vasarhelyi, Fabio Carrara |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # extension-meye | ||
|
|
||
| Current version: 1.0.0. | ||
|
|
||
| This extension collects pupillometric data using mEye. mEye is a deep-learning model available for public use at https://www.pupillometry.it/, and this extension adapts it to JsPsych. After calibrating the extension with the meye plugin (which must be a trial called before any trial using the extension), this extension runs in the background when added to any trial thereafter. | ||
|
|
||
| Minimum requirements are a 720p 30fps webcam. The corresponding plugin must be called as a trial once in the experiment before using any trial can use the mEye extension. Original mEye website credits: Raffaele Mazziotti1, Fabio Carrara, Giuseppe Amato, and Tommaso Pizzorusso. | ||
|
|
||
| ## Parameters | ||
|
|
||
| This extension accepts one parameter. If unspecified, the extension will not collect any data. | ||
|
|
||
| | Parameter | Type | Default Value | Description | | ||
| | ------------------- | ---------------- | ------------------ | ---------------------------------------- | | ||
| | detection_interval | numeric | null | Specifies how often (in ms) the extension takes a snapshot of the user's pupil. Due to how JavaScript works, this will typically have a mild error averaging 0.014ms, but up to 0.04ms has been observed. | | ||
|
|
||
| ## Data Generated | ||
|
|
||
| This extension collects the following data. This extension measures the pupil at every interval specified by the parameter detection_interval. However, if the trial ends before the next interval is due, the extension will prematurely take a measurement as the trial ends and cancel the measurement that would occur when the trial no longer exists. For this reason, the last pupil measurement may be very soon after the second last measurement and this will be reflected in the data generated below. Due to how JavaScript works, the last measurement may also delay the trial ending by up to .04 s. | ||
|
|
||
| | Name | Type | Value | | ||
| | --------- | ------- | ---------------------------------------- | | ||
| | pupil_diameter | numeric | The diameter of the user's pupil at the time of snapshot, in pixels relative to the participant's monitor. The participant is assumed to have circular pupils because diameter is reported. | | ||
| | blink_prob | numeric | The probability that the user was blinking at the time of snapshot. Is between 0 and 1, where 1 indicates that the extension is certain that the user was blinking. | | ||
| | timecode | numeric | The seconds (rounded to three decimal places) since the start of the extension-trial dyad that the snapshot was taken, including the moment a trial starts and ends. Due to JavaScript, this cannot be perfectly accurate and an error of up to 30ms occurs on the developer's computer. | | ||
|
|
||
| ## Install | ||
|
|
||
| Using the downloaded jspsych-contrib folder: | ||
|
|
||
| ```js | ||
| <script src="jspsych-contrib/packages/extension-meye/dist/index.browser.min.js"></script> | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| Ensure that the **plugin** is a trial in the timeline before adding the extension to any trial thereafter. | ||
|
|
||
| ```javascript | ||
| var meyeCalibrate = { | ||
| type: jsPsychMeyeConfig, | ||
| }; | ||
|
|
||
| var useExtension = { | ||
| type: jsPsychHtmlKeyboardResponse, | ||
| stimulus: '<img id="some-image" src="some-image.png"/>', | ||
| trial_duration: 600, | ||
| response_ends_trial: false, | ||
| data: { task: 'webcam1', US: 'no'}, | ||
| extensions: [{ type: jsPsychExtensionMeye, params: {detection_interval: 100} }] | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
|
||
| <script src="https://unpkg.com/[email protected]"></script> | ||
| <script src="https://unpkg.com/@jspsych/[email protected]"></script> | ||
| <script src="https://unpkg.com/@jspsych/[email protected]"></script> | ||
|
|
||
| <!-- Make sure that the plugin below has been built before using it. It's different to the current | ||
| extension. To build it, go to /plugin-meye-config and run npm run build --> | ||
| <script src="../../plugin-meye-config/dist/index.browser.min.js"></script> | ||
AdamVasarhelyi2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <script src="../dist/index.browser.min.js"></script> | ||
| <script src="../../extension-countdown/dist/index.browser.min.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <script> | ||
| /* initialize jsPsych */ | ||
| var jsPsych = initJsPsych({ | ||
| extensions: [{type: jsPsychExtensionMeye}], | ||
| on_finish: function() { | ||
| jsPsych.data.displayData(); | ||
| jsPsych.data.get().localSave('csv','TESTDATA.csv'); | ||
| } | ||
| }); | ||
|
|
||
| /* create timeline */ | ||
| var timeline = []; | ||
| var participant_id = jsPsych.data.getURLVariable('ID'); | ||
| jsPsych.data.addProperties({participant: participant_id}); | ||
|
|
||
| var screen_width = window.screen.availHeight; | ||
| jsPsych.data.addProperties({screenW: screen_width}); | ||
|
|
||
| var screen_height = window.screen.availWidth; | ||
| jsPsych.data.addProperties({screenH: screen_height}); | ||
|
|
||
| /* preload images */ | ||
| var preload = { | ||
| type: jsPsychPreload, | ||
| images: ['../../plugin-meye-config/img/picture2.png', '../../plugin-meye-config/img/cross.png'] | ||
| }; | ||
|
|
||
| timeline.push(preload); | ||
|
|
||
| var meyeCalibrate = { | ||
| type: jsPsychMeyeConfig, | ||
| //auto_calibrate: false, | ||
| }; | ||
|
|
||
| const orientblue36 = { | ||
| timeline:[ | ||
| { | ||
| type: jsPsychHtmlKeyboardResponse, | ||
| stimulus: '<img src="../../plugin-meye-config/img/cross.png" width="50" height="50"/>', | ||
| trial_duration: 600, | ||
| extensions: [{ type: jsPsychExtensionMeye, params: {detection_interval: 100} }] | ||
| }, | ||
| { | ||
| type: jsPsychHtmlKeyboardResponse, | ||
| stimulus: '<div><img id="Blue" src="../../plugin-meye-config/img/Picture2.png" height="9%" style="position:absolute; top:46%; left:64%"/></div>', | ||
| trial_duration: 2000, | ||
| extensions: [{ type: jsPsychExtensionMeye, params: {detection_interval: 200} }] | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| var test_procedure = { | ||
| timeline: [preload, meyeCalibrate, orientblue36] | ||
| }; | ||
|
|
||
| timeline.push(test_procedure); | ||
| jsPsych.run(timeline); | ||
|
|
||
| </script> | ||
| </body> | ||
|
|
||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "name": "@jspsych-contrib/extension-meye", | ||
| "version": "0.0.1", | ||
| "description": "This extension collects pupillometric data using mEye, a deep-learning model developed by Fabio Carrara. He made it to run on a website \r for public use at https://www.pupillometry.it/, and this a JsPsych adaptation to make it viable for use in research. After calibration, the extension runs behind the scenes just like any other extension. Webcam quality >= 720p and >= 30fps is recommended.", | ||
| "type": "module", | ||
| "main": "dist/index.browser.min.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1", | ||
| "build": "rollup --config" | ||
| }, | ||
| "keywords": [], | ||
| "author": "Adam Vasarhelyi", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@tensorflow/tfjs": "^4.22.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { makeRollupConfig } from "../../node_modules/@jspsych/config/rollup.js"; | ||
|
|
||
| export default makeRollupConfig("jsPsychExtensionMeye"); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is typescript supposed to be added here? it seems like it should just be a local system dev dependency