Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Zelenka
prasopes
Commits
18ffc9ed
Commit
18ffc9ed
authored
May 29, 2020
by
Yan
Browse files
Reactivitytools now with export
* minor fix of reactivitytools * added export function to reactivitytools
parent
95a93d1b
Changes
4
Hide whitespace changes
Inline
Side-by-side
prasopes/__init__.py
View file @
18ffc9ed
...
...
@@ -13,7 +13,7 @@ from . import zcetools_help
from
.
import
reactivitytools
__version__
=
"0.0.2
5
"
__version__
=
"0.0.2
6
"
__all__
=
[
'config'
,
'datatools'
,
'docks'
,
'drltools'
,
'drltoos_gui'
,
'filetools'
,
...
...
prasopes/datatools.py
View file @
18ffc9ed
...
...
@@ -15,15 +15,12 @@ def argsubselect(array, minimum, maximum):
return
args
def
specttostr
(
augCanvas
,
delim
=
" "
):
lines
=
augCanvas
.
spectplot
.
get_lines
()
def
specttostr
(
augCanvas
,
delim
=
"
"
,
names
=
[
"mass"
,
"ion_count"
],
units
=
[
"m/z"
,
""
],
description
=
"
"
):
lines
=
augCanvas
.
get_lines
()
setnum
=
len
(
lines
)
names
=
delim
.
join
([
"mass ion_count"
for
i
in
range
(
setnum
)])
units
=
(
delim
+
delim
).
join
([
"m/z"
for
i
in
range
(
setnum
)])
description
=
(
"{}_{:.4}-{:.4}_minutes_of_the_aquisition
\n
"
.
format
(
os
.
path
.
basename
(
augCanvas
.
filename
),
augCanvas
.
chrom
[
't_start'
],
augCanvas
.
chrom
[
't_end'
]))
header
=
"
\n
"
.
join
([
names
,
units
,
description
])
formnames
=
delim
.
join
([
delim
.
join
(
names
)
for
i
in
range
(
setnum
)])
formunits
=
(
delim
).
join
([
delim
.
join
(
units
)
for
i
in
range
(
setnum
)])
header
=
"
\n
"
.
join
([
formnames
,
formunits
,
description
])
+
"
\n
"
strdata
=
[]
for
i
in
range
(
np
.
max
([
len
(
line
.
get_xdata
())
for
line
in
lines
])):
...
...
@@ -37,7 +34,10 @@ def specttostr(augCanvas, delim=" "):
def
clip_spectstr
(
augCanvas
):
string
=
specttostr
(
augCanvas
,
delim
=
"
\t
"
)
description
=
(
"{}_{:.4}-{:.4}_minutes_of_the_aquisition"
.
format
(
os
.
path
.
basename
(
augCanvas
.
filename
),
augCanvas
.
chrom
[
't_start'
],
augCanvas
.
chrom
[
't_end'
]))
string
=
specttostr
(
augCanvas
.
spectplot
,
delim
=
"
\t
"
,
description
=
description
)
QtWidgets
.
QApplication
.
clipboard
().
clear
()
[
QtWidgets
.
QApplication
.
clipboard
().
setText
(
string
,
i
)
for
i
in
range
(
2
)]
...
...
prasopes/filetools.py
View file @
18ffc9ed
...
...
@@ -37,6 +37,9 @@ def export_dial(augCanvas, main_window):
exp_f_name
=
get_save_filename
(
"Export spectrum"
,
"dat table (*.dat)"
,
"dat"
,
main_window
)
if
exp_f_name
!=
''
:
description
=
(
"{}_{:.4}-{:.4}_minutes_of_the_aquisition"
.
format
(
os
.
path
.
basename
(
augCanvas
.
filename
),
augCanvas
.
chrom
[
't_start'
],
augCanvas
.
chrom
[
't_end'
]))
expf
=
open
(
exp_f_name
,
'w'
)
expf
.
write
(
dt
.
specttostr
(
augCanvas
))
expf
.
write
(
dt
.
specttostr
(
augCanvas
.
spectplot
,
description
=
description
))
expf
.
close
prasopes/reactivitytools.py
View file @
18ffc9ed
...
...
@@ -26,6 +26,23 @@ def key_pressed(event, augCanvas, drls, grph, labels, parselect):
if
event
.
modifiers
().
__int__
()
==
QtCore
.
Qt
.
ControlModifier
:
clip_spect_img
(
augCanvas
,
drls
,
grph
,
labels
,
parselect
)
def
export_dial
(
augCanvas
,
drls
,
grph
,
labels
,
parselect
):
"""exports the reactivity into the .dat file format"""
if
not
augCanvas
.
filename
:
QtWidgets
.
QMessageBox
.
warning
(
None
,
"Export spectrum"
,
"Nothing to export, cancelling request"
)
return
exp_f_name
=
ft
.
get_save_filename
(
"Export spectrum"
,
"dat table (*.dat)"
,
"dat"
,
None
)
if
exp_f_name
!=
''
:
names
=
[
"pressure"
,
"rel._intensity"
]
units
=
[
"mTorr"
,
""
]
description
=
os
.
path
.
basename
(
augCanvas
.
filename
)
expf
=
open
(
exp_f_name
,
'w'
)
expf
.
write
(
dt
.
specttostr
(
grph
,
" "
,
names
,
units
,
description
))
expf
.
close
def
update_parselect
(
augCanvas
,
parselect
):
index
=
parselect
.
currentIndex
()
...
...
@@ -127,8 +144,7 @@ def main_window(parent, augCanvas, update_signal, drls):
QtWidgets
.
QDialog
.
closeEvent
(
widget
,
event
)
def
update_fnc
():
pop_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
,
parselect
,
coef1
,
coef2
)
pop_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
,
parselect
)
dial_widget
=
QtWidgets
.
QDialog
(
parent
,
windowTitle
=
'TSQ reactivity interpreter'
)
...
...
@@ -197,6 +213,16 @@ def main_window(parent, augCanvas, update_signal, drls):
pushbtn
.
clicked
.
connect
(
lambda
:
pop_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
,
parselect
))
expbtn
=
QtWidgets
.
QPushButton
(
"Export"
)
expbtn
.
clicked
.
connect
(
lambda
:
export_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
,
parselect
))
buttlayout
=
QtWidgets
.
QHBoxLayout
()
buttlayout
.
addWidget
(
pushbtn
)
buttlayout
.
addStretch
()
buttlayout
.
addWidget
(
expbtn
)
layouts
.
append
(
buttlayout
)
param_layout
=
QtWidgets
.
QHBoxLayout
()
[
param_layout
.
addWidget
(
i
)
for
i
in
[
parlabel
,
parselect
]]
param_layout
.
addStretch
()
...
...
@@ -209,7 +235,6 @@ def main_window(parent, augCanvas, update_signal, drls):
dial_layout
.
addLayout
(
param_layout
)
dial_layout
.
addWidget
(
formula
)
[
dial_layout
.
addLayout
(
i
)
for
i
in
layouts
]
dial_layout
.
addWidget
(
pushbtn
)
dial_widget
.
setFocus
()
dial_widget
.
show
()
pop_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
,
parselect
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment