Skip to content

Commit

Permalink
Update units.raw_structure description and remove raw_location
Browse files Browse the repository at this point in the history
  • Loading branch information
bjhardcastle committed May 29, 2024
1 parent 02f9676 commit 3ba11c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
15 changes: 7 additions & 8 deletions src/npc_sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,15 +1323,13 @@ def electrodes(self) -> pynwb.core.DynamicTable:
"z",
) + column_names
ccf_df = utils.get_tissuecyte_electrodes_table(self.id)
if "raw_location" in ccf_df:
if "raw_structure" in ccf_df:
column_names = column_names + (
"raw_location",
"raw_structure",
)
column_description = {
"structure": "acronym for the Allen CCF structure that the electrode recorded from - less-specific than `location`",
"raw_location": "raw non-processed (for white matter areas (lowercase), will be different than location) acronym for the Allen CCF strucutre that the electrode recorded from",
"raw_structure": "raw non-processed (for white matter areas (lowercase), will be different than structure) acronym for the Allen CCF strucutre that the electrode recorded from - less specific than location",
"raw_structure": "same as `structure`, except white matter areas (lowercase names) have not been reassigned",
"x": "x coordinate in the Allen CCF, +x is posterior",
"y": "y coordinate in the Allen CCF, +y is inferior",
"z": "z coordinate in the Allen CCF, +z is right",
Expand All @@ -1356,7 +1354,7 @@ def electrodes(self) -> pynwb.core.DynamicTable:
group = self.electrode_groups[f"probe{probe_letter}"]
for channel_label, (x, y) in channel_pos_xy.items():
channel_idx = int(channel_label.strip("CH"))
kwargs: dict[str, str | float] = {
row_kwargs: dict[str, str | float] = {
"group": group,
"group_name": group.name,
"rel_x": x,
Expand All @@ -1373,13 +1371,14 @@ def electrodes(self) -> pynwb.core.DynamicTable:
)
).any()
):
kwargs |= (
annotated_probes.query(f"channel == {channel_idx}")
row_kwargs |= (
annotated_probes
.query(f"channel == {channel_idx}")
.iloc[0]
.to_dict()
)
electrodes.add_row(
**kwargs,
**row_kwargs,
)

return electrodes
Expand Down
5 changes: 2 additions & 3 deletions src/npc_sessions/utils/electrodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_tissuecyte_electrodes_table(
>>> df = get_tissuecyte_electrodes_table('626791_2022-08-16')
>>> df.columns
Index(['group_name', 'channel', 'location', 'structure', 'x', 'y', 'z',
'raw_location', 'raw_structure'],
'raw_structure'],
dtype='object')
"""
electrode_files = npc_lims.get_tissuecyte_annotation_files_from_s3(session)
Expand Down Expand Up @@ -62,10 +62,9 @@ def get_tissuecyte_electrodes_table(
]
+ (
[
"raw_location",
"raw_structure",
]
if "raw_location" in session_electrodes.columns
if "raw_structure" in session_electrodes.columns
else []
)
]
Expand Down

0 comments on commit 3ba11c6

Please sign in to comment.