Skip to content

Commit 724add7

Browse files
authored
Merge pull request #7546 from jenshnielsen/disable_new_export
Disable new export for now
2 parents cc4aa29 + e547568 commit 724add7

File tree

5 files changed

+93
-74
lines changed

5 files changed

+93
-74
lines changed

docs/changes/0.54.1.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
QCoDeS 0.54.0 (2025-10-02)
2+
==========================
3+
4+
New:
5+
----
6+
7+
- Exporting of data using xarray directly bypassing Pandas introduced in 0.54.0 has been temporarily disabled
8+
due to changes in output format with parameters measured in decreasing order. This will be revisited in a future release. (:pr:`7546`)

docs/changes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelogs
33

44
.. toctree::
55
Unreleased <unreleased>
6+
0.54.1 <0.54.1>
67
0.54.0 <0.54.0>
78
0.53.0 <0.53.0>
89
0.52.0 <0.52.0>

src/qcodes/dataset/exporters/export_to_xarray.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ def _load_to_xarray_dataset_dict_no_metadata(
8383
and sub_dict[name].shape == dataset.description.shapes[name]
8484
)
8585

86-
if shape_is_consistent and use_multi_index != "always":
86+
if shape_is_consistent and use_multi_index != "always" and False:
87+
# disabled for now to think about how to best handle
88+
# parameters that are measured in decreasing order
89+
# where this export is inverted compared to the original export order
8790
_LOG.info("Exporting %s to xarray using direct method", name)
8891
xr_dataset_dict[name] = _xarray_data_set_direct(dataset, name, sub_dict)
8992
else:

tests/dataset/measurement/test_inferred_parameters_fix.py

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -308,53 +308,54 @@ def test_inferred_parameters_in_actual_measurement_2d(
308308
)
309309

