Commit 85781a4b authored by 3Yan's avatar 3Yan
Browse files

DRL - small fixes

* saving of the DRL table and exporting datasets now originates in a logical location
* fixed timeshift misplacement in the exported table
* when adding line the peakwidth is copied from the line above
parent 0c00d265
......@@ -11,6 +11,7 @@ import numpy as np
import prasopes.datatools as dt
import prasopes.graphtools as gt
import prasopes.filetools as ft
import prasopes.config as cf
import os.path
import logging
matplotlib.use("Qt5Agg")
......@@ -316,8 +317,10 @@ def add_line(ds, drls, drlspectrum):
for i in range(3):
drls['pt'].setItem(newrow, i, QtWidgets.QTableWidgetItem())
if newrow is not 0:
drls['pt'].item(newrow, i).setText(str(floatize(
drls['pt'], newrow-1, i)+1))
val = floatize(drls['pt'], newrow-1, i)
if i != 2:
val = val+1
drls['pt'].item(newrow, i).setText(str(val))
ion_graph = Figure(figsize=(3, 1.5), dpi=100, facecolor="None")
ion_graph.add_subplot(111, facecolor=(1, 1, 1, 0.8),
......@@ -379,7 +382,8 @@ def iontable(labels):
def load_drltables(parent, dataset, drls, drlspectrum):
filename = QtWidgets.QFileDialog.getOpenFileName(
caption="Load DRL config tables",
filter="comma-separated values (*.csv)")[0]
filter="comma-separated values (*.csv)",
directory=cf.settings().value("open_folder"))[0]
if filename is not '':
names = []
masses = []
......@@ -475,7 +479,7 @@ def export_drlspectrum(parent, fn, ds, drls):
None,"Export DRL data",
options=(QtWidgets.QFileDialog.DontConfirmOverwrite |
QtWidgets.QFileDialog.HideNameFilterDetails),
directory=os.path.basename(fn[0][:-4]))[0]
directory=fn[0][:-4])[0]
if fname is '':
return
exp_f_name = list(map(lambda x: "{}/{}-{}.csv".format(
......@@ -497,7 +501,7 @@ def export_drlspectrum(parent, fn, ds, drls):
[names, intensities]]):
expf = open(exp_f_name[i], 'w')
expf.write("times, {}\n".format((",".join(table[0]))))
expf.write("timeshift = {}".format(drls['tshift'].value()))
expf.write("timeshift = {}\n".format(drls['tshift'].value()))
for j in range(len(times)):
dataset = list()
dataset.append(times[j])
......
from PyQt5 import QtWidgets
from rawprasslib import load_raw
import prasopes.config as cf
import os.path
......@@ -8,10 +8,11 @@ def get_save_filename(caption, fnfilter, suffix, parent):
and thus also cant check for file with the selected suffix"""
filename = QtWidgets.QFileDialog.getSaveFileName(
caption=caption, filter=fnfilter,
directory=cf.settings().value("open_folder"),
options=QtWidgets.QFileDialog.DontConfirmOverwrite)[0]
if suffix[0] is not ".":
suffix = ".{}".format(suffix)
if filename[-len(suffix):] != suffix:
if filename[-len(suffix):] != suffix and filename != "":
filename = "".join((filename, suffix))
if os.path.isfile(filename):
quest = QtWidgets.QMessageBox.warning(
......
Supports Markdown
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