Commit f47c8402 authored by Christian Schneider's avatar Christian Schneider
Browse files

Adapted other modules to data_table structure

parent 90126cde
......@@ -159,7 +159,7 @@ class data_complex(data_table):
return self.get_phase()
def get_phase(self, unit='deg', unwrap=True):
"""This function returns a data_line module with the selected data of
"""This function returns a data_table module with the selected data of
this data module converted in amplitude (dB). Data Module parameters
are copied as well.
......
......@@ -173,7 +173,7 @@ class data_grid(data_module_base):
Returns
--------
DataModule
data_line module
data_table module
"""
x, y = self.df.dims[:2]
ex = self.df.sel(x=x0, method='nearest')
......@@ -209,7 +209,7 @@ class data_grid(data_module_base):
Returns
--------
DataModule
data_line module
data_table module
"""
x, y = self.df.dims[:2]
ex = self.df.sel(y=y0, method='nearest')
......@@ -410,7 +410,7 @@ class data_grid(data_module_base):
Returns
--------
DataModule
A `data_line` DataModule. Values depend on argument keyword (see
A `data_table` DataModule. Values depend on argument keyword (see
above)
"""
if nnB == 1:
......@@ -465,7 +465,7 @@ class data_grid(data_module_base):
Returns
--------
DataModule
A `data_line` DataModule. Values depend on argument keyword (see
A `data_table` DataModule. Values depend on argument keyword (see
above)
"""
if nnB == 1:
......@@ -522,7 +522,7 @@ class data_grid(data_module_base):
Returns
--------
DataModule
A `data_line` DataModule. Values depend on argument keyword (see
A `data_table` DataModule. Values depend on argument keyword (see
above)
"""
tmp = np.zeros_like(self.y)
......@@ -598,7 +598,7 @@ class data_grid(data_module_base):
Returns
--------
DataModule
A `data_line` DataModule. Values depend on argument keyword (see
A `data_table` DataModule. Values depend on argument keyword (see
above)
"""
tmp = np.zeros_like(self.y)
......
......@@ -176,7 +176,7 @@ class data_table(data_module_base):
self.df[order_names[i]][df_idx] = data_arrays[i][idx]
else:
self.df = self.df.append({key: value[idx] for key, value
in zip(order_names, data_arrays)},
in zip(order_names, data_arrays)},
ignore_index=True)
pass
......@@ -341,23 +341,28 @@ class data_table(data_module_base):
legend = ""
# Plot Data
for kw in style:
if kw == '-':
fig.line(x * xscale, y * yscale, line_color=c,
line_width=linewidth, legend=legend, **kwargs)
elif kw == 'o':
fig.circle(x, y, fill_color=c, line_color=c,
size=markersize, legend=legend, **kwargs)
if ("{} Errors".format(self.name_y) in self.df.keys() and
plot_errors):
err_xs = []
err_ys = []
errs = self.df[self.name_y + ' Errors'][
self.idx_min:self.idx_max]
for xs, ys, yerr in zip(x, y, errs):
err_xs.append((xs, xs))
err_ys.append((ys - yerr, ys+ yerr))
fig.multi_line(err_xs, err_ys, color=c)
if ("{} Errors".format(self.name_y) in self.df.keys() and
plot_errors):
# Just plot dots if error bars given
fig.circle(x, y, fill_color=c, line_color=c,
size=markersize, legend=legend, **kwargs)
err_xs = []
err_ys = []
errs = self.df[self.name_y + ' Errors'][
self.idx_min:self.idx_max]
for xs, ys, yerr in zip(x, y, errs):
err_xs.append((xs, xs))
err_ys.append((ys - yerr, ys + yerr))
fig.multi_line(err_xs, err_ys, color=c)
else:
for kw in style:
if kw == '-':
fig.line(x * xscale, y * yscale, line_color=c,
line_width=linewidth, legend=legend, **kwargs)
elif kw == 'o':
fig.circle(x, y, fill_color=c, line_color=c,
size=markersize, legend=legend, **kwargs)
# Plot Fit
if plot_fit and self._fit_executed:
......@@ -367,7 +372,7 @@ class data_table(data_module_base):
else:
fc = fitcolor
# Plot fit
fig.line(x*xscale, fitfunc(x, *self._fit_parameters)*yscale,
fig.line(x * xscale, fitfunc(x, *self._fit_parameters) * yscale,
line_color=fc, line_width=fit_linewidth)
# Format nicer HoverTool
......@@ -521,8 +526,9 @@ class data_table(data_module_base):
self._fit_parameters = fit_p_fit
self._fit_par_errors = np.sqrt(np.diag(err))
# Chi squared
self._fit_data_error = (np.sum((fitfunc(xsel, *fit_p_fit) - ysel) ** 2) /
(len(xsel) - 2))
self._fit_data_error = (
np.sum((fitfunc(xsel, *fit_p_fit) - ysel) ** 2) /
(len(xsel) - 2))
self._fit_labels = labels
if plot_params:
......
......@@ -998,7 +998,7 @@ class IQCalAM(object):
# Completing the measurement
x, y = self._SpecAna.Read()
tmp = dm.data_line(x/1e9, y)
tmp = dm.data_table([x/1e9, y], ['Frequency (GHz)', 'PSD (dB)'])
# Obtain the data for the LSB, carrier and RSB
tmp.select([LSB - peaks_span, LSB + peaks_span])
......
......@@ -975,7 +975,7 @@ class IQCalAM(object):
# Completing the measurement
x, y = self._SpecAna.Read()
tmp = dm.data_line(x/1e9, y)
tmp = dm.data_table([x/1e9, y], ['Frequency (GHz)', 'PSD (dB)'])
# Obtain the data for the LSB, carrier and RSB
tmp.select([LSB - peaks_span, LSB + peaks_span])
......
......@@ -88,7 +88,7 @@ class SA(object):
def meas(self, f1, f2, filename, avgs=1, bw_res='auto',
points=32001, center=False, sweep_time='auto',
**dm_parameters):
"""Take a spectrum and save it as a data_line datamodule
"""Take a spectrum and save it as a data_table datamodule
Parameters
-----------
......
......@@ -80,7 +80,7 @@ class VNA(object):
# parameters={}, power_port2=False):
# """VNA Measurement
#
# Automatically save as data_line datamodule if not specified
# Automatically save as data_table datamodule if not specified
# otherwise (autoSave=False).
#
# Parameters
......
......@@ -420,7 +420,7 @@
"metadata": {},
"outputs": [],
"source": [
"data_e = dm.data_line(sweep[:-1],measurement_ph[:-1])"
"data_e = dm.data_table([sweep[:-1],measurement_ph[:-1]])"
]
},
{
......
......@@ -1883,7 +1883,7 @@ class Qubexp(object):
#----------------------------------------------------------------------------------------------- q07 Utilities functions
def create_dm_before(self,Temp_reading=True):
data = dm.data_line()
data = dm.data_table()
if Temp_reading is True:
sr = SensorReader(self.CryoID)
......@@ -1897,7 +1897,7 @@ class Qubexp(object):
def create_dm_after(self,data,x,y,Temp_reading=True):
if data is None:
data = dm.data_line()
data = dm.data_table()
if Temp_reading is True:
sr = SensorReader(self.CryoID)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment