Core Stimulus module¶
Module for handling stimulus presentation in behavioral experiments.
This module provides a base Stimulus class that handles the presentation of various types of stimuli during behavioral experiments. It includes functionality for stimulus preparation, presentation, logging, and cleanup.
StimCondition
¶
Bases: Manual
Datajoint table for the stimulus presentation hash.
Source code in src/ethopy/core/stimulus.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
Trial
¶
Bases: Part
Datajoint table for the Stimulus onset timestamps.
Source code in src/ethopy/core/stimulus.py
231 232 233 234 235 236 237 238 239 240 241 242 |
|
Stimulus
¶
Base class for handling stimulus presentation in behavioral experiments.
This class provides the core functionality for managing stimuli in behavioral experiments, including initialization, presentation, logging, and cleanup. It can be subclassed to implement specific types of stimuli.
Attributes:
Name | Type | Description |
---|---|---|
cond_tables |
List[str]
|
List of condition table names. |
required_fields |
List[str]
|
List of required fields for stimulus conditions. |
default_key |
Dict[str, Any]
|
Default key-value pairs for stimulus conditions. |
curr_cond |
Dict[str, Any]
|
Current stimulus condition parameters. |
conditions |
List[Dict[str, Any]]
|
List of all stimulus conditions. |
timer |
Timer
|
Timer object for tracking stimulus timing. |
period |
str
|
Current experimental period ('Trial' by default). |
in_operation |
bool
|
Flag indicating if stimulus is currently active. |
flip_count |
int
|
Counter for screen flips. |
photodiode |
bool
|
Flag for photodiode triggering. |
rec_fliptimes |
bool
|
Flag for recording flip times. |
fill_colors |
DictStruct
|
Structure containing color values for different states |
Source code in src/ethopy/core/stimulus.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
__init__()
¶
Initialize stimulus attributes.
Source code in src/ethopy/core/stimulus.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
exit()
¶
Exit stimulus stuff.
Source code in src/ethopy/core/stimulus.py
134 135 136 |
|
fill(color=False)
¶
Stimulus hidding method.
Source code in src/ethopy/core/stimulus.py
121 122 123 124 125 126 |
|
init(exp)
¶
Initialize stimulus with experiment object and setup screen properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exp
|
Experiment
|
Experiment object containing logger and interface components. |
required |
Source code in src/ethopy/core/stimulus.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
log_start()
¶
Start timer for the log of stimlus condition.
Source code in src/ethopy/core/stimulus.py
158 159 160 161 |
|
log_stop()
¶
Log stimulus condition start & stop time.
Source code in src/ethopy/core/stimulus.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
make_conditions(conditions=None)
¶
Generate and store stimulus conditions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conditions
|
List[Dict[str, Any]]
|
List of condition dictionaries to process. |
None
|
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
List of processed condition dictionaries with hashes. |
Raises:
Type | Description |
---|---|
AssertionError
|
If required fields are missing from any condition. |
Source code in src/ethopy/core/stimulus.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
name()
¶
Get the name of the stimulus class.
Returns:
Type | Description |
---|---|
str
|
Name of the current stimulus class. |
Source code in src/ethopy/core/stimulus.py
211 212 213 214 215 216 217 218 |
|
prepare(curr_cond=False, stim_period='')
¶
Prepare stuff for presentation before trial starts.
Source code in src/ethopy/core/stimulus.py
103 104 105 106 |
|
present()
¶
Present stimulus.
This is a placeholder method that should be overridden by subclasses to implement specific stimulus presentation logic.
Source code in src/ethopy/core/stimulus.py
114 115 116 117 118 119 |
|
punish_stim()
¶
Stim Cue for punishment.
Source code in src/ethopy/core/stimulus.py
148 149 150 151 |
|
ready_stim()
¶
Stim Cue for ready.
Source code in src/ethopy/core/stimulus.py
138 139 140 141 |
|
reward_stim()
¶
Stim Cue for reward.
Source code in src/ethopy/core/stimulus.py
143 144 145 146 |
|
setup()
¶
Set up stimulus presentation environment.
Initializes the Presenter object with monitor settings and background color. Should be called before starting the experiment.
Source code in src/ethopy/core/stimulus.py
89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
start()
¶
Start stimulus.
Source code in src/ethopy/core/stimulus.py
108 109 110 111 112 |
|
start_stim()
¶
Stim Cue for start.
Source code in src/ethopy/core/stimulus.py
153 154 155 156 |
|
stop()
¶
Stop stimulus.
Source code in src/ethopy/core/stimulus.py
128 129 130 131 132 |
|