Hotfix data_set.py: flatten 2D arrays
When adding a 2D array as a standalone parameter in a dataset, the whole numpy array would be save in bit form. Flatten is needed to make a proper array to be saved alongside the data.
When adding a 2D array as a standalone parameter in a dataset, the whole numpy array would be save in bit form. Flatten is needed to make a proper array to be saved alongside the data.
I am not sure that I follow what the issue is. When a user stores an array of a given shape I would imagine that they would also expect this to be read back.
Could you perhaps supply an example or a test that shows the issue that you are facing?
Codecov Report
Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
Project coverage is 69.34%. Comparing base (
92e4d95) to head (8f4baa8). Report is 27 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/qcodes/dataset/data_set.py | 50.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #6573 +/- ##
=======================================
Coverage 69.34% 69.34%
=======================================
Files 340 340
Lines 31266 31266
=======================================
Hits 21681 21681
Misses 9585 9585
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hello @jenshnielsen,
Thank you for your interest.
The issue appears when value is a 2D numpy array.
I guess the python line : [{param.name: number} for number in value] interates through the columns of the array.
When we try to load the array and convert it to xarray again we get this error:
In the sqlite db, the fields for the independent parameter are filled with a blob type:
There might be a better fix or a better way of working, this is just how I have found as the simplest option.