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

Add conversion between qcodes legacy DataSet and xarray format #2938

Merged
merged 9 commits into from
Apr 21, 2021

Conversation

peendebak
Copy link
Contributor

@peendebak peendebak commented Apr 17, 2021

Changes proposed in this pull request:

  • Add conversion methods between the QCoDeS legacy dataset and xarray Dataset

A minimal example:

from qcodes.tests.legacy.data_mocks import DataSet1D, DataSet2D
qd = DataSet1D()
xds = qd.to_xarray()  
print(xds)
qds = DataSet.from_xarray(xds)

@jenshnielsen The goal of this PR is to allow conversion between the easy cases (e.g. 1D, 2D). Since the two datasets have slightly different formats, we do not cover all cases. Can you comment on whether this functionality can be added to qcodes and if the structure of the PR is good?

@codecov
Copy link

codecov bot commented Apr 17, 2021

Codecov Report

Merging #2938 (12fa5a7) into master (be6ed96) will increase coverage by 0.10%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2938      +/-   ##
==========================================
+ Coverage   65.31%   65.41%   +0.10%     
==========================================
  Files         209      209              
  Lines       28037    28122      +85     
==========================================
+ Hits        18312    18397      +85     
  Misses       9725     9725              

@jenshnielsen jenshnielsen changed the title [RFC] Add conversion between qcodes DataSet and xarray format [RFC] Add conversion between qcodes legacy DataSet and xarray format Apr 19, 2021
@jenshnielsen
Copy link
Collaborator

@peendebak Thanks, I will have a look. Happy to merge this to QCoDeS. I have edited the description to clarify that this is about the legacy data.dataset and not the current QCoDeS dataset.

@jenshnielsen jenshnielsen added this to the 0.25.0 milestone Apr 20, 2021
Copy link
Contributor

@astafan8 astafan8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peendebak thanks for the contribution (and the typing, and the tests)! if this helps for the users of the legacy DataSet, let's get it in :)

qcodes/data/data_array.py Outdated Show resolved Hide resolved
@peendebak
Copy link
Contributor Author

@astafan8 I addressed the comments, and added some more tests. The build seems to be failing due to a general error.

@astafan8
Copy link
Contributor

The build seems to be failing due to a general error.

@peendebak what do you mean with "general error"? the error here https://github.com/QCoDeS/Qcodes/pull/2938/checks?check_run_id=2399670141 seems to be a typo in the assert method call:

>       self.asserEqual(qd.default_parameter_array().shape, xarray_dataset.tmin.shape)
E       AttributeError: 'TestDataSet' object has no attribute 'asserEqual'

it should be assertEqual, with "t" :)

@peendebak peendebak changed the title [RFC] Add conversion between qcodes legacy DataSet and xarray format Add conversion between qcodes legacy DataSet and xarray format Apr 21, 2021
@jenshnielsen jenshnielsen merged commit 4ced049 into microsoft:master Apr 21, 2021
@peendebak peendebak deleted the feature/xarray_conversion branch December 4, 2021 20:53
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.

None yet

4 participants