Session is still pretty new so there’s a bit of polishing needed before we encourage people to use it en masse, but sure I’d be happy to give a quick walkthrough of how it works!
Since 2023.2.0, the code written by Builder has been split into functions (setupWindow
, setupDevices
, run
, etc.) and Session essentially allows you to supply a set of .psyexp
files and then call those functions independently. So for example, you may want to set up a window once and run several experiments on it.
In code, you’d create a Window (win = visual.Window(...)
) then create a Session object like so:
thisSession = session.Session(
win=win,
root="path/to/folder/with/experiments/in",
experiments={
# paths should be relative to the root folder
'exp1': "./exp1/exp1.psyexp",
'exp2': "./exp2/exp2.psyexp",
'exp3': "./exp3/exp3.psyexp",
}
)
and you can then run any of those experiments (and setup the window according to its settings, setup devices defined in that experiment, etc.) using the Session object. So to run exp1
for example you’d do:
thisSession.runExperiment("exp1")
There’s a lot more it can do (particularly around asynchronous execution) but that’s kind of the basics of it