expyriment.design.Trial

class expyriment.design.Trial

A class implementing an experimental trial.

Methods

__init__()

Create a Trial.

add_stimulus(stimulus)

Add a stimulus to the trial.

Parameters :

stimulus : expyriment stimulus

stimulus to add (expyriment.stimuli.* object)

Notes

This will add references to stimuli, not copies!

clear_factors()

Clear all factors.

clear_stimuli()

Clear the stimuli.

copy()

Return a copy of the trial.

factor_names

Getter for factors names.

factors_as_text

Return all factor names and values as csv string line

find_stimulus(id)

Find the positions of a stimulus.

Parameters :

id : int

stimulus id to look for

Returns :

pos : int

positions as a list or None if not in stimuli list

get_factor(name)

Get a factor of the trial.

Parameters :

name : str

factor name

Returns :

factor_val : str or numeric

id

Getter for id.

order_stimuli(order)

Order the stimuli.

Parameters :

order : list

list with the new order of positions

preload_stimuli()

Preload all stimuli in trial.

Returns :

time : int

time it took to execute this method in ms

remove_stimulus(position)

Remove stimulus from trial.

Parameters :

position : int

position of the stimulus

set_factor(name, value)

Set a factor for the trial.

Parameters :

name : str

factor name

value : str or numeric

factor value

shuffle_stimuli()

Shuffle all stimuli.

sort_stimuli()

Sort the stimuli according to their IDs from low to high.

stimuli

Getter for stimuli.

swap_stimuli(position1, position2)

Swap two stimuli.

Parameters :

position1 : int

position of first stimulus

position2 : int

position of second stimulus

unload_stimuli(keep_surface=False)

Unload all stimuli in trial.

Parameters :

keep_surface : bool, optional

keep the surface after unloading (default = False)

Returns :

time : int

time it took to execute this method in ms

Previous topic

expyriment.design.Experiment

Next topic

expyriment.io

This Page