Skip to content
GitLab
Menu
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
1f3d66d3
Commit
1f3d66d3
authored
Sep 10, 2018
by
Yan
Browse files
Auto Zoom Y axis on-demand
parent
14f2e4ca
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
prasopes/TangoMFK/16x16/zoom-original.png
0 → 100644
View file @
1f3d66d3
935 Bytes
prasopes/TangoMFK/24x24/zoom-original.png
0 → 100644
View file @
1f3d66d3
1.24 KB
prasopes/TangoMFK/32x32/zoom-original.png
0 → 100644
View file @
1f3d66d3
2.16 KB
prasopes/__main__.py
View file @
1f3d66d3
...
...
@@ -53,7 +53,7 @@ def main():
ds
=
dict
(
chrom_dat
=
None
,
masses
=
None
,
matrix
=
None
)
ms
=
dict
(
x
=
[
0
],
y
=
[
0
],
line
=
None
,
annotation
=
[],
name
=
"Spectrum"
,
xlabel
=
"m/z"
,
ylabel
=
"ion count"
,
xtics
=
20
)
xtics
=
20
,
autoy
=
True
)
chrom
=
dict
(
x
=
[
0
],
y
=
[
0
],
line
=
None
,
t_start
=
None
,
t_end
=
None
,
name
=
"Chromatogram"
,
xlabel
=
"time(min)"
,
ylabel
=
"total ion count"
,
timesarg
=
None
)
...
...
@@ -126,7 +126,12 @@ def main():
drlact
.
setShortcut
(
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_D
)
drlact
.
triggered
.
connect
(
lambda
:
drl
.
main_window
(
main_window
,
ds
,
filename
,
drlcache
))
autozoomy
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"zoom-original"
),
"Auto Zoom Y"
)
autozoomy
.
setCheckable
(
True
)
autozoomy
.
setChecked
(
True
)
autozoomy
.
triggered
.
connect
(
lambda
:
gt
.
autozoomy
(
autozoomy
.
isChecked
(),
spectrum
,
ms
))
...
...
@@ -142,11 +147,6 @@ def main():
main_window
.
menuBar
().
addMenu
(
tools_menu
)
tools_menu
.
addAction
(
zceact
)
tools_menu
.
addAction
(
drlact
)
"""tools_menu.addAction('&TSQ zce', lambda: zce.dialog(
main_window, ds, filename), QtCore.Qt.CTRL + QtCore.Qt.Key_T)
tools_menu.addAction('&DRL..', lambda: drl.main_window(
main_window, ds, filename, drlcache),
QtCore.Qt.CTRL + QtCore.Qt.Key_D)"""
main_widget
=
QtWidgets
.
QWidget
(
main_window
)
main_window
.
setCentralWidget
(
main_widget
)
...
...
@@ -156,11 +156,14 @@ def main():
toolBar
.
setFloatable
(
False
)
toolBar
.
setMovable
(
False
)
toolBar
.
setToolButtonStyle
(
QtCore
.
Qt
.
ToolButtonTextBesideIcon
)
toolBar
.
addAction
(
openact
)
toolBar
.
addAction
(
exportact
)
toolBar
.
addSeparator
()
toolBar
.
addAction
(
zceact
)
toolBar
.
addAction
(
drlact
)
toolBar
.
addSeparator
()
toolBar
.
addAction
(
autozoomy
)
layout
=
QtWidgets
.
QVBoxLayout
(
main_widget
)
layout
.
addWidget
(
toolBar
)
...
...
prasopes/drltools.py
View file @
1f3d66d3
...
...
@@ -62,29 +62,30 @@ 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
)
massargs
=
dt
.
argsubselect
(
ds
[
'masses'
],
startm
,
endm
)
intensity
=
(
np
.
sum
(
ds
[
'matrix'
].
T
[
massargs
].
T
,
axis
=
1
))
/
ds
[
'chrom_dat'
][
1
]
return
intensity
def
get_daughterset
(
ptable
,
dtable
,
ds
):
# TODO: write a less resources demanding function
# TODO: write a less resources demanding function
- probably "per-line"
names
=
[]
times
=
ds
[
'chrom_dat'
][
0
,
:]
intensities
=
[]
# TODO: resolve intensities trouble
for
row
in
range
(
dtable
.
rowCount
()):
if
dtable
.
cellWidget
(
row
,
0
).
checkState
()
==
2
:
startm
=
floatize
(
ptable
,
row
,
1
)
endm
=
floatize
(
ptable
,
row
,
2
)
massargs
=
dt
.
argsubselect
(
ds
[
'masses'
],
startm
,
endm
)
intensity
=
(
np
.
sum
(
ds
[
'matrix'
].
T
[
massargs
].
T
,
axis
=
1
))
/
ds
[
'chrom_dat'
][
1
]
intensity
=
get_intensity
(
row
,
ptable
,
dtable
,
ds
)
cor
=
dtable
.
cellWidget
(
row
,
1
).
currentIndex
()
-
1
# TODO: check if cor still produce the mess or it started to behave
if
cor
not
in
(
-
2
,
-
1
):
factor
=
floatize
(
dtable
,
row
,
2
)
startm
=
floatize
(
ptable
,
cor
,
1
)
endm
=
floatize
(
ptable
,
cor
,
2
)
massargs
=
dt
.
argsubselect
(
ds
[
'masses'
],
startm
,
endm
)
correction
=
((
np
.
sum
(
ds
[
'matrix'
].
T
[
massargs
].
T
,
axis
=
1
))
/
ds
[
'chrom_dat'
][
1
])
*
factor
correction
=
get_intensity
(
cor
,
ptable
,
dtable
,
ds
)
\
*
factor
intensity
=
intensity
-
correction
intensities
.
append
(
intensity
)
names
.
append
(
"{} - {} * {}"
.
format
(
...
...
@@ -383,6 +384,10 @@ def key_pressed(event, ptable, dtable, ds, drlspectrum):
for
row
in
map
(
lambda
x
:
x
.
row
(),
ptable
.
selectionModel
().
selectedRows
()):
delete_row
(
row
,
ptable
,
dtable
,
ds
,
drlspectrum
)
if
event
.
key
()
==
QtCore
.
Qt
.
Key_F5
:
update_drlspectrum
(
ptable
,
dtable
,
ds
,
drlspectrum
)
for
row
in
range
(
ptable
.
rowCount
()):
update_profile
(
ptable
,
row
,
ds
)
def
main_window
(
parent
,
ds
,
filename
,
cache
):
...
...
prasopes/graphtools.py
View file @
1f3d66d3
...
...
@@ -100,7 +100,8 @@ def plot_subtime(mpl_spectrum, mpl_chromatogram, data_set, mass_spect,
data_set
[
'matrix'
][
chrom_spect
[
'timesarg'
]],
axis
=
0
)
pop_plot
(
mpl_spectrum
,
mass_spect
)
mpl_spectrum
.
set_xlim
(
slims
[
0
])
mpl_spectrum
.
set_ylim
(
slims
[
1
])
if
mass_spect
[
'autoy'
]
is
False
:
mpl_spectrum
.
set_ylim
(
slims
[
1
])
mpl_chromatogram
.
clear
()
pop_plot
(
mpl_chromatogram
,
chrom_spect
)
...
...
@@ -139,6 +140,17 @@ def arrow_factory(spectrum, chromatogram, ds, mass_spect,
fig
.
canvas
.
mpl_connect
(
'key_press_event'
,
lambda
event
:
arrow_fun
(
event
,
spectrum
,
chromatogram
,
ds
,
mass_spect
,
chrom_spect
))
def
autozoomy
(
state
,
ms_spec
,
msdata
):
if
state
is
True
:
msdata
[
'autoy'
]
=
True
ms_spec
.
autoscale
(
True
,
'y'
)
ymin
=
-
0.01
ms_spec
.
set_ylim
(
ms_spec
.
get_ylim
()[
1
]
*
ymin
,
ms_spec
.
get_ylim
()[
1
]
*
1.1
)
ms_spec
.
figure
.
canvas
.
draw
()
else
:
msdata
[
'autoy'
]
=
False
def
ann_spec
(
ms_spec
,
msdata
,
ann_limit
=
0.01
):
"""annotate spectrum
...
...
prasopes/tangoicons.py
View file @
1f3d66d3
This diff is collapsed.
Click to expand it.
prasopes/tangoicons.qrc
View file @
1f3d66d3
...
...
@@ -12,6 +12,9 @@
<file
alias=
"16x16/preferences-system.png"
>
TangoMFK/16x16/preferences-system.png
</file>
<file
alias=
"24x24/preferences-system.png"
>
TangoMFK/24x24/preferences-system.png
</file>
<file
alias=
"32x32/preferences-system.png"
>
TangoMFK/32x32/preferences-system.png
</file>
<file
alias=
"16x16/zoom-original.png"
>
TangoMFK/16x16/zoom-original.png
</file>
<file
alias=
"24x24/zoom-original.png"
>
TangoMFK/24x24/zoom-original.png
</file>
<file
alias=
"32x32/zoom-original.png"
>
TangoMFK/32x32/zoom-original.png
</file>
<file
alias=
"index.theme"
>
TangoMFK/index.theme
</file>
</qresource>
</RCC>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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