310310
# xarray export
311-
caplog.clear()
312-
with caplog.at_level("INFO"):
313-
xarr = dataset.to_xarray_dataset()
314-
315-
assert len(caplog.records) == 1
316-
if set_shape:
317-
assert (
318-
caplog.records[0].message
319-
== "Exporting meas_parameter to xarray using direct method"
320-
)
321-
else:
322-
assert (
323-
caplog.records[0].message
324-
== "Exporting meas_parameter to xarray via pandas index"
325-
)
326-
327-
assert "meas_parameter" in xarr.data_vars
328-
329-
assert "del_param_1" in xarr.coords
330-
assert xarr.coords["del_param_1"].shape == (num_points_x,)
331-
assert xarr.coords["del_param_1"].dims == ("del_param_1",)
332-
333-
assert "del_param_2" in xarr.coords
334-
assert xarr.coords["del_param_2"].shape == (num_points_y,)
335-
assert xarr.coords["del_param_2"].dims == ("del_param_2",)
336-
337-
if set_shape:
338-
assert "dummy_dac_ch1" in xarr.coords
339-
assert xarr.coords["dummy_dac_ch1"].shape == (num_points_x,)
340-
assert xarr.coords["dummy_dac_ch1"].dims == ("del_param_1",)
341-
342-
assert "dummy_dac_ch2" in xarr.coords
343-
assert xarr.coords["dummy_dac_ch2"].shape == (num_points_y,)
344-
assert xarr.coords["dummy_dac_ch2"].dims == ("del_param_2",)
345-
else:
346-
assert "dummy_dac_ch1" not in xarr.coords
347-
assert "dummy_dac_ch2" not in xarr.coords
348-
assert xarr["meas_parameter"].dims == ("del_param_1", "del_param_2")
349-
assert xarr["meas_parameter"].shape == (num_points_x, num_points_y)
350-
351-
# pandas export
352-
df = dataset.to_pandas_dataframe()
353-
assert "meas_parameter" in df.columns
354-
assert df.index.names == ["del_param_1", "del_param_2"]
355-
assert "dummy_dac_ch1" not in df.columns
356-
assert "dummy_dac_ch2" not in df.columns
357-
assert len(df) == total_points
311+
# disabled until we renable new export
312+
# caplog.clear()
313+
# with caplog.at_level("INFO"):
314+
# xarr = dataset.to_xarray_dataset()
315+
316+
# assert len(caplog.records) == 1
317+
# if set_shape:
318+
# assert (
319+
# caplog.records[0].message
320+
# == "Exporting meas_parameter to xarray using direct method"
321+
# )
322+
# else:
323+
# assert (
324+
# caplog.records[0].message
325+
# == "Exporting meas_parameter to xarray via pandas index"
326+
# )
327+
328+
# assert "meas_parameter" in xarr.data_vars
329+
330+
# assert "del_param_1" in xarr.coords
331+
# assert xarr.coords["del_param_1"].shape == (num_points_x,)
332+
# assert xarr.coords["del_param_1"].dims == ("del_param_1",)
333+
334+
# assert "del_param_2" in xarr.coords
335+
# assert xarr.coords["del_param_2"].shape == (num_points_y,)
336+
# assert xarr.coords["del_param_2"].dims == ("del_param_2",)
337+
338+
# if set_shape:
339+
# assert "dummy_dac_ch1" in xarr.coords
340+
# assert xarr.coords["dummy_dac_ch1"].shape == (num_points_x,)
341+
# assert xarr.coords["dummy_dac_ch1"].dims == ("del_param_1",)
342+
343+
# assert "dummy_dac_ch2" in xarr.coords
344+
# assert xarr.coords["dummy_dac_ch2"].shape == (num_points_y,)
345+
# assert xarr.coords["dummy_dac_ch2"].dims == ("del_param_2",)
346+
# else:
347+
# assert "dummy_dac_ch1" not in xarr.coords
348+
# assert "dummy_dac_ch2" not in xarr.coords
349+
# assert xarr["meas_parameter"].dims == ("del_param_1", "del_param_2")
350+
# assert xarr["meas_parameter"].shape == (num_points_x, num_points_y)
351+
352+
# # pandas export
353+
# df = dataset.to_pandas_dataframe()
354+
# assert "meas_parameter" in df.columns
355+
# assert df.index.names == ["del_param_1", "del_param_2"]
356+
# assert "dummy_dac_ch1" not in df.columns
357+
# assert "dummy_dac_ch2" not in df.columns
358+
# assert len(df) == total_points
358359

359360

