Matcher Objects
Creation
perfect_strangers.create_matcher(groups_per_round, group_size, participant_labels=None)
Create a groups matcher for the given experiment parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups_per_round
|
int
|
The number of groups per round of the experiment. |
required |
group_size
|
int
|
The number of participants in each group. |
required |
participant_labels
|
ParticipantLabels
|
A list of unique labels for the experiment participants. Must have |
None
|
Returns:
| Type | Description |
|---|---|
BaseMatcher
|
A matcher object of a type which inherits from |
Base Class
All matching methods inherit the interface of the BaseMatcher class.
perfect_strangers.BaseMatcher
Base class for all group matching methods.
max_rounds
property
The maximum number of rounds this matcher will produce under perfect stranger matching conditions.
rounds
property
A list of participant groupings for all rounds constructed by this matcher.
__iter__()
Allow for iterating over rounds in a for loop. For example:
matcher = create_matcher(groups_per_round, group_size)
for round in matcher:
print(round)
groups_for_next_round()
Get the groups for the next round.
Returns:
| Type | Description |
|---|---|
RoundGroups | None
|
A list of participants groupings for the next round, or None if there are no more rounds possible. |
groups_for_round(round_index)
Get the groups for the round with a given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
round_index
|
int
|
The index of the round to get groups for, an integer between |
required |
Returns:
| Type | Description |
|---|---|
RoundGroups
|
A list of participants groupings for the requested round. |
restart()
Reset the matcher to the first round.
shuffle_sequence()
Shuffle the list of rounds produced by this matcher.