ExperimentSession#
- class alfred3.experiment.ExperimentSession(session_id: str, config: Optional[alfred3.config.ExperimentConfig] = None, secrets: Optional[alfred3.config.ExperimentSecrets] = None, timeout: Optional[int] = None, **urlargs)[source]#
Bases:
object
Coordinates all parts of an experiment session.
- Parameters
session_id – Unique session identifier
config – Non-secret experiment configuration
secrets – Secret experiment configuration, such as database credentials
**urlargs – Keyword arguments from url parameters. Will be stored in the attribute
urlargs
for access in the experiment session.
Usually, there is no need to initialize an ExperimentSession manually. The
Experiment
object will take care of that for you.You have access to this object in Page and Section hooks through their accessors
Page.exp
andSection.exp
. It connects all parts of an experiment and allows you to access data from other pages and even other experiment sessions.Note
Because the experiment session is newly created for every new subject, you can only access it in the class style of writing an alfred experiment by deriving new
Page
and/orSection
classes and using their hooks to add elements.See also
howto_exp explains how to go about writing an experiment.
howto_hooks explains how to use hooks.
Experiment
is used to construct the experiment
Changed in version 2.0: Many changes, including new methods and properties for improved usability. Name changed from “Experiment” to “ExperimentSession”.
Methods
Aborts the experiment session.
Appends Sections or Pages to the experiment's root section.
Appends a query dictionary to the internal list of plugin data queries.
Moves the experiment backward one page.
Decrypts input and returns the decrypted object as str.
Encrypts the input and returns the encrypted string.
Closes all previous pages and saves data.
Moves the experiment forward one page.
Get the data dictionary of a specific page.
Get the data dictionary for all pages in a specific section.
Jumps to a specific page in the experiment.
Post a message for one-time display after the next move.
Iterates over the rows in a .csv file, yielding dictionaries.
Iterates over the rows in a .csv file, yielding lists.
Imports a
.yaml
file to a dict.Sends an email message using credentials defined in secrets.conf.
Starts the experiment.
Returns the full path of an experiment subdirectory.
Attributes
A list of functions that will be called upon aborting an experiment session.
Indicates, whether the experiment was aborted.
Shortcut for accessing the additional data dictionary.
The additional data dictionary.
Indicates whether the experiment runs in admin mode.
The alfred3 version used for the current experiment.
List of all experiment datasets.
Dictionary of all sections and pages in the experiment.
Dictionary of all pages in the experiment.
Dictionary of all sections in the experiment.
List of all unlinked datasets.
Returns the experiment author.
Dictionary of information about the client, such as:
Experiment condition.
The experiment configuration.
The experiment's main content section, which holds all sections and pages added to the experiment.
The currently active page of the experiment.
Database object of the main mongo saving agent.
Document collection of the main mongo saving agent.
Document collection for miscellaneous data.
Document collection of the unlinked mongo saving agent.
Experiment id
The experiment's final page.
A list of functions that will be called upon finishing an experiment session.
Indicates, whether the experiment has finished orderly.
Alfred's logging interface.
A dict of information about the experiment.
A list, containing the movement history for the current session.
Path to the experiment directory
A modified dictionary of experiment plugins.
The experiment's progress bar.
The experiment's root section, organizing all other sections, including
content
.The secret experiment configuration.
Experiment session.
Full dataset of the current experimental session.
Indicates whether the session has expired.
Unique session identifier
Session status for the current experiment.
The session's timeout (in seconds).
Start time in seconds since epoch.
A human-readable string, indicating the start time.
Indicates whether the experiment runs in test mode.
Experiment title
A modified dictionary of temporary data.
Type of the experiment
A dictionary of key-value pairs that the experiment might have received as url parameters.
Dictionary of input elements and their current values.
Experiment version