This page was generated from docs/examples/DataSet/import-data-from-legacy-dat-files.ipynb. Interactive online version: Binder badge.

Importing data from legacy .dat files

This notebook shows you how you can import data from a legacy dataset generated with the old qcodes.data dataset. These are typically generated with qcodes.loops.Loop or qcodes.measure.Measure.

[1]:
%matplotlib inline
from pathlib import Path

from qcodes.dataset import (
    import_dat_file,
    initialise_or_create_database_at,
    load_or_create_experiment,
    plot_by_id,
)
Logging hadn't been started.
Activating auto-logging. Current session state plus future input saved.
Filename       : /home/runner/.qcodes/logs/command_history.log
Mode           : append
Output logging : True
Raw input log  : False
Timestamping   : True
State          : active
Qcodes Logfile : /home/runner/.qcodes/logs/240619-19182-qcodes.log
[2]:
# in case it was not there already
initialise_or_create_database_at(Path.cwd() / "import_data.db")
# put the old data in a new experiment
exp = load_or_create_experiment('old_data_loading', sample_name='no_sample')
[3]:
location2d = './data_2018_01_17/data_002_2D_test_15_43_14'
location1d = './data_2018_01_17/data_001_testsweep_15_42_57'
[4]:
run_ids = import_dat_file(location1d, exp=exp)
axs, cbaxs = plot_by_id(run_ids[0])
Starting experimental run with id: 1.
../../_images/examples_DataSet_import-data-from-legacy-dat-files_5_1.png
[5]:
run_ids = import_dat_file(location2d, exp=exp)
axs, cbaxs = plot_by_id(run_ids[0])
Starting experimental run with id: 2.
../../_images/examples_DataSet_import-data-from-legacy-dat-files_6_1.png
[ ]: