From 3df4687386ebcce35c33b47d720b4a85f1748e0c Mon Sep 17 00:00:00 2001 From: Christopher Morrison Date: Tue, 24 Oct 2023 18:08:45 -0700 Subject: [PATCH] Explicitly set xarray coordinates. --- .../ecephys/stimulus_analysis/receptive_field_mapping.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/allensdk/brain_observatory/ecephys/stimulus_analysis/receptive_field_mapping.py b/allensdk/brain_observatory/ecephys/stimulus_analysis/receptive_field_mapping.py index 74e75cabd..57ab351d6 100644 --- a/allensdk/brain_observatory/ecephys/stimulus_analysis/receptive_field_mapping.py +++ b/allensdk/brain_observatory/ecephys/stimulus_analysis/receptive_field_mapping.py @@ -284,8 +284,12 @@ def _response_by_stimulus_position( dataset[spike_count_key] = dataset.sum(dim=time_key) dataset = dataset.drop(time_key) - dataset[row_key] = presentations.loc[:, row_key] - dataset[column_key] = presentations.loc[:, column_key] + dataset = dataset.assign_coords( + {row_key: ("stimulus_presentation_id", + presentations.loc[:, row_key].to_numpy())}) + dataset = dataset.assign_coords( + {column_key: ("stimulus_presentation_id", + presentations.loc[:, column_key].to_numpy())}) dataset = dataset.to_dataframe() dataset = (