Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def logCallback(self, index):
logging.debug('index %s'% str(index))
self.__debug['last']=index
pp=index.parent()
row=index.row()
tag=pp.child(row,2).data()
# load data
if tag is not None:
if self.verbose:
print('logCallback! tag %s' % tag)
try:
logging.debug('load tag %s' % tag)
data=qc.load_data(tag)
self.qplot.clear();
self.qplot.add(data.amplitude);
except Exception as e:
logging.info('logCallback! error ...' )
logging.warning(e)
pass
pass
def get_dataset(ds):
""" Get a dataset from a results dict, a string or a dataset
Args:
ds (dict, str or qcodes.DataSet): the data to be put in the dataset
Returns:
ds (qcodes.DataSet) dataset made from the input data
"""
if isinstance(ds, dict):
ds = ds.get('dataset', None)
if ds is None:
return None
if isinstance(ds, str):
ds = qcodes.load_data(ds)
return ds
def loadDataset(path):
""" Wrapper function
:param path: filename without extension
:returns dateset, metadata:
"""
dataset = qcodes.load_data(path)
mfile = os.path.join(path, 'qtt-metadata')
metadata = load_data(mfile)
return dataset, metadata
from qcodes.data.gnuplot_format import GNUPlotFormat
formatters += [GNUPlotFormat()]
data = None
if location.endswith('.json'):
dataset_dictionary = qtt.utilities.json_serializer.load_json(location)
data = qtt.data.dictionary_to_dataset(dataset_dictionary)
else:
# assume we have a QCoDeS dataset
for ii, hformatter in enumerate(formatters):
try:
if verbose:
print('%d: %s' % (ii, hformatter))
data = qcodes.load_data(location, formatter=hformatter, io=io)
if len(data.arrays) == 0:
data = None
raise Exception('empty dataset, probably a HDF5 format misread by GNUPlotFormat')
logging.debug('load_data: loaded %s with %s' % (location, hformatter))
except Exception as ex:
logging.info('load_data: location %s: failed for formatter %d: %s' % (location, ii, hformatter))
if verbose:
print(ex)
finally:
if data is not None:
if isinstance(hformatter, GNUPlotFormat):
# workaround for bug in GNUPlotFormat not saving the units
if '__dataset_metadata' in data.metadata:
dataset_meta = data.metadata['__dataset_metadata']
for key, array_metadata in dataset_meta['arrays'].items():
if key in data.arrays: