Experiment#
- class alfred3.experiment.Experiment(session_timeout: int = 86400)[source]#
Bases:
object
Used to construct the experiment in script.py.
Experiment members can be added with the augmented assigment operator
+=
(see exampples). They can be accessed with the dictionary-style square bracket syntac and with the attribute-style dot syntax (see examples).The class acts as an organizing container for pages and section for orderly instantiation of the
ExperimentSession
.Examples
Create an experiment and add simple page in object oriented style:
import alfred3 as al exp = al.Experiment() @exp.member class HelloWorld(al.Page): def on_exp_access(self): self += al.TextEntry(toplab="Enter something", name="text1")
Access a page with square bracket syntax.
>>> exp["page1"] Page(class="Page", name="page1")
Access a page with attribute syntax
>>> exp.page1 Page(class="Page", name="page1")
Methods
Decorator for functions that work on the experiment session directly upon abortion.
Append members to the experiment.
Class decorator for adding a custom final page to the experiment.
Creates an experiment session.
Decorator for code to be run upon
ExperimentSession.finish()
.Decorator for adding pages and sections to the experiment.
Runs the experiment.
Decorator for functions that work on the experiment session directly after intialization.
Attributes
The experiment's final page.
A dictionary of all pages and sections added to the experiment.
A list of function that will be called upon creation of an experiment session.
A list of function that will be called upon finishing an experiment session.
A list of function that will be called upon aborting an experiment session.