optogenetics.py
activate(schema_name, *, create_schema=True, create_tables=True, linking_module=None)
¶
Activate this schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_name
|
str
|
schema name on the database server |
required |
create_schema
|
bool
|
when True (default), create schema in the database if it does not yet exist. |
True
|
create_tables
|
bool
|
when True (default), create schema tables in the database if they do not yet exist. |
True
|
linking_module
|
str
|
a module (or name) containing the required dependencies. |
None
|
Dependencies
Upstream tables: Device: Referenced by OptoProtocol. Pulse generator used for stimulation. Session: Referenced by OptoProtocol. Typically a recording session. Implantation: Referenced by OptoProtocol. Location of the implanted optical fiber.
Source code in element_optogenetics/optogenetics.py
9 10 11 12 13 14 15 16 17 18 19 20 21 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 | |
OptoWaveformType
¶
Bases: Lookup
Stimulus waveform type (e.g., square, sine, etc.)
Attributes:
| Name | Type | Description |
|---|---|---|
waveform_type |
varchar(32)
|
Waveform type (e.g., square, sine) |
Source code in element_optogenetics/optogenetics.py
50 51 52 53 54 55 56 57 58 59 60 61 | |
OptoWaveform
¶
Bases: Lookup
OptoWaveform defines the shape of one cycle of the optogenetic stimulus
Child tables specify features of specific waveforms (e.g., square, sine, etc.)
Attributes:
| Name | Type | Description |
|---|---|---|
waveform_name |
varchar(32)
|
Name of waveform |
OptoWaveformType |
foreign key
|
OptoWaveformType primary key |
normalized_waveform |
longblob
|
For one cycle, normalized to peak |
waveform_description |
varchar(255), optional
|
Description of waveform |
Source code in element_optogenetics/optogenetics.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 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 | |
Square
¶
Bases: Part
Square waveform
Attributes:
| Name | Type | Description |
|---|---|---|
OptoWaveform |
foreign key
|
OptoWaveform primary key |
on_proportion |
decimal(2, 2) unsigned
|
Proportion of stimulus on time within a cycle |
off_proportion |
decimal(2, 2) unsigned
|
Proportion of stimulus off time within a cycle |
Source code in element_optogenetics/optogenetics.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
Ramp
¶
Bases: Part
Ramp waveform
Attributes:
| Name | Type | Description |
|---|---|---|
OptoWaveform |
foreign key
|
OptoWaveform primary key |
ramp_up_proportion |
decimal(2, 2) unsigned
|
Ramp up proportion of the linear waveform |
ramp_down_proportion |
decimal(2, 2) unsigned
|
Ramp down proportion of the linear waveform |
Source code in element_optogenetics/optogenetics.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
Sine
¶
Bases: Part
Sine Waveform. Starting_phase ranges (0, 2]. 0 for Sine, 0.5 for Cosine
Attributes:
| Name | Type | Description |
|---|---|---|
OptoWaveform |
foreign key
|
OptoWaveform primary key |
number_of_cycles |
smallint
|
Number of cycles |
starting_phase |
decimal(3, 2)
|
Phase in pi at the beginning of the cycle. Defaults to 0 |
Source code in element_optogenetics/optogenetics.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
OptoStimParams
¶
Bases: Manual
A single optical stimulus that repeats.
Power and intensity are both optional. Users may wish to document one or the other.
Attributes:
| Name | Type | Description |
|---|---|---|
opto_params_id |
smallint
|
Stimulus parameter ID |
OptoWaveform |
foreign key
|
OptoWaveform primary key |
wavelength |
int
|
Wavelength in nm of optical stimulation light |
power |
decimal(6, 2), optional
|
Total power in mW from light source |
light_intensity |
decimal(6, 2), optional
|
Power for given area |
frequency |
decimal(5, 1)
|
Frequency in Hz of the waveform |
duration |
decimal(5, 1)
|
Duration in ms of each optical stimulus |
Source code in element_optogenetics/optogenetics.py
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 | |
OptoProtocol
¶
Bases: Manual
Protocol for a given session. This table ties together the fiber location, pulse generator, and stimulus parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
Session |
foreign key
|
Session primary key |
protocol_id |
int
|
Protocol ID |
OptoStimParams |
foreign key
|
OptoStimParams primary key |
Implantation |
foreign key
|
Implantation primary key |
Device |
(foreign key
|
Device primary key |
protocol_description |
varchar(255), optional
|
Description of optogenetics protocol |
Source code in element_optogenetics/optogenetics.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
OptoEvent
¶
Bases: Manual
Start and end time of the stimulus within a session
Attributes:
| Name | Type | Description |
|---|---|---|
OptoProtocol |
foreign key
|
OptoProtocol primary key |
stim_start_time |
float
|
Stimulus start time in seconds relative to session start |
stim_end_time |
float
|
Stimulus end time in seconds relative to session start |
Source code in element_optogenetics/optogenetics.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |