Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix data_set.py: flatten 2D arrays #6573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GOTYGuyOfTheYear
Copy link

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 saved alongside the data.
@GOTYGuyOfTheYear GOTYGuyOfTheYear requested a review from a team as a code owner October 29, 2024 13:16
@jenshnielsen
Copy link
Collaborator

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?

Copy link

codecov bot commented Nov 1, 2024

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 ⚠️
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           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GOTYGuyOfTheYear
Copy link
Author

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:
image

In the sqlite db, the fields for the independent parameter are filled with a blob type:
image

There might be a better fix or a better way of working, this is just how I have found as the simplest option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants