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

The shape of a dataset is not preserved when a run is exported to another database #3953

Closed
simonzihlmann opened this issue Feb 22, 2022 · 1 comment · Fixed by #3956
Closed

Comments

@simonzihlmann
Copy link
Contributor

As the title says, the shape of a dataset is not preserved when it is exported from one database to another one. See below for more details.

Steps to reproduce

  1. generate a dummy dataset
initialise_or_create_database_at("./source.db")
# Setting up a doNd measurement
sweep_1 = LinSweep(dac.ch1, -1, 1, 20, 0.01)
sweep_2 = LinSweep(dac.ch2, -1, 1, 20, 0.01)
dond(
    sweep_1,                          # 1st independent parameter
    sweep_2,                          # 2nd independent parameter
    dmm.v1,                           # 1st dependent parameter
    dmm.v2,                           # 2nd dependent parameter
    measurement_name="dond_example",  # Set the measurement name
    exp=tutorial_exp,                 # Set the experiment to save data to.
    show_progress=True                # Optional progress bar
)
ds_source = load_by_run_spec(experiment_name='tutorial_exp', captured_run_id=1)
ds_source.get_parameter_data('dmm_v1')['dmm_v1']['dmm_v1'].shape
  1. Extract it to another database
from qcodes.dataset.sqlite.database import connect
source_path = os.path.join(os.getcwd(), './source.db')
target_path = os.path.join(os.getcwd(), './target.db')
source_conn = connect(source_path)
target_conn = connect(target_path)
extract_runs_into_db(source_path, target_path, 1)
  1. load it from the new database
initialise_or_create_database_at("./target.db")
ds_target = load_by_run_spec(experiment_name='tutorial_exp', captured_run_id=1)
ds_target.get_parameter_data('dmm_v1')['dmm_v1']['dmm_v1'].shape

Expected behaviour

ds_source.get_parameter_data('dmm_v1')['dmm_v1']['dmm_v1'].shape and ds_target.get_parameter_data('dmm_v1')['dmm_v1']['dmm_v1'].shape should return in both cases (20, 20)

Actual behaviour

ds_source.get_parameter_data('dmm_v1')['dmm_v1']['dmm_v1'].shape returns (20, 20)
ds_target.get_parameter_data('dmm_v1')['dmm_v1']['dmm_v1'].shape returns (400,)

It would be nice if the shape would be preserved as it facilitates further data processing.

System

operating system
Win10

If you are using a released version of qcodes (recommended):
0.32.0

@simonzihlmann
Copy link
Contributor Author

@jenshnielsen thanks for this rapid fix.

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