Giter Club home page Giter Club logo

labneurocogdevel / slipstask Goto Github PK

View Code? Open in Web Editor NEW
2.0 17.0 0.0 7.63 MB

Slips of Action/Fabulous Fruits (de Wit, 2009) psychology experiment implementation. Online (jspsych) and MR (psychopy) versions

Home Page: https://labneurocogdevel.github.io/slipstask/

Python 18.09% CSS 0.65% HTML 19.66% JavaScript 57.14% TypeScript 3.39% Makefile 0.24% Shell 0.58% R 0.13% Batchfile 0.11% Procfile 0.01%
jspsych psiturk psychopy3 outcome-devaluation

slipstask's Introduction

Slips of Action/Fabulous Fruits @ LNCD: jspsych (javascript) & psychopy (python) ports

Port of Simplified Fabulous Fruit Game, Sanne de Wit, 2019 (manual).

Developed for remote administration and later for MR presentation.

See https://labneurocogdevel.github.io/slipstask/ to interact with task components.

Reference

de Wit et al. JEP-ABPP, 2007; de Wit et al. JNSc, 2009; de Wit et al. JCNSc, 2011; Gillan et al. AmJPsychiatry, 2011; de Wit et al, JNeurosci, 2012 *; de Wit et al. Psychopharm, 2012; Sjoerds et al. Front. 2016 *; de Wit et al. ENEURO, 2018

Task

Measurement

calculate devaluation sensitivity index Sjoerds et al. Front. 2016

We calculated the DSI for the slips-of-action phase by subtracting percentages of responses made toward devalued outcomes from percentages of responses made toward still valuable outcomes, according to the following formula: ((N valued responses/N total responses) โˆ’ (N devalued responses/N total responses)).

