A class implementing an experimental block.
Methods
Create a block.
Parameters : | name : str, optional
|
---|
Add trial to the block.
Parameters : | trial : design.Trial
copies : int, optional
random_position : bool, optional
|
---|
Read a list of trials from csv-file and append the new trials to the block. Trials are defined as combinations of trial factors.
csv-file specifications
The first row of the csv-file specifies the factor names. Each following row describes one trial. Each row must have the same amount of columns.
Parameters : | filename : str
encoding : str, optional
|
---|
Notes
All factors will be read in as text strings and not casted to numericals. Please do this manually if required.
Clear all factors.
Clear all trials.
Return a copy of the block.
Getter for design_as_text.
List of trial factors as csv table.
The list considers only the defined trial factors and not the added stimuli.
The dictionary with all factors of the block.
Getter for factor_names.
Factor keys.
Getter for factors_as_text.
Return all factor names and values as string line.
Find the positions of a trial.
Parameters : | id : int
|
---|---|
Returns : | pos : list
|
Get a factor of the block.
Parameters : | name : str
|
---|
Returns a randomly selected trial.
Returns : | rnd : design.Trial
|
---|
Notes
This function is useful for compiling training blocks.
Return a list of the values of a certain factor for all trials.
Parameters : | name : str
|
---|
Getter for id.
Getter for max_trial_repetitions.
Returns the maximum number of immediate trial repetitions.
Getter for n_trials.
Number of trials.
Getter for name.
Order the trials.
Parameters : | order : list
|
---|
Reads a list of trials from a csv file and clears the old block design.
The function considers only the trial factors and not the added stimuli. All factors will be read in as text strings and not casted to numericals. Please do this manually if required.
Parameters : | filename : str
|
---|
Remove a trial.
Parameters : | position : int
|
---|
Save the list of trials to a csv file.
The function considers only the defined trial factors and not the added stimuli.
Parameters filename – name (fullpath) of the csv file
Set a factor for the block.
Parameters : | name : str
value : str or numeric
|
---|
Shuffle all trials.
The function returns False if no randomization could be found that fulfills the max immediate trial repetition criterion. The different type of trials are only defined by the factors. Shuffle does not take into account the added stimuli.
The following randomization methods are defined:
0 = total randomization of trial order (default),
1 = randomization within small miniblocks. Each miniblock contains one trial of each type (only defined by factors!). In other words, copies of one trial type are always in different miniblocks.
Parameters : | method : int, optional
max_repetitions : int, optional
|
---|---|
Returns : | succeeded : bool |
Sort the trials according to their indices from low to high.
Getter for summary.
Swap two trials.
Parameters : | position1 : int
position2 : int
|
---|
Getter for trial_factor_names.
Get all factor names defined in trial list.
Getter for trials.