360361
def test_multiple_dependent_parameters_no_cross_contamination(

tests/dataset/test_dataset_export.py

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,7 @@ def test_netcdf_export_with_mixed_timestamp_raw(
19231923
assert loaded_ds.completed_timestamp_raw is None
19241924

19251925

1926+
@pytest.mark.skip(reason="Disabled until we renable new export")
19261927
@given(data=hst.data())
19271928
@settings(
19281929
max_examples=10,
@@ -2113,10 +2114,11 @@ def test_measurement_2d_with_inferred_setpoint(
21132114
with caplog.at_level(logging.INFO):
21142115
xr_ds = ds.to_xarray_dataset()
21152116

2116-
assert any(
2117-
"Exporting signal to xarray using direct method" in record.message
2118-
for record in caplog.records
2119-
)
2117+
# disabled until we renable new export
2118+
# assert any(
2119+
# "Exporting signal to xarray using direct method" in record.message
2120+
# for record in caplog.records
2121+
# )
21202122

21212123
# Sizes and coords
21222124
assert xr_ds.sizes == {"x": nx, "y": ny}
@@ -2128,15 +2130,16 @@ def test_measurement_2d_with_inferred_setpoint(
21282130
expected_signal = x_vals[:, None] + 3.0 * y_vals[None, :]
21292131
np.testing.assert_allclose(xr_ds["signal"].values, expected_signal)
21302132

2131-
# Inferred coords for y_b0 and y_b1 exist with dims only along y
2132-
for name, vals in ("y_b0", y_b0_vals), ("y_b1", y_b1_vals):
2133-
assert name in xr_ds.coords
2134-
assert xr_ds.coords[name].dims == ("y",)
2135-
np.testing.assert_allclose(xr_ds.coords[name].values, vals)
2136-
# Indexes of inferred coords should correspond to the y axis index
2137-
inf_idx = xr_ds.coords[name].indexes
2138-
assert set(inf_idx.keys()) == {"y"}
2139-
assert inf_idx["y"].equals(xr_ds.indexes["y"])
2133+
# disabled until we renable new export
2134+
# # Inferred coords for y_b0 and y_b1 exist with dims only along y
2135+
# for name, vals in ("y_b0", y_b0_vals), ("y_b1", y_b1_vals):
2136+
# assert name in xr_ds.coords
2137+
# assert xr_ds.coords[name].dims == ("y",)
2138+
# np.testing.assert_allclose(xr_ds.coords[name].values, vals)
2139+
# # Indexes of inferred coords should correspond to the y axis index
2140+
# inf_idx = xr_ds.coords[name].indexes
2141+
# assert set(inf_idx.keys()) == {"y"}
2142+
# assert inf_idx["y"].equals(xr_ds.indexes["y"])
21402143

21412144

21422145
def test_measurement_2d_with_inferred_setpoint_from_setpoint(
@@ -2178,10 +2181,11 @@ def test_measurement_2d_with_inferred_setpoint_from_setpoint(
21782181
with caplog.at_level(logging.INFO):
21792182
xr_ds = ds.to_xarray_dataset()
21802183

2181-
assert any(
2182-
"Exporting signal to xarray using direct method" in record.message
2183-
for record in caplog.records
2184-
)
2184+
# disabled until we renable new export
2185+
# assert any(
2186+
# "Exporting signal to xarray using direct method" in record.message
2187+
# for record in caplog.records
2188+
# )
21852189

21862190
# Sizes and coords
21872191
assert xr_ds.sizes == {"x": nx, "y": ny}
@@ -2236,22 +2240,24 @@ def test_measurement_2d_top_level_inferred_is_data_var(
22362240
xr_ds = ds.to_xarray_dataset()
22372241

22382242
# Direct path log should be present
2239-
assert any(
2240-
"Exporting signal to xarray using direct method" in record.message
2241-
for record in caplog.records
2242-
)
2243+
# disabled until we renable new export
2244+
# assert any(
2245+
# "Exporting signal to xarray using direct method" in record.message
2246+
# for record in caplog.records
2247+
# )
22432248

22442249
# The derived param should be a data variable with dims (x, y), not a coord
2245-
assert "derived" in xr_ds.data_vars
2246-
assert "derived" not in xr_ds.coords
2247-
assert xr_ds["derived"].dims == ("x", "y")
2250+
# assert "derived" in xr_ds.data_vars
2251+
# assert "derived" not in xr_ds.coords
2252+
# assert xr_ds["derived"].dims == ("x", "y")
22482253

22492254
expected_signal = x_vals[:, None] + y_vals[None, :]
2250-
expected_derived = 2.0 * expected_signal
2255+
# expected_derived = 2.0 * expected_signal
22512256
np.testing.assert_allclose(xr_ds["signal"].values, expected_signal)
2252-
np.testing.assert_allclose(xr_ds["derived"].values, expected_derived)
2257+
# np.testing.assert_allclose(xr_ds["derived"].values, expected_derived)
22532258

22542259

2260+
@pytest.mark.skip(reason="Disabled until we renable new export")
22552261
def test_with_without_shape_is_the_same(experiment: Experiment) -> None:
22562262
nx, ny = 2, 3
22572263
x_vals = np.linspace(0.0, -1.0, nx)

0 commit comments

Comments
 (0)