apex workshop: flowrunner - exporl.github.io · 3 simplified workflow: 1. open flowrunner file once...

20
Benjamin Dieudonné | 25 april 2018 APEX workshop: Flowrunner

Upload: others

Post on 05-Nov-2019

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

Benjamin Dieudonné | 25 april 2018

APEX workshop: Flowrunner

Page 2: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

2

Solve cumbersome experiment workflow with APEX:

1. Open…: search for right (random) experiment file

2. Fill in interactive parameters (e.g., SNR, subject ID, …)

3. Perform experiment

4. Save: choose a nice name and save the experiment

5. REPEAT steps 1 to 4

APEX Flowrunner: why?

Page 3: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

3

Simplified workflow:

1. Open flowrunner file ONCE

2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE

The flowrunner gives a (randomized) list of all experiments that you want to conduct.

The flowrunner keeps track of the experiments that have already been conducted.

3. Perform experiment

After finishing, you return to the list of all experiments.

The flowrunner automatically saves the result-file with a pre-defined name.

4. REPEAT step 3

APEX Flowrunner: what?

Page 4: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

4

APEX Flowrunner: how?

var main_experiment = {

title : "Title of the experiment",

experiments : [],

randomized : true/false,

blind : true/false,

form : [],

params : {}

};

function setMainParameters(experiment) {}

function setExperimentParameters(experiment) {}

main_experiment template:

Page 5: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

5

APEX Flowrunner: how?

main_experiment template:

var main_experiment = {

title : "Title of the experiment",

experiments : [],

randomized : true/false,

blind : true/false,

form : [],

params : {}

};

function setMainParameters(experiment) {}

function setExperimentParameters(experiment) {}

Page 6: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

6

APEX Flowrunner: how?

experiments : [

{

title : "Title",

file: "file.apx",

expressions : { … },

resultfile: "result.apr"

},

{ … },

{ … }

]

experiments array:

Page 7: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

7

APEX Flowrunner: how?

expressions : {

"apex:apex/results/subject" : "Piet Snot"

}

expressions object:

Page 8: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

8

APEX Flowrunner: how?

experiments : [

{

title : "Title of group of experiments",

description: "Here is a group of experiments",

experiments : [ … ],

randomized : true/false,

blind : true/false

},

{ … },

{ … }

]

experiments array can also contain another "nested" array:

Page 9: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

9

APEX Flowrunner: how?

experiments : [

{ title : "Training story", file : "story.apx" },

{

title : "SPIN",

experiments : [ … ],

randomized : true

},

{

title : "Localization",

experiments : [ … ]

},

randomized: false;

]

experiments array example:

Page 10: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

10

APEX Flowrunner: how?

main_experiment template:

var main_experiment = {

title : "Title of the experiment",

experiments : [],

randomized : true/false,

blind : true/false,

form : [],

params : {}

};

function setMainParameters(experiment) {}

function setExperimentParameters(experiment) {}

Page 11: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

11

APEX Flowrunner: how?

form : [

{

tag_name : "input",

id : "subject",

type : "text",

placeholder: "Name subject"

}

]

form array example "input":

Page 12: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

12

APEX Flowrunner: how?

form : [

{

tag_name : "input",

id : "subject",

type : "text",

placeholder: "Name subject"

}

]

form array example "input":

will be saved in main_experiment.params.subject

Page 13: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

13

var main_experiment = {

title : "Title of the experiment",

experiments : [],

randomized : true/false,

blind : true/false,

form : [],

params : {}

};

function setMainParameters(experiment) {}

function setExperimentParameters(experiment) {}

APEX Flowrunner: how?

main_experiment template:

Page 14: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

14

APEX Flowrunner: how?

function setExperimentParameters(experiment) {

experiment.resultfile = experiment.title + '_' +

experiment.params.subject + '.apr';

experiment.expressions = {

"apex:apex/results/subject" : experiment.params.subject

}

}

setExperimentParameters example:

example of resultfile: SPIN_Benjamin.apr (in the folder of the .apx file!)

Page 15: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

15

APEX Flowrunner: how?

Other stuff that is possible with setExperimentParameters:

• mute some channels based on experiment title

• choose a random experiment file from a pre-defined list

• choose different wav-files based on title

• …

Page 16: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

16

APEX Flowrunner: try it yourself!

Make a flowrunner for your own experiment, or:

Try to adapt apex/examples/flowrunner/generic-runner.apf such that:

• the form asks for an age category: young/middle-aged/old

• results are saved in (make folders beforehand!):

apex/examples/flowrunner/results/[age-category]/

• the name of the result-file contains the title of the experiment

• add an extra experiment "Extra simple adapted", in which

"house" is changed into "tone", and

"stimuli/sin1000Hz-short.wav" is played instead

Page 17: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

17

APEX Flowrunner: about "working directory"

! experiment.file is relative to the .apf-flowrunner file

! experiment.resultfile is relative to the .apx-experiment file

! APEX cannot save files in folders that do not exist

if you want a results-folder, you have to make it yourself first

Page 18: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

18

APEX Flowrunner: about "working directory"

Example

If you have the following folder structure:experiment_X/runner.apf

experiment_X/apx_files/exp1.apx

experiment_X/results/

you should specify in the runner.apf:experiments : [

{

title : "blabla"

file : "apx_files/exp1.apx",

resultfile : "../results/result_exp1.apr"

}

]

Page 19: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

19

APEX Flowrunner: troubleshooting

If your flowrunner does not work, e.g.:

- It shows a blank screen without content

- You get an error that you do not understand

- …

Then: try to validate your javascript: copy all the code from your .apf:

var main_experiment = {…};

function setMainParameters(experiment) {…}

function setExperimentParameters(experiment) {…}

paste it in a validator (e.g., http://jshint.com/ or google “javascript

validator”), and solve the errors based on the output

Page 20: APEX workshop: Flowrunner - exporl.github.io · 3 Simplified workflow: 1. Open flowrunner file ONCE 2. Fill in interactive parameters (e.g., SNR, subject ID, …) ONCE The flowrunner

Benjamin Dieudonné | 25 april 2018

APEX workshop: Flowrunner