expyriment.design.Trial¶
-
class
expyriment.design.
Trial
[source]¶ A class implementing an experimental trial.
Methods
-
add_stimulus
(stimulus)[source]¶ 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!
-
compare
(trial)[source]¶ 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.
Returns: identical: boolean :
-
factor_dict
¶ The dictionary with all factors 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)[source]¶ 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)[source]¶ Get a factor of the trial.
Parameters: name : str
factor name
Returns: factor_val : str or numeric
-
id
¶ Getter for id.
-
order_stimuli
(order)[source]¶ Order the stimuli.
Parameters: order : list
list with the new order of positions
-
preload_stimuli
()[source]¶ Preload all stimuli in trial.
Returns: time : int
time it took to execute this method in ms
-
remove_stimulus
(position)[source]¶ Remove stimulus from trial.
Parameters: position : int
position of the stimulus
-
set_factor
(name, value)[source]¶ Set a factor for the trial.
Parameters: name : str
factor name
value : str or numeric
factor value
-
shuffle_stimuli
(max_repetitions=None, n_segments=None)[source]¶ Shuffle all stimuli.
Parameters: max_repetitions : int, optional
see documentation of randomize.shuffle_list, default = None
n_segments : int, optional
see documentation of randomize.shuffle_list, default = None
Returns: success : bool
randomization was successful and fulfilled the specified constrains (see max_repetitions)
See also
randomize.shuffle_list
-
stimuli
¶ Getter for stimuli.
-