Group#
- class alfred3_interact.group.Group(matchmaker, **data)[source]#
Bases:
object
The group object holds members and keeps track of their roles.
The group’s main task is providing access to the group members via their roles. Most importantly, the group offers the attributes
me
andyou
. Beyond that, you can use dot notation, using any member’s role like an attribute on the group. The group will return aGroupMember
object for the member inhabiting that role.Typically, you will not initialize a group object yourself, but receive it as a result of the matchmaking process via
MatchMaker
See also
See
GroupMember
for information about member objects.Examples
In this basic example, we access both group members through their roles and print their inputs on the last page:
import alfred3 as al import alfred3_interact as ali exp = al.Experiment() @exp.setup def setup(exp): spec = ali.SequentialSpec("a", "b", nslots=10, name="spec1") exp.plugins.mm = ali.MatchMaker(spec, exp=exp) @exp.member class Demo: def on_exp_access(self): self += al.TextEntry(leftlab="Enter some text", force_input=True, name="el1") @exp.member class Match(ali.WaitingPage): def wait_for(self): group = self.exp.plugins.mm.match() self.exp.plugins.group = group return True @exp.member class Success(al.Page): def on_first_show(self): group = self.exp.plugins.group role = group.me.role self += al.Text(f"Successfully matched to role: {role}") a = group.a b = group.b self += al.Text(f"Values of group member a: {a.values}") self += al.Text(f"Values of group member b: {b.values}")
Methods
A generator, iterating over all active members of the group.
A generator, iterating over all active members of the group except for
me
.Shortcut for creating a group chat.
A generator, iterating over all members of the group.
A generator, iterating over the group members except for
me
.Indicates whether the group accepts members.
Attributes
Indicates whether all group members have finished their experiment sessions.
Indicates whether all roles in the group are filled.
Unique group identification number.
GroupMember
object for the own session.Number of group members currently working on the experiment.
Number of group members who have finished their experiment session.
DEPRECATED shared group data dictionary.
Name of the spec that was used to create this group.
GroupMember
object for the other participant in a dyad (i.e.