Comments (11)
Yes, a MWE would help. It has been a while since I worked on this code. But running my example does give me one data line per word in the sentence. Looking at the code, the end_trial function only triggers on the final word (as you observed), but the data to the earlier words in the sentence are saved via this.jsPsych.data.write. What is in the results file at the end?
on_finish: function () {
jsPsych.data.displayData('csv');
}
from jspsych-contrib.
Looking at the code, the end_trial function only triggers on the final word (as you observed), but the data to the earlier words in the sentence are saved via this.jsPsych.data.write.
I hadn't noticed this before. This isn't technically a supported use case for jsPsych.data.write()
because under the current data model we expect there to be exactly one entry per trial. For other plugins that have similar kinds of data we typically store the data in arrays.
from jspsych-contrib.
I'm fairly confident that's the issue: pushkin-consortium/pushkin-client#38 (comment)
I was making a MWE for posterity. And I'm also working on a pull request that should fix this. Based on the docs, I was planning on using jsPsych.data.addProperties()
. @jodeleeuw you wouldn't suggest that?
from jspsych-contrib.
OK, here's the MWE: https://github.com/jkhartshorne/jspsych-test-spr
The critical bit is
const jsPsych = initJsPsych({
on_finish: function() {
jsPsych.data.displayData();
},
on_trial_finish: (data) => console.log(data)
});
If you watch the console.log, you'll see that when on_trial_finish
is triggered, the data
object it is passed contains only the final word in the sentence.
from jspsych-contrib.
No, that will add the data to all trials. Mainly used for things like subject IDs, condition assignment, etc.
I'd recommend modifying the plugin to remove calls to jsPsych.data.write()
and instead store the sequence of responses for each variable in arrays. These can be unnested fairly easily in R using tidyr::unnest
.
I do think some of the changes we are making to version 8 may allow us to explore more flexible data models. @bjoluc it would be interesting to consider whether to add a method to write a row of data before a trial is finished.
from jspsych-contrib.
@jodeleeuw -- my turn to complain to you about cross-platform compatibility. Apparently it's not trivial to get canvas installed on an M1 chip.
As I learned here, users of M1s and M2 need to first run
brew install pkg-config cairo pango libpng jpeg giflib librsvg
It may or may not be necessary to also globally install node-gyp using your favorite package manager (yarn or npm, etc.). I did just to check that I could get it installed, so I don't know if it's necessary. I'll add that to the docs and give you a pull request.
from jspsych-contrib.
I'm not entirely sure how to test this locally, but the tests work. (Or at least they did after I rewrote them.)
from jspsych-contrib.
Apparently it's not trivial to get canvas installed on an M1 chip.
Sadly, it's not trivial to get canvas installed in many circumstances. Canvas is a dependency of @jspsych/config
needed for the canvas plugin tests. Terribly wrong decision to include it with the other testing deps in hindsight – I didn't know it was such a trouble maker. We'll remove this in @jspsych/config
v2. Until then, let me exclude it manually in this repo, so we don't need to add instructions for it.
it would be interesting to consider whether to add a method to write a row of data before a trial is finished.
@jodeleeuw Interesting idea, but would require some thought and might add a lot of complexity for an edge case (?) that can also be solved by plugin code. Not something I'd like to maintain, I think 🙃
from jspsych-contrib.
Related Issues (8)
- Add a who-used-jsPsych section in the readme / docs
- Setup changesets HOT 4
- VAS Plugin Error with webpack HOT 5
- Mediapipe face tracking extension HOT 3
- extension-touchscreen-buttons
- Latest version of html-vas-response doesn't seem to be on NPM? HOT 2
- make it clearer how to browse the list of plugins available here. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jspsych-contrib.