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
b7fcf428
Commit
b7fcf428
authored
Mar 02, 2020
by
Yan
Browse files
Initial reactivity support
* code is WIP, just proof of concept
parent
fbd6f81d
Changes
4
Hide whitespace changes
Inline
Side-by-side
prasopes/__init__.py
View file @
b7fcf428
...
...
@@ -10,11 +10,12 @@ from . import predictmz
from
.
import
tangoicons
from
.
import
zcetools
from
.
import
zcetools_help
from
.
import
reactivitytools
__version__
=
"0.0.1
8
"
__version__
=
"0.0.1
9
"
__all__
=
[
'config'
,
'datatools'
,
'docks'
,
'drltools'
,
'filetools'
,
'graphtools'
,
'imagetools'
,
'predictmz'
,
'tangoicons'
,
'zcetools'
,
'zcetools_help'
]
'zcetools_help'
,
'reactivitytools'
]
prasopes/__main__.py
View file @
b7fcf428
...
...
@@ -74,7 +74,8 @@ def load_file(parent, augCanvas, update, settings, loadthread, filename=None):
if
autoparams
:
try
:
(
augCanvas
.
ms
[
'params'
],
rawheaders
,
augCanvas
.
chrom
[
'machtype'
])
=
load_params
(
filename
)
augCanvas
.
chrom
[
'machtype'
])
=
load_params
(
filename
,
settings
.
value
(
"tmp_location"
))
segments
=
[
len
(
subset
[
'chrom_dat'
][
0
])
for
subset
in
augCanvas
.
ds
]
indicies
=
[
sum
(
segments
[:
i
+
1
])
...
...
prasopes/drltools.py
View file @
b7fcf428
...
...
@@ -6,13 +6,13 @@ from PyQt5 import QtCore
from
PyQt5
import
QtWidgets
from
PyQt5
import
QtGui
from
PyQt5
import
QtPrintSupport
from
copy
import
copy
import
matplotlib
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
prasopes.reactivitytools
as
rt
import
os.path
import
logging
matplotlib
.
use
(
"Qt5Agg"
)
...
...
@@ -342,7 +342,7 @@ def add_line(ds, drls, drlspectrum):
drls
[
'dt'
].
setCellWidget
(
newrow
,
0
,
checkbox
)
for
i
in
range
(
drls
[
'cors'
].
value
()):
col
=
copy
(
1
+
i
*
2
)
col
=
1
+
i
*
2
drls
[
'dt'
].
setCellWidget
(
newrow
,
col
,
QtWidgets
.
QComboBox
())
drls
[
'dt'
].
cellWidget
(
newrow
,
col
).
setFocusPolicy
(
QtCore
.
Qt
.
NoFocus
)
drls
[
'dt'
].
cellWidget
(
newrow
,
col
).
setFrame
(
False
)
...
...
@@ -694,6 +694,7 @@ def main_window(parent, augCanvas, update_signal):
drl_load
=
QtWidgets
.
QPushButton
(
"&Load"
)
drl_save
=
QtWidgets
.
QPushButton
(
"&Save"
)
drl_export
=
QtWidgets
.
QPushButton
(
"&Export"
)
drl_reactivity
=
QtWidgets
.
QPushButton
(
"&Reactivity"
)
drl_print
=
QtWidgets
.
QPushButton
(
"&Print"
)
close
=
QtWidgets
.
QPushButton
(
"&Close"
)
close
.
clicked
.
connect
(
window
.
close
)
...
...
@@ -715,6 +716,8 @@ def main_window(parent, augCanvas, update_signal):
drl_print
.
clicked
.
connect
(
lambda
:
print_graph
(
ds
,
drls
))
drl_export
.
clicked
.
connect
(
lambda
:
export_drlspectrum
(
main_widget
,
filename
,
ds
,
drls
))
drl_reactivity
.
clicked
.
connect
(
lambda
:
rt
.
main_window
(
parent
,
augCanvas
,
update_signal
,
drls
))
drls
[
'pt'
].
itemChanged
.
connect
(
lambda
item
:
ptable_changed
(
item
.
row
(),
item
.
column
(),
ds
,
drls
,
chromplot
))
...
...
@@ -740,6 +743,8 @@ def main_window(parent, augCanvas, update_signal):
actionBar
.
addWidget
(
drl_save
)
actionBar
.
addWidget
(
drl_print
)
actionBar
.
addWidget
(
StretchWidget
())
actionBar
.
addWidget
(
drl_reactivity
)
actionBar
.
addWidget
(
StretchWidget
())
actionBar
.
addWidget
(
drl_export
)
actionBar
.
addWidget
(
close
)
...
...
prasopes/reactivitytools.py
0 → 100644
View file @
b7fcf428
#!/usr/bin/env python3
from
matplotlib.backends.backend_qt5agg
import
\
FigureCanvasQTAgg
as
FigureCanvas
from
matplotlib.figure
import
Figure
from
PyQt5
import
QtCore
from
PyQt5
import
QtWidgets
from
PyQt5
import
QtGui
from
PyQt5
import
QtPrintSupport
import
matplotlib
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
prasopes.drltools
as
drl
import
os.path
import
logging
matplotlib
.
use
(
"Qt5Agg"
)
logger
=
logging
.
getLogger
(
'drlLogger'
)
def
pop_dial
(
augCanvas
,
drls
,
graph
,
labels
):
logger
.
debug
(
"populating reactivity dialog"
)
# Do not do anything when data set is not populated
if
len
(
augCanvas
.
ds
)
==
0
:
return
graph
.
clear
()
gt
.
pop_plot
([
0
],
[
0
],
graph
,
labels
)
names
,
times
,
intensities
=
drl
.
get_daughterset
(
augCanvas
.
ds
,
drls
)
if
len
(
names
)
<
2
:
return
params
=
augCanvas
.
ms
[
'params'
]
pressures
=
[]
for
time
in
times
:
toavg
=
[]
for
param
in
params
[
1
]:
if
param
[
0
]
==
time
:
toavg
.
append
(
param
[
36
])
if
len
(
toavg
)
!=
0
:
pressures
.
append
([
time
,
np
.
average
(
toavg
)])
goodtimes
=
np
.
where
([
t
in
np
.
asarray
(
pressures
).
T
[
0
]
for
t
in
times
])
for
i
in
range
(
1
,
len
(
intensities
)):
relint
=
np
.
divide
(
intensities
[
i
],
np
.
clip
(
np
.
sum
(
intensities
,
0
),
np
.
finfo
(
np
.
float32
).
eps
,
None
),
dtype
=
np
.
float64
)
graph
.
plot
(
np
.
asarray
(
pressures
).
T
[
1
],
relint
[
goodtimes
],
label
=
names
[
i
],
color
=
(
gt
.
colors
[
i
%
len
(
gt
.
colors
)]
/
255
),
marker
=
"."
,
markersize
=
2
,
linestyle
=
"None"
)
def
main_window
(
parent
,
augCanvas
,
update_signal
,
drls
):
"""constructs a dialog window"""
reactlabels
=
dict
(
name
=
""
,
xlabel
=
"pressure (mT)"
,
ylabel
=
"rel intensity"
)
def
onclose
(
widget
,
event
,
update_fnc
):
logger
.
debug
(
"ZCE window custom close routine called"
)
update_signal
.
signal
.
disconnect
(
update_fnc
)
QtWidgets
.
QDialog
.
closeEvent
(
widget
,
event
)
def
update_fnc
():
pop_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
)
dial_widget
=
QtWidgets
.
QDialog
(
parent
,
windowTitle
=
'TSQ reactivity interpreter'
)
dial_widget
.
closeEvent
=
lambda
event
:
onclose
(
dial_widget
,
event
,
update_fnc
)
update_signal
.
signal
.
connect
(
update_fnc
)
dial_graph
=
Figure
(
figsize
=
(
5
,
2
),
dpi
=
100
,
facecolor
=
"None"
)
dialspect
=
dial_graph
.
add_subplot
(
111
,
facecolor
=
(
1
,
1
,
1
,
0.8
))
graph_canvas
=
FigureCanvas
(
dial_graph
)
graph_canvas
.
setStyleSheet
(
"background-color:transparent;"
)
graph_canvas
.
setAutoFillBackground
(
False
)
gt
.
zoom_factory
(
dialspect
,
1.15
,
reactlabels
)
gt
.
pan_factory
(
dialspect
,
reactlabels
)
dial_layout
=
QtWidgets
.
QVBoxLayout
(
dial_widget
)
dial_layout
.
addWidget
(
graph_canvas
)
dial_widget
.
setFocus
()
dial_widget
.
show
()
pop_dial
(
augCanvas
,
drls
,
dialspect
,
reactlabels
)
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