Overview

  • 12 fruits: apple, bananas, cherries, coconut, grape, kiwi, lemon, melon, orange, pear, pineapple, strawberry
    • uniquely 6 outside paired with 6 inside
  • response either Left or Right
  • SRO e.g. Apple:Right-Kiwi
    • Stimulus: box labeled with Apple.
    • Response: right key opens the box.
    • Outcome: Kiwi is inside the box.
  1. ID - Instructed Discrimination
  • Apple:Right-Kiwi
  • Pear:Left-Grape
  • ... [4 more]
  1. OD - Outcome Devaluation
  • trial: present 2 outcomes, devalued (X'ed out) Kiwi (prev used Right key to get) v. valued Grape (prev used Left key to get)
  • correct response is Left
  1. SOA - Slips of action
  • cue: devalue Kiwi, value Grape, [...4 more]
  • "go" trial: Pear. Correct response: Left
  • "no-go" trial: Apple. Correct response: None (abstained)
  1. DD - Discrimination Devaluation
  • cue: devalue Apple, value Pear
  • "go" trial: Pear. Correct response: Left
  • "no-go" trial: Apple. Correct response: None (abstained)

ID: Instrumental Discrimination (Training)

Instrumental Discrimination Stimulus Response-Outcome (SRO) training

  • 7-8 min total
  • 6 SROs to learn.
  • 8 blocks of 12 trials (96 total). each of the 6 fruit boxes seen 16 times.
  • score at top. feedback
  • ITI always 1.5sec 1 sec

During each of six blocks, each stimulus was presented twice, in random order. de Wit et al, JNeurosci, 2012 *;

This phase comprised eight blocks and a total of 96 trials. Dividing the task into blocks with randomized stimulus order within each block aided in measuring a learning effect across blocks, and ensured that participants learned all stimuli evenly divided throughout the experiment, instead of randomly seeing only a high amount of repetitions of one stimulus e.g., at the end of the training. Each stimulus was displayed 16 times in order for all participants to adequately learn the S-R-O associations. [Sjoerds et al. Front. 2016]

OD: Outcome Devaluation - R-O knowldege

Instructed outcome-devaluation test assess response-outcome (R-O)

  • The participant is presented two prevous outcomes (fruit inside box)
  • a Left and Right previous outcome (randomly stacked vertically)
  • One outcome is X'ed out.
  • should push the key that previously yielded the currently still valued (not X'ed) outcome.
  • 1 block, 36 trials
  • no feedback, score at the end

This phase was comprised of 36 trials. Participants were not directly given feedback on each trial, but instead were instructed that correct button presses would still earn them points and that they would be shown their total score at the end of the test phase. [Sjoerds et al. Front. 2016]

Slips of Action

A slip of action is a failure to withhold a response towards a devalued outcome => S-R habitual control (cf. goal-directed S-O-R)

  • Present
    • instruction: outcome 2/6 fruits devalued (superimposed X)
    • no response encouraged on stimulus leading to devalued outcome
  • 2016: 9 blocks w/ 12 trials each (2 outcomes per bloc), 108 trials total. (N.B. 6C2 == 15)
    • each outcome devalued 3 times (36 devalued, 72 valued)
  • 2012: 6 blocks w/24 trials each
  • 5s instructions, 1s response, 1s ITI

However, unlike before, some of the fruits inside the box are no longer valuable, meaning you can no longer earn points for them. In fact, if you try and open a box which contains a non-valuable fruit inside, you will have points subtracted from your total! [instructions in manual]

Each of six 24-trial blocks began with a 5 s screen displaying all six fruit outcomes, with two of these (pertaining to different discrimination types and opposite key presses) shown with a cross superimposed indicating that these were devalued (Fig. 1c). Subsequently, participants were shown a succession of 2 s screens with closed boxes with the fruit stimuli on the front (separated by a 1 s intertrial interval). de Wit et al, JNeurosci, 2012 *;

nine blocks, with a total of 108 trials. At the beginning of each block an instruction screen with six possible outcomes (open boxes with animal icons inside) was shown for 5 s, two of them superimposed with a cross. The cross indicated devaluation of those outcomes, and that responding to the stimulus associated with those outcomes would consequentially no longer earn points. After this screen, stimulus pictures were shown in rapid succession. Participants had to respond as fast as possible with a correct button-press to stimuli (closed boxes with an animal icon printed on the front) associated with still-valuable outcomes, and withhold their response for stimuli associated with devalued outcomes. Each stimulus remained on the screen for a fixed 1000 ms, during which the participant had to respond or withhold their response, respectively. The next trial started after an inter-trial interval (ITI) of 1000 ms. As in the outcome-devaluation phase, also in this phase no direct feedback was given, in order to prevent new learning. Instead, the total amount of points was shown at the end of the phase. During each block, each of the six stimuli was shown twice in semi-random order, with the exception that stimuli were never directly repeated. Throughout the nine blocks, each outcome was devalued three times, resulting in 36 trials where the outcome was devalued, and 72 trials with still valuable outcomes. [Sjoerds et al. Front. 2016]

DD: baseline test

Discrimination Devaluation (?): Devalue stimulus instead of outcome to test. otherwise same as Slips of Action

Hacking

The task exists in two implementations here: web based javascript, and MR ready python.

Javascript/jspsych + psiturk

Using jspsych and psiturk libraries

  • utils.ts contains mkBox and Fruit class/prototype (typescript compiled to utils.js)
  • Fruit has properties and drawing/rendering functions
  • mkBox modifies 2 fruits to be pairs, sets correct response, and which SOA blocks are devalued for the fruit

Heroku

see $HOME/.psiturkconfig w/ [AWS Access] containing aws_access_key_id and aws_secret_access_key. also psiturk-heroku-config

Python/psychopy

The python task implementation came second. Warts from porting show: see info.devalued_blocks <-> TrialHanlder Dataframe, L0..R1 not generated using set_names, ... min numpy version is 1.18 (need numpy.random.default_rng).

This version pays more attention to timing and psuedo-randomizes Left/Right choices.

Usage

# install (once)
pip install -e 'git+https://github.com/LabNeuroCogDevel/slipstask'

# with e.g. ~/.local/bin in $PATH
SOAMR

Running SOAMR opens a dialog box. If MR is checked, timing files will be loaded, and an additional prompt will ask for start and end block numbers. Otherwise, the additional prompt will confirm timing and repitition settings for the randomly generated trials.

Timing

see timing/gentiming.py: generate timings and pick minimize norm std dev (3dDeconvolve -nodata).

Code

  • soapy/__init__.py - default task settings
  • soapy/bin/SOAMR - default launcher
  • soapy/images has links from static/images: pngs and obj lists (.txt)

slipstask's People

Contributors

willforan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slipstask's Issues

py: instruction display is misleading

in the instructions, you show the reward to the left/right of the cue, but then in the actual task there are arrows and the box is in the same place...
it would be nice to have the arrows in the instructions (if they aren't there... maybe they are and i forgot)
and maybe have the box in the center (maybe it should go below? i'm not sure) just so it looks exactly like the task

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.