lfp_electrode.py
LFPElectrodeGroup
¶
Bases: SpyglassMixin, Manual
Source code in src/spyglass/lfp/lfp_electrode.py
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 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 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
create_lfp_electrode_group(nwb_file_name, group_name, electrode_list, **kwargs)
staticmethod
¶
Adds an LFPElectrodeGroup and the individual electrodes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nwb_file_name
|
str
|
The name of the nwb file (e.g. the session) |
required |
group_name
|
str
|
The name of this group (< 200 char) |
required |
electrode_list
|
list[int] or ndarray
|
A list of the electrode ids to include in this group. |
required |
**kwargs
|
dict
|
Additional keyword arguments to pass to the insert method. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the session is not found in the Session table or if the electrode list is empty or if the electrodes are not valid for this session. |
Source code in src/spyglass/lfp/lfp_electrode.py
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 | |
plan_cautious_insert(session_key, electrode_ids, group_name)
¶
Resolve an electrode group to a key plus the entries it still needs.
The read half of cautious_insert, split out so a caller planning an
ingestion can hold the entries and write them under its own gate --
insert_from_nwbfile(dry_run=True) must not write.
Every check here reads the database, so a plan is only correct against
what is stored. A caller planning several groups before writing any of
them has to dedupe electrode sets and pick names itself: this would
otherwise hand back the same name twice, having no way to see the
group the previous call planned. See
ImportedLFP._plan_electrode_group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_key
|
dict
|
The session key associated with the electrode group. |
required |
electrode_ids
|
list
|
The set of electrode ids to insert into the group. |
required |
group_name
|
str
|
The name of the electrode group to insert. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (dict, dict)
|
The group's key, and the entries needed to create it keyed by table, master before part. The entries are empty when a stored group already holds these electrodes, under whatever name. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the name is taken by a stored group holding different electrodes. |
Source code in src/spyglass/lfp/lfp_electrode.py
cautious_insert(session_key, electrode_ids, group_name)
¶
Insert the electrode group if not already exist. Return group key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_key
|
dict
|
The session key associated with the electrode group. |
required |
electrode_ids
|
list
|
The set of electrode ids to insert into the group. |
required |
group_name
|
str
|
The name of the electrode group to insert. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The key of the inserted group, or of the existing group if it already exists. |