Section Attributes and Methods#

Experiment, position, and identification (Section)#

exp

The ExperimentSession to which this member belongs.

experiment

The ExperimentSession to which this member belongs.

parent

Alias for section.

parent_name

Name of the parent section.

section

The member's parent section.

tree

A single string, indicating the member's position in the experiment.

short_tree

Short version of tree, without the _root._content part that is the same for all members.

uptree()

List of the parent section and the grandparent sections (recursive).

name

Unique name of the member.

tag

Alias for name, included under this name for backwards compatibility.

uid

Alias for name, included under this name for backwards compatibility.

Hooks for overloading (Section)#

on_enter()

Executed every time this section is entered.

on_exp_access()

Executed once, when the ExperimentSession becomes available to the section.

on_hand_over()

Executed every time a direct subsection of this section is entered.

on_leave()

Executed every time this section is left.

on_resume()

Executed every time the experiment resumes from a direct subsection to this section.

Movement permissions (Section)#

allow_backward

Controls, whether participants can move backward from and to pages in this section.

allow_forward

Controls, whether participants can move forward from pages in this section.

allow_jumpfrom

Controls, whether participants can jump from pages in this section

allow_jumpto

Controls, whether participants can jump to pages in this section.

Data and general utilities (Section)#

data

Returns a dictionary of user input data for all pages in this section and its subsections.

unlinked_data

Returns a dictionary of user input data for all unlinked pages in this section and its subsections.

vargs

A dictionary of additional arguments passed on the class upon initialization.

should_be_shown

Returns True if should_be_shown is set to True (default) and all showif conditions return True.

showif()

Hook for controlling whether a page or section should be shown.

shuffle

If True, the members of this section will be randomized every time the section is entered.

subtitle

Page subtitle (str).

title

Page title (str).

Access to members and elements (Section)#

all_closed_pages

Returns a flat dict of all closed pages in this section and its subsections.

all_elements

Returns a flat dict of all elements in this section.

all_input_elements

Returns a flat dict of all input elements in this section.

all_members

Returns a flat dict of all members in this section and its subsections.

all_pages

Returns a flat dict of all pages in this section and its subsections.

all_shown_input_elements

Returns a flat dict of all shown input elements in this section.

all_shown_pages

Returns a flat dict of all pages in this section and its subsections that have already been shown.

all_subsections

Returns a flat dict of all sections in this section and its subsections.

all_updated_elements

Returns a dict of all elements in the current section that have access to the experiment session.

all_updated_members

Returns a dict of all members that already have exp access.

all_updated_pages

Returns a dict of all pages in the current section that have access to the experiment session.

first_member

Returns the first member of the current section.

last_member

Returns the last member of the current section.

pages

Returns a flat dict of all pages in this section.

subsections

Returns a flat dict of all subsections in this section.

Development utilities (Section)#

These methods and attributes are most likely to be of interest to you only if you derive your own sections.

added_to_experiment(exp)

Informs the member that it was added to an experiment session.

added_to_section(section)

Informs the member that it was added to a section.

visible(attr)

Returns the subset of members in the given attribute that should be shown.

append(*items)

Appends a variable number of pages or subsections to the section.

instance_log

If True, the member will spawn a logger that can be configured individually for each instance