Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cittena
cittena
Commits
628af44f
Commit
628af44f
authored
Jan 20, 2017
by
Niels-Oliver Walkowski
Browse files
move vline to sequenceplot superclass
parent
6a55aae7
Changes
2
Hide whitespace changes
Inline
Side-by-side
itten/visuals.py
View file @
628af44f
...
@@ -15,7 +15,7 @@ class SequencePlot(object):
...
@@ -15,7 +15,7 @@ class SequencePlot(object):
def
get_xpos
(
self
,
view
):
def
get_xpos
(
self
,
view
):
"""calculate frame numbers for x-ticks"""
"""calculate frame numbers for x-ticks"""
# TODO Die Frame No. Range könnte ich auch besser zu einer Methode von Frames machen
# TODO Die Frame No. Range könnte ich auch besser zu einer Methode von Frames machen
return
[
nr
for
nr
in
range
(
view
.
_frames
.
start
,
view
.
_frames
.
end
,
return
[
nr
for
nr
in
range
(
view
.
_frames
.
start
,
view
.
_frames
.
end
,
view
.
_frame_step
)]
# um X-Achse Minuten anzeigen zu lassen
view
.
_frame_step
)]
# um X-Achse Minuten anzeigen zu lassen
...
@@ -27,13 +27,13 @@ class SequencePlot(object):
...
@@ -27,13 +27,13 @@ class SequencePlot(object):
# TODO styling und plotten sind hier noch etwas zusammengemischt
# TODO styling und plotten sind hier noch etwas zusammengemischt
def
ittenstyle
(
self
,
ax
,
view
):
def
ittenstyle
(
self
,
ax
,
view
):
plt
.
style
.
use
(
'ggplot'
)
plt
.
style
.
use
(
'ggplot'
)
fig_coef
=
self
.
width
/
self
.
height
fig_coef
=
self
.
width
/
self
.
height
tick_cnt
=
fig_coef
/
0.3605405405
tick_cnt
=
fig_coef
/
0.3605405405
tick_step
=
int
(
view
.
_frames
.
frm_cnt
/
tick_cnt
)
tick_step
=
int
(
view
.
_frames
.
frm_cnt
/
tick_cnt
)
# loc = plticker.MultipleLocator(base=tick_freq) # this locator puts ticks at regular intervals (0.0005)
# loc = plticker.MultipleLocator(base=tick_freq) # this locator puts ticks at regular intervals (0.0005)
loc
=
plticker
.
FixedLocator
(
range
(
0
,
view
.
_frames
.
end
,
tick_step
))
loc
=
plticker
.
FixedLocator
(
range
(
0
,
view
.
_frames
.
end
,
tick_step
))
fmt
=
plticker
.
FuncFormatter
(
self
.
_timelabels
)
fmt
=
plticker
.
FuncFormatter
(
self
.
_timelabels
)
...
@@ -73,11 +73,30 @@ class SequencePlot(object):
...
@@ -73,11 +73,30 @@ class SequencePlot(object):
return
(
ax
,
axt
)
return
(
ax
,
axt
)
# TODO Überführbar in Superclass?
# evtl. auch eher feature drer View Klasse
# TODO self._x sollte eine array sein
def
_vlines
(
self
,
view
,
mark
,
mark_gt
,
mark_lt
):
npx
=
np
..
array
(
self
.
_x
)
if
mark_gt
:
poss
=
npx
[
view
>
mark_gt
]
for
pos
in
poss
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#a6e22e'
,
alpha
=
0.4
,
linewidth
=
3
)
if
mark_lt
:
poss
=
npx
[
view
<
mark_lt
]
for
pos
in
poss
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#f92672'
,
alpha
=
0.4
,
linewidth
=
3
)
if
mark
:
for
pos
in
mark
:
print
(
self
.
_ax
)
self
.
_ax
.
axvline
(
pos
,
color
=
'#66d9ef'
,
alpha
=
0.4
,
linewidth
=
3
)
def
saveplt
(
self
,
title
=
False
,
fname
=
'plot.png'
):
def
saveplt
(
self
,
title
=
False
,
fname
=
'plot.png'
):
if
title
:
if
title
:
self
.
_ax
.
set_title
(
title
,
{
'fontsize'
:
14
},
y
=
1.18
)
self
.
_ax
.
set_title
(
title
,
{
'fontsize'
:
14
},
y
=
1.18
)
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
self
.
fig
.
tight_layout
()
self
.
fig
.
tight_layout
()
self
.
fig
.
savefig
(
fname
,
dpi
=
400
)
self
.
fig
.
savefig
(
fname
,
dpi
=
400
)
...
@@ -90,7 +109,7 @@ class MultivariatePlot(SequencePlot):
...
@@ -90,7 +109,7 @@ class MultivariatePlot(SequencePlot):
self
.
fig
=
plt
.
figure
()
self
.
fig
=
plt
.
figure
()
self
.
_ax
=
plt
.
axes
()
self
.
_ax
=
plt
.
axes
()
def
plot
(
self
,
view
):
def
plot
(
self
,
view
,
mark_gt
=
False
,
mark_lt
=
False
,
mark
=
False
):
x
=
view
[:,
0
]
x
=
view
[:,
0
]
y
=
view
[:,
1
]
y
=
view
[:,
1
]
value
=
view
[:,
2
]
value
=
view
[:,
2
]
...
@@ -100,11 +119,14 @@ class MultivariatePlot(SequencePlot):
...
@@ -100,11 +119,14 @@ class MultivariatePlot(SequencePlot):
# Plotten
# Plotten
axt
.
scatter
(
x
,
y
,
c
=
(
0
,
0
,
0
),
s
=
thickness
,
linewidths
=
0
)
axt
.
scatter
(
x
,
y
,
c
=
(
0
,
0
,
0
),
s
=
thickness
,
linewidths
=
0
)
# axt.scatter(x, y, c=y, cmap='Greys_r', s=thickness, linewidths=0) # DOC: vmin/vmax sorgt für die Verteilung der Fraben der Colorm
# axt.scatter(x, y, c=y, cmap='Greys_r', s=thickness, linewidths=0) # DOC: vmin/vmax sorgt für die Verteilung der Fraben der Colorm
# ax.scatter(x, y, c=y, cmap='hsv', s=thickness, linewidths=0)
# ax.scatter(x, y, c=y, cmap='hsv', s=thickness, linewidths=0)
if
mark
:
self
.
_vlines
(
view
,
mark
,
False
,
False
)
self
.
fig
.
tight_layout
()
self
.
fig
.
tight_layout
()
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
return
self
.
fig
,
self
.
_ax
return
self
.
fig
,
self
.
_ax
...
@@ -122,23 +144,10 @@ class UnivariatePlot(SequencePlot):
...
@@ -122,23 +144,10 @@ class UnivariatePlot(SequencePlot):
# Interpolation mit savitzky_golay funktioniert nicht
# Interpolation mit savitzky_golay funktioniert nicht
# contrast_points = savitzky_golay(np.array(contrast_points), 51, 7)
# contrast_points = savitzky_golay(np.array(contrast_points), 51, 7)
self
.
_axt
.
plot
(
self
.
_x
,
view
,
label
=
view
.
feature
)
self
.
_axt
.
plot
(
self
.
_x
,
view
,
label
=
view
.
feature
)
# TODO Überführbar in Superclass?
if
any
([
mark
,
mark_gt
,
mark_lt
]):
# evtl. auch eher feature drer View Klasse
self
.
_vlines
(
view
,
mark
,
mark_gt
,
mark_lt
)
# TODO self._x sollte eine array sein
npx
=
np
.
array
(
self
.
_x
)
if
mark_gt
:
poss
=
npx
[
view
>
mark_gt
]
for
pos
in
poss
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#a6e22e'
,
alpha
=
0.3
,
linewidth
=
3
)
if
mark_lt
:
poss
=
npx
[
view
<
mark_lt
]
for
pos
in
poss
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#f92672'
,
alpha
=
0.3
,
linewidth
=
3
)
if
mark
:
for
pos
in
mark
:
self
.
_ax
.
axvline
(
pos
,
color
=
'#66d9ef'
,
alpha
=
0.3
,
linewidth
=
3
)
self
.
_axt
.
legend
()
self
.
_axt
.
legend
()
...
...
testing/bootstrap.py
View file @
628af44f
from
itten.movie
import
Movie
from
itten.movie
import
Movie
from
itten.views
import
MultivariateSequence
from
itten.views
import
MultivariateSequence
from
itten.views
import
UnivariateSequence
from
itten.visuals
import
MultivariatePlot
from
itten.visuals
import
MultivariatePlot
from
itten.visuals
import
UnivariatePlot
movie
=
Movie
(
prefix
=
'wwz_'
,
folder
=
'../DHd-2017/Data/Frames/WWZ/'
)
movie
=
Movie
(
prefix
=
'wwz_'
,
folder
=
'../DHd-2017/Data/Frames/WWZ/'
)
# movie._frames.start = 367
# movie._frames.start = 367
# movie._frames.end = 1000
# movie._frames.end = 1000
cont
=
MultivariateSequence
(
movie
.
_frames
,)
cont
=
MultivariateSequence
(
movie
.
_frames
,)
cont
.
populate
(
frm_stp
=
1
,
ctrst
=
'saturation'
)
# cont = UnivariateSequence(movie._frames,)
cont
.
populate
(
frm_stp
=
3
,
ctrst
=
'light_dark'
)
viz
=
MultivariatePlot
(
cont
)
viz
=
MultivariatePlot
(
cont
)
viz
.
plot
(
cont
,
mark
=
[
243
,
1885
,
3430
,
4237
,
4543
])
viz
.
plot
(
cont
,
mark
=
[
243
,
1885
,
3430
,
4237
,
4543
])
# cont.seqper(frm_stp=5, ctrst='saturation', perc=50)
# cont.seqper(frm_stp=5, ctrst='saturation', perc=50)
...
...
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