Skip to content
Snippets Groups Projects
Commit d8981638 authored by Stephan Philips's avatar Stephan Philips
Browse files

addin snapshot automatically

parent 25a4bee7
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ from core_tools.data.ds.data_set_raw import data_set_raw, m_param_raw
from core_tools.data.SQL.buffer_writer import buffer_reader
from core_tools.data.SQL.connector import sample_info
from uuid import getnode as get_mac
from psycopg2.extras import Json
import time
import json
......@@ -115,9 +116,9 @@ class write_query_generator:
measurement_table_name (str) : name of the table that contains the raw measurement data
start_time (long) : time in unix seconds since the epoch
stop_time (long) : time in unix seconds since the epoch
metadata (JSON) : json string to be saved in the database
snapshot (JSON) : snapshot of the exprimental set up
tags (JSON) : list of tags that accompuarby the measurment if any
metadata (dict) : json string to be saved in the database
snapshot (dict) : snapshot of the exprimental set up
tags (dict) : list of tags that accompuarby the measurment if any
completed (bool) : tell that the measurement is completed.
Not used atm:
......@@ -133,11 +134,11 @@ class write_query_generator:
if stop_time is not None:
statement += "UPDATE {} SET stop_time = to_timestamp('{}') WHERE uuid = {};".format(table_name, stop_time, meas_uuid)
if metadata is not None:
statement += "UPDATE {} SET metadata = '{}' WHERE uuid = {};".format(table_name, metadata, meas_uuid)
statement += "UPDATE {} SET metadata = {} WHERE uuid = {};".format(table_name, Json(metadata), meas_uuid)
if snapshot is not None:
statement += "UPDATE {} SET snapshot = '{}' WHERE uuid = {};".format(table_name, snapshot, meas_uuid)
statement += "UPDATE {} SET snapshot = {} WHERE uuid = {};".format(table_name, Json(snapshot), meas_uuid)
if tags is not None:
statement += "UPDATE {} SET tags = '{}' WHERE uuid = {};".format(table_name, tags, meas_uuid)
statement += "UPDATE {} SET tags = {} WHERE uuid = {};".format(table_name, Json(tags), meas_uuid)
if completed is not None:
statement += "UPDATE {} SET completed = '{}' WHERE uuid = {};".format(table_name, completed, meas_uuid)
......
......@@ -60,7 +60,7 @@ class SQL_database_manager(SQL_database_init):
ds.exp_uuid = exp_uuid
ds.running = True
ds.SQL_datatable = "_" + sample_info.set_up + "_" +sample_info.project + "_" +sample_info.sample +"_" + str(exp_uuid)
ds.SQL_datatable = ds.SQL_datatable.replace(" ", "_")
ds.SQL_datatable = ds.SQL_datatable.replace(" ", "_").replace('-', '_')
# todo -- add tags to the measurements
cur.execute(write_query_generator.fill_meas_info_in_measurement_table(
ds.exp_uuid,ds.SQL_datatable,
......
from core_tools.data.ds.data_set_core import data_set_raw, data_set
from core_tools.data.SQL.SQL_database_mgr import SQL_database_manager
import json
import qcodes as qc
def load_by_id(exp_id):
......@@ -32,7 +34,9 @@ def create_new_data_set(experiment_name, *m_params):
ds = data_set_raw(exp_name=experiment_name)
if qc.Station.default is not None:
ds.snapshot = qc.Station.default.snapshot()
snapshot = qc.Station.default.snapshot()
snapshot_json = json.dumps({'station': snapshot}, cls=qc.utils.helpers.NumpyJSONEncoder)
ds.snapshot = json.loads(snapshot_json)
# intialize the buffers for the measurement
for m_param in m_params:
......
......@@ -217,7 +217,10 @@ class data_browser(data_browser_autogen.Ui_MainWindow):
self.search_table_data_model.overwrite_data(data)
if __name__ == '__main__':
from core_tools.data.SQL.connector import SQL_conn_info_local, SQL_conn_info_remote, sample_info, set_up_local_storage
set_up_local_storage('stephan', 'magicc', 'test', 'Intel Project', 'F006', 'SQ38328342')
db = data_browser()
# from core_tools.data.SQL.connector import SQL_conn_info_local, SQL_conn_info_remote, sample_info, set_up_local_storage
# set_up_local_storage('stephan', 'magicc', 'test', 'Intel Project', 'F006', 'SQ38328342')
# db = data_browser()
from core_tools.data.SQL.connector import set_up_local_storage
set_up_local_storage("xld_user", "XLDspin001", "vandersypen_data", "6dot", "XLD", "6D3S - SQ20-20-5-18-4")
db = data_browser()
\ No newline at end of file
......@@ -149,7 +149,7 @@ if __name__ == '__main__':
from core_tools.data.SQL.connector import set_up_local_storage
set_up_local_storage('stephan', 'magicc', 'test', 'Intel Project', 'F006', 'SQ38328342')
set_up_local_storage("xld_user", "XLDspin001", "vandersypen_data", "6dot", "XLD", "6D3S - SQ20-20-5-18-4")
class MyCounter(qc.Parameter):
def __init__(self, name):
# only name is required
......@@ -194,8 +194,8 @@ if __name__ == '__main__':
d = dummy_multi_parameter_2dawg("name2")
m1 = MyCounter('name3')
m2 = dummy_multi_parameter_2dawg("name4")
m3 = construct_2D_scan_fast('P2', 10, 10, 'P5', 10, 10,50000, True, None, dig)
m4 = construct_1D_scan_fast("P2", 10,10,5000, True, None, dig)
# m3 = construct_2D_scan_fast('P2', 10, 10, 'P5', 10, 10,50000, True, None, dig)
# m4 = construct_1D_scan_fast("P2", 10,10,5000, True, None, dig)
x = 100
y = 100
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment