Commit c5403c9d authored by 3Yan's avatar 3Yan
Browse files

Added time shift to DRL tools

* modified drl dataset layout to dict
* added time shift - modifies also the exported data
parent 8b35b91c
......@@ -75,7 +75,7 @@ def main():
name="Chromatogram", xlabel="time(min)",
ylabel="total ion count", timesarg=None)
filename = [None]
drlcache = [None, None, None]
drlcache = [None, None]
config = cf.settings()
......
......@@ -58,9 +58,9 @@ def update_profile(pt, row, dataset):
spectrum.figure.canvas.draw()
def get_intensity(row, ptable, dtable, ds):
startm = floatize(ptable, row, 1)
endm = floatize(ptable, row, 2)
def get_intensity(row, ds, drls):
startm = floatize(drls['pt'], row, 1)
endm = floatize(drls['pt'], row, 2)
massargs = dt.argsubselect(ds['masses'], startm, endm)
nonzero_tic = list(map(lambda x: max(x, 1), ds['chrom_dat'][1]))
intensity = (np.sum(
......@@ -68,50 +68,49 @@ def get_intensity(row, ptable, dtable, ds):
return intensity
def get_daughterset(ptable, dtable, ds):
def get_daughterset(ds, drls):
# TODO: write a less resources demanding function - probably "per-line"
names = []
times = ds['chrom_dat'][0, :]
times = ds['chrom_dat'][0, :] - drls['tshift'].value()
intensities = []
# TODO: resolve intensities trouble
for row in range(dtable.rowCount()):
if dtable.cellWidget(row, 0).checkState() == 2:
intensity = get_intensity(row, ptable, dtable, ds)
cor = dtable.cellWidget(row, 1).currentIndex() - 1
for row in range(drls['dt'].rowCount()):
if drls['dt'].cellWidget(row, 0).checkState() == 2:
intensity = get_intensity(row, ds, drls)
cor = drls['dt'].cellWidget(row, 1).currentIndex() - 1
if cor not in (-2, -1):
factor = floatize(dtable, row, 2)
correction = get_intensity(cor, ptable, dtable, ds)\
* factor
factor = floatize(drls['dt'], row, 2)
correction = get_intensity(cor, ds, drls) * factor
intensity = intensity - correction
intensities.append(intensity)
names.append("{} - {} * {}".format(
dtable.item(row, 0).text(),
dtable.item(row,2).text(),
dtable.cellWidget(row,1).currentText()))
drls['dt'].item(row, 0).text(),
drls['dt'].item(row,2).text(),
drls['dt'].cellWidget(row,1).currentText()))
return names, times, intensities
def get_parentset(ptable, dtable, ds):
def get_parentset(ds, drls):
names = []
times = ds['chrom_dat'][0, :]
intensities = []
# TODO: resolve intensities trouble
rowlist = []
for row in range(dtable.rowCount()):
if dtable.cellWidget(row, 0).checkState() == 2:
for row in range(drls['dt'].rowCount()):
if drls['dt'].cellWidget(row, 0).checkState() == 2:
rowlist.append(row)
if dtable.cellWidget(row, 1).currentIndex() > 0\
and floatize(dtable, row, 2) != 0:
if drls['dt'].cellWidget(row, 1).currentIndex() > 0\
and floatize(drls['dt'], row, 2) != 0:
rowlist.append(
dtable.cellWidget(row, 1).currentIndex()-1)
drls['dt'].cellWidget(row, 1).currentIndex()-1)
for row in set(rowlist):
intensity = get_intensity(row, ptable, dtable, ds)
intensity = get_intensity(row, ds, drls)
intensities.append(intensity)
names.append(dtable.item(row, 0).text())
names.append(drls['dt'].item(row, 0).text())
return names, times, intensities
def update_drlspectrum(ptable, dtable, ds, drlspectrum):
def update_drlspectrum(ds, drls, drlspectrum):
# Dont do anything when the dataset is not populated
if isinstance(ds['masses'], type(None)):
return
......@@ -121,23 +120,26 @@ def update_drlspectrum(ptable, dtable, ds, drlspectrum):
[0, 100, 255], [100, 100, 100]])
# TODO: write a less resources demanding function
names, times, intensities = get_daughterset(ptable, dtable, ds)
names, times, intensities = get_daughterset(ds, drls)
for i in range(len(drlspectrum.lines)):
drlspectrum.lines[0].remove()
drlspectrum.axvline(
drls['tshift'].value(), color="#FF000088", linestyle=":")
i = 0
for row in range(dtable.rowCount()):
if dtable.cellWidget(row, 0).checkState() == 2:
dtable.blockSignals(True)
dtable.item(row, 0).setBackground(QtGui.QBrush(
for row in range(drls['dt'].rowCount()):
if drls['dt'].cellWidget(row, 0).checkState() == 2:
drls['dt'].blockSignals(True)
drls['dt'].item(row, 0).setBackground(QtGui.QBrush(
QtGui.QColor(*colors[row % len(colors)], alpha=50)))
dtable.blockSignals(False)
label = " {}".format(ptable.item(row, 0).text())
drls['dt'].blockSignals(False)
label = " {}".format(drls['pt'].item(row, 0).text())
drlspectrum.plot(times, intensities[i], label=label,
color=(colors[row % len(colors)] / 255))
i += 1
else:
dtable.item(row, 0).setBackground(QtGui.QBrush())
drls['dt'].item(row, 0).setBackground(QtGui.QBrush())
if len(names) != 0:
drlspectrum.set_ylim(top=np.amax(intensities)*1.1,
......@@ -161,11 +163,11 @@ def gettableitemlist(ptable):
return ion_list
def update_corrfors(ptable, dtable):
def update_corrfors(drls):
"""update corrections selection layout of the daughter table"""
ionlist = gettableitemlist(ptable)
for row in range(dtable.rowCount()):
corfor = dtable.cellWidget(row, 1)
ionlist = gettableitemlist(drls['pt'])
for row in range(drls['dt'].rowCount()):
corfor = drls['dt'].cellWidget(row, 1)
index = corfor.currentIndex()
corfor.blockSignals(True)
corfor.clear()
......@@ -175,70 +177,70 @@ def update_corrfors(ptable, dtable):
corfor.blockSignals(False)
def ptable_changed(row, column, ptable, dtable, ds, drlspectrum):
def ptable_changed(row, column, ds, drls, drlspectrum):
"""routine called by change of the ptable spectra"""
update_corrfors(ptable, dtable)
dtable.item(row, 0).setText(gettableitemlist(ptable)[row])
update_corrfors(drls)
drls['dt'].item(row, 0).setText(gettableitemlist(drls['pt'])[row])
if column in (1, 2):
update_profile(ptable, row, ds)
update_profile(drls['pt'], row, ds)
def dtable_changed(row, column, ptable, dtable, ds, drlspectrum):
def dtable_changed(row, column, ds, drls, drlspectrum):
"""routine called by change of the dtable spectra"""
if dtable.cellWidget(row, 0).checkState() == 2:
if drls['dt'].cellWidget(row, 0).checkState() == 2:
if (column == 0)\
or (column == 2
and dtable.cellWidget(row, 1).currentIndex() != 0):
update_drlspectrum(ptable, dtable, ds, drlspectrum)
and drls['dt'].cellWidget(row, 1).currentIndex() != 0):
update_drlspectrum(ds, drls, drlspectrum)
def corr_changed(row, ptable, dtable, ds, drlspectrum):
def corr_changed(row, ds, drls, drlspectrum):
"""routine called by change of correction for ion"""
if (dtable.cellWidget(row, 0).checkState() == 2
and floatize(dtable, row, 2) != 0):
update_drlspectrum(ptable, dtable, ds, drlspectrum)
if (drls['dt'].cellWidget(row, 0).checkState() == 2
and floatize(drls['dt'], row, 2) != 0):
update_drlspectrum(ds, drls, drlspectrum)
def remove_rows(ptable, dtable, ds, drlspectrum, rows=None):
def remove_rows(ds, drls, drlspectrum, rows=None):
# TODO: maybe nicer selection in future, but this works for now
if rows == None:
rows = reversed(list(set(
map(lambda x: x.row(), ptable.selectedIndexes()))))
map(lambda x: x.row(), drls['pt'].selectedIndexes()))))
for row in rows:
dtable.cellWidget(row,0).setCheckState(0)
dtable.removeRow(row)
ptable.removeRow(row)
for i in range(dtable.rowCount()):
corfor = dtable.cellWidget(i, 1)
drls['dt'].cellWidget(row,0).setCheckState(0)
drls['dt'].removeRow(row)
drls['pt'].removeRow(row)
for i in range(drls['dt'].rowCount()):
corfor = drls['dt'].cellWidget(i, 1)
corfor.disconnect()
index = corfor.currentIndex()
corfor.clear()
corfor.addItem("")
corfor.addItems(gettableitemlist(ptable))
corfor.addItems(gettableitemlist(drls['pt']))
if index == row+1:
corfor.setCurrentIndex(0)
corr_changed(i, ptable, dtable, ds, drlspectrum)
corr_changed(i, ds, drls, drlspectrum)
elif index > row+1:
corfor.setCurrentIndex(index-1)
else:
corfor.setCurrentIndex(index)
corfor.currentIndexChanged.connect(lambda:
corr_changed(i, ptable, dtable, ds, drlspectrum))
corr_changed(i, ds, drls, drlspectrum))
def add_line(ds, parenttable, daughtertable, drlspectrum):
def add_line(ds, drls, drlspectrum):
"""add parent ion to the table"""
newrow = parenttable.rowCount()
newrow = drls['pt'].rowCount()
parenttable.blockSignals(True)
daughtertable.blockSignals(True)
drls['pt'].blockSignals(True)
drls['dt'].blockSignals(True)
parenttable.setRowCount(newrow + 1)
drls['pt'].setRowCount(newrow + 1)
for i in range(3):
parenttable.setItem(newrow, i, QtWidgets.QTableWidgetItem())
drls['pt'].setItem(newrow, i, QtWidgets.QTableWidgetItem())
if newrow is not 0:
parenttable.item(newrow, i).setText(str(floatize(
parenttable, newrow-1, i)+1))
drls['pt'].item(newrow, i).setText(str(floatize(
drls['pt'], newrow-1, i)+1))
ion_graph = Figure(figsize=(3, 1.5), dpi=100, facecolor="None")
ion_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8),
......@@ -246,32 +248,31 @@ def add_line(ds, parenttable, daughtertable, drlspectrum):
graph_canvas = FigureCanvas(ion_graph)
graph_canvas.setStyleSheet("background-color:transparent;")
graph_canvas.setAutoFillBackground(False)
parenttable.setCellWidget(newrow, 3, graph_canvas)
drls['pt'].setCellWidget(newrow, 3, graph_canvas)
daughtertable.setRowCount(newrow + 1)
drls['dt'].setRowCount(newrow + 1)
checkbox = QtWidgets.QCheckBox()
checkbox.setFocusProxy(daughtertable)
checkbox.setFocusProxy(drls['dt'])
dname = QtWidgets.QTableWidgetItem()
dname.setFlags(dname.flags() & ~QtCore.Qt.ItemIsEditable)
dname.setTextAlignment(QtCore.Qt.AlignRight)
daughtertable.setItem(newrow, 0, dname)
daughtertable.setCellWidget(newrow, 0, checkbox)
drls['dt'].setItem(newrow, 0, dname)
drls['dt'].setCellWidget(newrow, 0, checkbox)
corfor = QtWidgets.QComboBox()
corfor.setFocusProxy(daughtertable)
corfor.setFocusProxy(drls['dt'])
corfor.setFrame(False)
daughtertable.setCellWidget(newrow, 1, corfor)
daughtertable.setItem(newrow, 2, QtWidgets.QTableWidgetItem())
drls['dt'].setCellWidget(newrow, 1, corfor)
drls['dt'].setItem(newrow, 2, QtWidgets.QTableWidgetItem())
parenttable.blockSignals(False)
daughtertable.blockSignals(False)
drls['pt'].blockSignals(False)
drls['dt'].blockSignals(False)
ptable_changed(newrow, 1, parenttable, daughtertable, ds,
drlspectrum)
ptable_changed(newrow, 1, ds, drls, drlspectrum)
checkbox.stateChanged.connect(lambda: update_drlspectrum(
parenttable, daughtertable, ds, drlspectrum))
ds, drls, drlspectrum))
corfor.currentIndexChanged.connect(lambda: corr_changed(
newrow, parenttable, daughtertable, ds, drlspectrum))
newrow, ds, drls, drlspectrum))
def iontable(labels):
......@@ -290,7 +291,7 @@ def iontable(labels):
return table
def load_drltables(parent, ptable, dtable, dataset, drlspectrum):
def load_drltables(parent, dataset, drls, drlspectrum):
filename = QtWidgets.QFileDialog.getOpenFileName(
caption="Load DRL config tables",
filter="comma-separated values (*.csv)")[0]
......@@ -317,24 +318,24 @@ def load_drltables(parent, ptable, dtable, dataset, drlspectrum):
for j, k in enumerate((names, start_masses, end_masses,
states, corrected_to, corr_factors)):
k.append(rawline[j])
for row in reversed(range(ptable.rowCount())):
dtable.removeRow(row)
ptable.removeRow(row)
for row in reversed(range(drls['pt'].rowCount())):
drls['dt'].removeRow(row)
drls['pt'].removeRow(row)
# first populate only the parent table
for i in range(len(names)):
add_line(dataset, ptable, dtable, drlspectrum)
ptable.item(i, 0).setText(names[i])
ptable.item(i, 1).setText(start_masses[i])
ptable.item(i, 2).setText(end_masses[i])
add_line(dataset, drls, drlspectrum)
drls['pt'].item(i, 0).setText(names[i])
drls['pt'].item(i, 1).setText(start_masses[i])
drls['pt'].item(i, 2).setText(end_masses[i])
# and after that the daughter table
for i in range(len(names)):
dtable.cellWidget(i, 1).setCurrentIndex(
drls['dt'].cellWidget(i, 1).setCurrentIndex(
int(corrected_to[i]))
dtable.item(i, 2).setText(corr_factors[i])
dtable.cellWidget(i, 0).setCheckState(int(states[i]))
drls['dt'].item(i, 2).setText(corr_factors[i])
drls['dt'].cellWidget(i, 0).setCheckState(int(states[i]))
def save_drlconfig(ptable, dtable, parent, exp_f_name=None):
def save_drlconfig(drls, parent, exp_f_name=None):
"""safe DRL table layout so it can be summoned when needed"""
if exp_f_name == None:
exp_f_name = ft.get_save_filename(
......@@ -344,25 +345,29 @@ def save_drlconfig(ptable, dtable, parent, exp_f_name=None):
expf = open(exp_f_name, 'w')
expf.write("#ion_name, start m/z, end m/z, visible,"
"corrected_to, factor\n")
for row in range(ptable.rowCount()):
for row in range(drls['pt'].rowCount()):
vals = []
for i in range(3):
vals.append(ptable.item(row, i).text())
vals.append(dtable.cellWidget(row, 0).checkState())
vals.append(dtable.cellWidget(row, 1).currentIndex())
vals.append(dtable.item(row, 2).text())
vals.append(drls['pt'].item(row, i).text())
vals.append(drls['dt'].cellWidget(row, 0).checkState())
vals.append(drls['dt'].cellWidget(row, 1).currentIndex())
vals.append(drls['dt'].item(row, 2).text())
expf.write("{}\n".format((",".join(map(str, vals)))))
expf.close()
def export_drlspectrum(parent, fn, ptable, dtable, ds):
def export_drlspectrum(parent, fn, ds, drls):
if fn[0] is None:
QtWidgets.QMessageBox.warning(
None, "Export DRL dataset",
"Nothing to export, cancelling request")
return
names, times, intensities = get_daughterset(ptable, dtable, ds)
pnames, ptimes, pintensities = get_parentset(ptable, dtable, ds)
names, times, intensities = get_daughterset(ds, drls)
subset = np.where(times > 0)[0]
times = times[subset]
intensities = intensities[subset]
pnames, ptimes, pintensities = get_parentset(ds, drls)
if names == []:
QtWidgets.QMessageBox.warning(
None, "Export DRL dataset",
......@@ -400,15 +405,15 @@ def export_drlspectrum(parent, fn, ptable, dtable, ds):
dataset.append(intensity[j])
expf.write("{}\n".format((",".join(map(str, dataset)))))
expf.close()
save_drlconfig(ptable, dtable, parent, exp_f_name[2])
save_drlconfig(drls, parent, exp_f_name[2])
def print_graph(labels, ptable, dtable, ds):
def print_graph(labels, ds, drls):
printfig = Figure(figsize=(5, 2), dpi=100)
printplot = printfig.add_subplot(111)
printcanvas = FigureCanvas(printfig)
gt.pop_plot(printplot, labels)
update_drlspectrum(ptable, dtable, ds, printplot)
update_drlspectrum(ds, drls, printplot)
widget = QtWidgets.QDialog(None, windowTitle='Print preview')
layout = QtWidgets.QVBoxLayout(widget)
layout.addWidget(printcanvas)
......@@ -420,9 +425,9 @@ def print_graph(labels, ptable, dtable, ds):
widget.close()
def clip_range(ptable, dtable):
def clip_range(drls):
activeObject = QtWidgets.QApplication.focusWidget()
if activeObject in (ptable, dtable):
if activeObject in (drls['pt'], drls['dt']):
table = activeObject
if len(table.selectedRanges()) == 0:
return
......@@ -448,9 +453,9 @@ def clip_range(ptable, dtable):
QtWidgets.QApplication.clipboard().setText(("\n").join(rows))
def paste_clip(ptable, dtable, ds, drlspectrum):
def paste_clip(drls, ds, drlspectrum):
activeObject = QtWidgets.QApplication.focusWidget()
if activeObject in (ptable, dtable)\
if activeObject in (drls['pt'], drls['dt'])\
and activeObject.selectedRanges() != []:
table = activeObject
if len(table.selectedRanges()) > 1:
......@@ -465,45 +470,49 @@ def paste_clip(ptable, dtable, ds, drlspectrum):
for i, row in enumerate(rows, start=startrow):
cols = row.split("\t")
for j, col in enumerate(cols, start=startcol):
if table == ptable and j < 3:
if table == drls['pt'] and j < 3:
if i >= (table.rowCount()):
add_line(ds, ptable, dtable, drlspectrum)
add_line(ds, drls, drlspectrum)
table.item(i, j).setText(col)
if table == dtable and j == 2\
if table == drls['dt'] and j == 2\
and i < table.rowCount():
table.item(i,j).setText(col)
def key_pressed(event, ptable, dtable, ds, drlspectrum):
def key_pressed(event, ds, drls, drlspectrum):
if event.key() == QtCore.Qt.Key_Delete:
rows = reversed(list(map(lambda x: x.row(),
ptable.selectionModel().selectedRows())))
remove_rows(ptable, dtable, ds, drlspectrum, rows)
drls['pt'].selectionModel().selectedRows())))
remove_rows(ds, drls, drlspectrum, rows)
if event.key() == QtCore.Qt.Key_F5:
update_drlspectrum(ptable, dtable, ds, drlspectrum)
for row in range(ptable.rowCount()):
update_profile(ptable, row, ds)
update_drlspectrum(ds, drls, drlspectrum)
for row in range(drls['pt'].rowCount()):
update_profile(drls['pt'], row, ds)
if event.key() == QtCore.Qt.Key_C\
and event.modifiers().__int__() == QtCore.Qt.ControlModifier:
clip_range(ptable, dtable)
clip_range(drls)
if event.key() == QtCore.Qt.Key_V\
and event.modifiers().__int__() == QtCore.Qt.ControlModifier:
paste_clip(ptable, dtable, ds, drlspectrum)
paste_clip(ds, drls, drlspectrum)
def main_window(parent, ds, filename, cache):
"""constructs a dialog window"""
def saveonclose(widget, event, buffer, ptable, dautable, canvas):
buffer[0], buffer[1], buffer[2] = ptable, dautable, canvas
def saveonclose(widget, event, buffer, drls, canvas):
buffer[0], buffer[1] = drls, canvas
QtWidgets.QMainWindow.closeEvent(widget, event)
# pt = parenttable
# dt = daughtertable
drls = dict(pt=None, dt=None, tshift=None)
window = QtWidgets.QMainWindow(
parent, windowTitle='Delayed reactant labelling')
main_widget = QtWidgets.QWidget(window)
window.setCentralWidget(main_widget)
window.closeEvent = lambda event: saveonclose(
window, event, cache, pt, dtable, graph_canvas)
window, event, cache, drls, graph_canvas)
dial_graph = Figure(figsize=(5, 2), dpi=100, facecolor="None")
chromplot = dial_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8))
......@@ -517,6 +526,10 @@ def main_window(parent, ds, filename, cache):
gt.zoom_factory(chromplot, 1.15)
gt.pop_plot(chromplot, graphlabels)
time_title = QtWidgets.QLabel("Time shift (min):")
drls['tshift'] = QtWidgets.QDoubleSpinBox(
minimum=-100, maximum=1440, decimals=3)
drl_load = QtWidgets.QPushButton("&Load")
drl_save = QtWidgets.QPushButton("&Save")
drl_export = QtWidgets.QPushButton("&Export")
......@@ -527,42 +540,45 @@ def main_window(parent, ds, filename, cache):
btn_add = QtWidgets.QPushButton("&Add")
btn_rem = QtWidgets.QPushButton("Remove")
# pt = parenttable
# dt = daughtertable
if cache == [None, None, None]:
dtable = iontable(["Name", "corrected for", "factor"])
if cache == [None, None]:
drls['dt'] = iontable(["Name", "corrected for", "factor"])
pt = iontable(["Name", "start (m/z)", "end (m/z)", "profile"])
add_line(ds, pt, dtable, chromplot)
drls['pt'] = iontable(["Name", "start (m/z)", "end (m/z)",
"profile"])
add_line(ds, drls, chromplot)
else:
pt = cache[0]
dtable = cache[1]
graph_canvas = cache[2]
drls = cache[0]
graph_canvas = cache[1]
window.keyPressEvent = lambda event: key_pressed(
event, pt, dtable, ds, chromplot)
event, ds, drls, chromplot)
btn_add.clicked.connect(lambda: add_line(
ds, pt, dtable, chromplot))
ds, drls, chromplot))
btn_rem.clicked.connect(lambda: remove_rows(
pt, dtable, ds, chromplot))
ds, drls, chromplot))
drl_load.clicked.connect(lambda: load_drltables(
main_widget, pt, dtable, ds, chromplot))
main_widget, ds, drls, chromplot))
drl_save.clicked.connect(lambda: save_drlconfig(
pt, dtable, main_widget))
drls, main_widget))
drl_print.clicked.connect(lambda: print_graph(
graphlabels, pt, dtable, ds))
graphlabels, ds, drls))
drl_export.clicked.connect(lambda: export_drlspectrum(
main_widget, filename, pt, dtable, ds))
main_widget, filename, ds, drls))
drls['pt'].itemChanged.connect(lambda item: ptable_changed(
item.row(), item.column(), ds, drls, chromplot))
pt.itemChanged.connect(lambda item: ptable_changed(
item.row(), item.column(), pt, dtable, ds, chromplot))
drls['dt'].itemChanged.connect(lambda item: dtable_changed(
item.row(), item.column(), ds, drls, chromplot))
dtable.itemChanged.connect(lambda item: dtable_changed(
item.row(), item.column(), pt, dtable, ds, chromplot))
drls['tshift'].valueChanged.connect(lambda: update_drlspectrum(
ds, drls, chromplot))
main_layout = QtWidgets.QVBoxLayout(main_widget)
sub_layout = QtWidgets.QHBoxLayout()
graph_layout = QtWidgets.QVBoxLayout()
graphparams_layout = QtWidgets.QHBoxLayout()
tablelayout = QtWidgets.QVBoxLayout()
pt_butlayout = QtWidgets.QHBoxLayout()
main_butlayout = QtWidgets.QHBoxLayout()
......@@ -582,13 +598,18 @@ def main_window(parent, ds, filename, cache):
main_butlayout.addWidget(drl_export)
main_butlayout.addWidget(close)
sub_layout.addWidget(graph_canvas, stretch=1)
sub_layout.addLayout(graph_layout, stretch=1)
sub_layout.addLayout(tablelayout)
graph_layout.addWidget(graph_canvas, stretch=1)
graph_layout.addLayout(graphparams_layout)
graphparams_layout.addWidget(time_title)
graphparams_layout.addWidget(drls['tshift'])
graphparams_layout.addStretch(1)
tablelayout.addWidget(QtWidgets.QLabel("Raw ions table:"))
tablelayout.addWidget(pt)
tablelayout.addWidget(drls['pt'])
tablelayout.addLayout(pt_butlayout)
tablelayout.addWidget(QtWidgets.QLabel("Corrected ions table:"))
tablelayout.addWidget(dtable)
tablelayout.addWidget(drls['dt'])
window.show()