Skip to content

LabNeuroCogDevel/choice-landscape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reward Learning and Habituation Task

(aka Landscape choice)

Hosting

Local-only

  • clone and open out/index.html to start the task in a web browser (responses not saved).
    • NB. for where=mri and where=eeg, task ends presents “Download Data” with link to json file that can be saved locally/manually.
  • save psiclj (.jar or .exe) in the root directory and launch as a local service to save to a sqlite3 file. (e.g. loeffeeg.bat)
  • See ./WIN_INSTALL.bat for help with Windows (after installing psychopy)

Heroku

Using Procfile on heroku w/ addon:heroku-postgres and https://github.com/LabNeuroCogDevel/psiclj buildpack

EEG Stimulus Channel triggers, Button Box responses

  • http_ttl.py can be launched as a second service to capture button box responses, simulate keyboard events, and translate http requests from the task into TTL triggers in the EEG recording.

Analysis

see results/ directory, esp. results/Makefile.

  1. DB stores ‘json’ column that can be converted to row per trail text file with dbjsontotsv.jq
  2. read.R::fix_and_save cleans up the output
  3. summary.R summarizes
  4. app.R is a shinny app to explore results

Task Code

This project is clojurescript that transpiles to javascript (see the Makefile). The final assets are in the out/ directory.

Highlights

  • model/STATE is a giant data structure containing everything that might need to be displayed or calculated
    • time-cur is incremented every animation step
    • phase iterates through instructions | iti, chose, [catch, timeout, or] waiting, feedback | done
  • parameters can be “tweaked” with url. see url-tweaks.cljs
  • code path: enter in core.cljs and follow to loop.cljs/run-loop and display-state
  • EEG status channel TTL codes are generated with phase/gen-ttl

Debugging

Using e.g. CIDER with figwheel-main:dev (C-c M-J in emacs on core.cljs)

figwheel urls

  • http://localhost:9500/ cards.html
    • http://localhost:9500/figwheel-extra-main/cards
  • http://localhost:9500/figwheel-extra-main/auto-testing

with repl

(swap! landscape.model/STATE assoc :well-list (landscape.model.timeline/gen-wells {:prob-low 100 :prob-high 100 :reps-each-side 1 :side-best :left}))

; go to the end and dont spam terminal with STATE
(do(swap! landscape.model/STATE assoc-in [:phase :name] :done) nil)

; use local psiclj. need to disable browser CORS
(set! landscape.http/HTTP-DEBUG "0.0.0.0:3001")

Implementation Notes

consistent MR timing

<2022-07-06 Wed> create iti-start-at key in well-list check that against start time if it exists instead of looking at duration need mr start and average walk

likely problem with current timing: timeout is same length as feedback. and there is no “walk” should implement phase tests that progress through each step (maybe with for loop at 30ms intervals?)

audio captcha

plays a speaker saying a word. word must be typed before continuing

parameterize some task settings

  • high prob well is far (yes/no).
  • distribution of sides (high prob more freq?)
  • +/- 4th devalue block
  • +/- reversal

instructions/state advance

instructions step through individual actions (sprites, buckets, etc)

allow for fixed timing

scanner will be given explicit onset targets

update well probabilities on fixed schedule

currently generated by model.timeline/gen-wells with fixed 20/50 probs

add 100/100/100 event

last event is the test of habit. the far well is no longer effect. can get always get reward from a closer well

integrated with http server

POST requests are made before the transition from feedback to iti. intended to be picked up by psiclj tool/server

[#B] use full screen

NB. mturk /ad w/psiclj or psiturk uses a popup window

zoom body?

translation: scale(1.5) works for content but does not scale background. with lower wells, maybe less of a problem

bigger images?

bad idea for smaller screens?

viewport

https://gist.github.com/bigfive/4256993 document.body.style.MozTransform='scale(1.1)' does not scale background

[#C] photodiode color block

tiny block div that changes color at each phase.

  • Block could be moved to a better location.
  • color range should be imperially checked. have 4 phase alternating between ligth and dark. sensitivity might vary. might need to be bigger

touch well simulates keypress

works on wells and instruction button. BUT there is no indication that’s what happened.

[#C] include :touch true in keypress

this looks like it’d be hard to integrate

set scale of water relative to total points needed

partially implemented. could still use math to make sure we don’t get to 100% until last trial (exp decay?) <2022-11-27 Sun> - okay with current setup. also have coin images that accumulate for ocean landscape

[#C] visual to indicate/collect status history of wells

not necissary. maybe problematic. would be useful for debugging though debugging with probability text over well would be useful too

bar at bottom with color for success? X or O next to the well?

[#C] arrows

probably not needed. the buckets are enough of an indication

sprites.

maybe css instead? colored?

placement logic

wells

placement logic

also fixed a loop bug and stopped animation if active-at is 0

exponential decrease. make function to be reused by stepping stones

hard coded sequence :step-sizes in atom settings/current-settings (previously defvar BOARD)

set and indicate dis/enabled well

currently have a bucket on active wells. could still use animations

[#C] animate bucket

have start of animation in wells.svg but crashes inkscape. not critical to task

[#C] color icon to distinguish wells

maybe this isn’t needed

avatar movement

had up/down swapped in which-dir. took forever to debug! how fast to move? accepting keypress?

handle key presses

keypress injected directly into state

restrict keypress, don’t hard code positions

instead of restricting, keypress is cleared before we are in :chose: and waiting for a keypress

github pages

useful to share. need .nojekyll file to use index.html and friends.

sounds

copied cash and buz

feedback

water fill and sound

[#C] maybe add text or stars?

ISI/ITI

ITI with fixation cross

may want to change to grayed avatar

fixation cross position is different in firefox and chrome

  • maybe prefer chrome instead of firefox.
  • maybe an image will be positioned better?

ISI

  • might not need. depends on modeling
  • shake the well for variable time before showing reward
  • intermediate helper goes to the well instead. (bring bucket, drill, etc). can be disgruntled or happy

:done state

  • POST to /finish. Display thank you/finished text

[#B] redirect to amazon turk finish page?

[#C] survey

  • add results to :record, might need to reorganize top level
  • allow text box entry for non-MR (why pick well all at 100%, other thoughts)

add animation to devcards

still haven’t figured out. but animating for the instruction choice screen helped debug bad frames

record start and end volume (did anyone turn it down?)

sEEG system

need libuldaq and rtbox, see rtbox_seeg/readme.md