expyriment.design.Trial
- class expyriment.design.Trial
 A class implementing an experimental trial.
- __init__()
 Create a Trial.
- add_stimulus(stimulus)
 Add a stimulus to the trial.
- Parameters:
 - stimulusexpyriment 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.
- compare(trial)
 Compares this trial with another trail and returns True if all factors associated with both trials are identical. Added stimuli will be ignored for the comparison.
- Parameters:
 - traildesign.Trial
 
- Returns:
 - identical: boolean
 
- copy()
 Return a copy of the trial.
- property factor_dict
 The dictionary with all factors of the trial.
- property factor_names
 Getter for factors names.
- property factors_as_text
 Return all factor names and values as csv string line
- find_stimulus(id)
 Find the positions of a stimulus.
- Parameters:
 - idint
 stimulus id to look for
- Returns:
 - posint
 positions as a list or None if not in stimuli list
- get_factor(name, return_none_if_not_defined=False)
 Get a factor of the trial.
- Parameters:
 - namestr
 factor name
- return_none_if_not_definedboolean (default: False)
 suppresses exception and returns None if factor is not defined.
- Returns:
 - factor_valstr or numeric
 
- has_factor(name)
 Checks if a factor is defined.
- Parameters:
 - namestr
 factor name (str)
- Returns:
 - boolboolean
 
- property id
 Getter for id.
- order_stimuli(order)
 Order the stimuli.
- Parameters:
 - orderlist
 list with the new order of positions
- preload_stimuli()
 Preload all stimuli in trial.
- Returns:
 - timeint
 time it took to execute this method in ms
- remove_stimulus(position)
 Remove stimulus from trial.
- Parameters:
 - positionint
 position of the stimulus
- set_factor(name, value)
 Set a factor for the trial.
- Parameters:
 - namestr
 factor name
- valuestr or numeric
 factor value
- shuffle_stimuli(max_repetitions=None, n_segments=None)
 Shuffle all stimuli.
- Parameters:
 - max_repetitionsint, optional
 see documentation of randomise.shuffle_list, default = None
- n_segmentsint, optional
 see documentation of randomise.shuffle_list, default = None
- Returns:
 - successbool
 randomisation was successful and fulfilled the specified constrains (see max_repetitions)
- sort_stimuli()
 Sort the stimuli according to their IDs from low to high.
- property stimuli
 Getter for stimuli.
- swap_stimuli(position1, position2)
 Swap two stimuli.
- Parameters:
 - position1int
 position of first stimulus
- position2int
 position of second stimulus
- unload_stimuli(keep_surface=False)
 Unload all stimuli in trial.
- Parameters:
 - keep_surfacebool, optional
 keep the surface after unloading (default = False)
- Returns:
 - timeint
 time it took to execute this method in ms