Documentation
experiment_server.Experiment
¶
Load and manage experiemnt from a local file.
add_participant_index(participant_index)
¶
Add a participant with participant_index
.
If participant_index
already exists, returns False, else return True
get_all_configs(participant_index=None)
¶
Return all configs in order for participant_index
.
if participant_index
is None, seld.default_participant_index is used.
get_blocks_count(participant_index=None)
¶
Return the total number of blocks.
get_config(participant_index=None)
¶
Return the config of the current block for participant_index
.
if participant_index
is None, seld.default_participant_index is used.
If the experiment has not started (move_to_next
has not
been called atleast once), this will return None
.
get_next_participant()
¶
Return the index of the next participant.
move_all_to_block(block_id)
¶
For active participants move the pointer of the current
block to the block in index a block_id
in the list of
blocks.
move_to_block(block_id, participant_index=None)
¶
For participant_index
move the pointer of the current
block to the block in index a block_id
in the list of
blocks. If participant_index
is None, seld.default_participant_index is used.
move_to_next(participant_index=None)
¶
Moves the pointer to the current block to the next block for participant_index
.
if participant_index
is None, seld.default_participant_index is used.
reset_participant(participant_index=None)
¶
Reset the participant's config to that was loaded from the file.
experiment_server.Client
¶
add_participant(participant_index)
¶
Add a new participant with participant_index
. If there is already
a participant with the participant_index
, this will fail.
get_all_configs(participant_index=None)
¶
Returns all the configs as a list for the participant_index
,
if participant_index
is not provided, returns the configs for
the default participant. This is akin having all the results
from calling config
for each block in one list.
get_blocks_count(participant_index=None)
¶
Return the number of blocks in the configuration
loaded. For a given config, the blocks-count
will be the
same for all participants.
get_config(participant_index=None)
¶
Return the config of the current block for participant_index
.
if participant_index
is None, seld.default_participant_index is used.
If the experiment has not started (move_to_next
has not
been called atleast once), this will return None
.
move_to_block(block_id, participant_index=None)
¶
Move participant-id
to the block number indicated by
block_id
, if participant_index
is not provided, move the
default participant to the block number indicated by
block_id
. If the participant was not initialized (active
is false), will make be marked as active (active
will be set
to true). Will fail if the block_id
is below 0 or above the
length of the config.
move_to_next(participant_index=None)
¶
Moves the pointer to the current block to the next block for participant_index
.
if participant_index
is None, seld.default_participant_index is used.
new_participant()
¶
Adds a new participant and returns the new participant_index. The new participant_index will be the largest current participant_index +1.
server_is_active(participant_index=None)
¶
Returns the status for participant-id
, if
participant-id
is not provided, will return the status of
the default participant. Will be false
if the participant
was just initialized or the participant has gone through all
blocks. To initialize the participant's status (or move to a
given block), use the move-to-next
or move-to-block
shutdown()
¶
Shuts down the server.