sweetbean.block
Block
A block of stimuli (for example, an instruction, training, or test block)
Source code in sweetbean/block.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
__init__(stimuli, timeline=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stimuli
|
a list of stimuli |
required | |
timeline
|
a list of dictionaries with the name of the timeline variables |
None
|
Source code in sweetbean/block.py
46 47 48 49 50 51 52 53 54 55 56 | |
to_image(path, data, sequence=True, timeline_idx='random', zoom_factor=3)
Create an image of the stimuli sequence of the block Arguments: path: the path to save the image data: if needed data can be passed in for the stimuli (for example, correct if the sequence contains a feedback stimulus) sequence: if True, the images are combined into one image else they are stored separately timeline_idx: the index of the timeline element to use, if "random" a random timeline element is chosen, if none, the whole timeline is shown zoom_factor: the factor by which the images are zoomed (can be a list if different zoom factors for each stimulus are needed)
Source code in sweetbean/block.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
to_js(template_timeline_token=None)
Build jsPsych trial source for this block.
If template_timeline_token is set (see :meth:Experiment.compile), the
timeline data is omitted here and injected later via
:meth:Experiment.to_js_string_from_template for faster multi-condition builds.
Source code in sweetbean/block.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |