Skip to content

Commit 67b4087

Browse files
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 9004797 commit 67b4087

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Fixed :meth:`qcodes.dataset.DataSet.to_xarray_dataset` raising an
2-
``AlignmentError`` when two data variables do not share the same setpoints
3-
and one of them is stored as a non-grid (multi-index) array parameter.
2+
``AlignmentError`` when two data variables do not share the same full set of
3+
setpoints and one of them is stored as a non-grid (multi-index) array parameter.

src/qcodes/dataset/exporters/export_to_xarray.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,10 @@ def load_to_xarray_dataset(
357357
dataset, data, use_multi_index=use_multi_index
358358
)
359359

360-
# When two data variables do not share the same setpoints, one may be
360+
# When two data variables do not share the same full set of setpoints, one may be
361361
# exported using a pandas MultiIndex (non-grid data) while another uses a
362-
# standalone dimension for a shared setpoint coordinate. xr.merge raises
363-
# an AlignmentError in that case because the same coordinate name has
364-
# different Index objects in the two sub-datasets. Resolve this by
362+
# standalone dimension for a shared setpoint coordinate. xr.merge raises
363+
# an AlignmentError in that case because the shared coordinate name has
365364
# unstacking the multi_index into proper independent dimensions (accepting
366365
# NaN for missing grid points) so that the shared coordinate becomes a
367366
# plain 1-D dimension in all sub-datasets.

tests/dataset/test_dataset_export.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,11 +2334,11 @@ def test_export_to_xarray_dataset_different_setpoints(
23342334
"""
23352335
Regression test for https://github.com/microsoft/Qcodes/issues/8232
23362336
2337-
Export to xarray should succeed when two data variables do not share the
2338-
same setpoints. Specifically, this covers the case where one parameter is
2337+
Export to xarray should succeed when two data variables do not share the same
2338+
full set of setpoints. Specifically, this covers the case where one parameter is
23392339
an array-type with setpoints (f_stop, freq) that are NOT on a regular grid
23402340
(so the multi_index path is used), while a second parameter has only the
2341-
scalar setpoint (f_stop,). Previously this raised an AlignmentError
2341+
scalar setpoint (f_stop,). Previously this raised an AlignmentError
23422342
because xr.merge could not reconcile the different Index objects for the
23432343
shared 'f_stop' coordinate.
23442344
"""

0 commit comments

Comments
 (0)