Commit cc01212a authored by Kelvin Loh's avatar Kelvin Loh 🖖
Browse files

Merge branch 'bugfix_waveform_csv_zhinst' into 'develop'

Fixes a bug when the waveform uploaded via csv needs floats instead.

See merge request !174
parents f6a456ff e2f8e17d
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -173,6 +173,13 @@ class ZISettings:
                waveform_data = np.reshape(
                    setting.value, (len(setting.value) // columns, -1)
                )
                ############################################################
                # FIXME WARNING: For saving waveform in csv format, the data
                # MUST be in floating point type, and NOT int16 (as is required)
                # when using the Zhinst-toolkit.helpers.Waveform class.
                # Hotfix applied to rescale.
                ############################################################
                waveform_data = waveform_data / (2 ** 15 - 1)
                np.savetxt(file_path, waveform_data, delimiter=";")

                setting.value = str(file_path)
+4 −1
Original line number Diff line number Diff line
@@ -137,7 +137,10 @@ def test_zi_settings_serialize_wave(mocker):
    assert np_savetext.call_args_list == calls

    args, _ = np_savetext.call_args
    np.testing.assert_array_equal(args[1], np.reshape(wave, (24, -1)))
    csv_bug_scale_factor = 2 ** 15 - 1  # See issue quantify-scheduler#175
    np.testing.assert_array_equal(
        args[1], np.reshape(wave / csv_bug_scale_factor, (24, -1))
    )

    touch.assert_called()