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
35c9da52
Commit
35c9da52
authored
Dec 29, 2016
by
Niels-Oliver Walkowski
Browse files
capsulate components in UnivariateSequence
in order to offer plotting of multiple features
parent
c516ddfd
Changes
2
Hide whitespace changes
Inline
Side-by-side
itten/visuals.py
View file @
35c9da52
...
...
@@ -7,9 +7,17 @@ import matplotlib.ticker as plticker
class
SequencePlot
(
object
):
"""Key class for visualizations with two axis"""
def
__init__
(
self
,
width
=
40
,
height
=
3
):
def
__init__
(
self
,
view
,
width
=
40
,
height
=
5
):
self
.
width
=
width
self
.
height
=
height
self
.
_x
=
self
.
get_xpos
(
view
)
# outsourcen in Frames Class und dann hier löschen
def
get_xpos
(
self
,
view
):
"""calculate frame numbers for x-ticks"""
# 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
,
view
.
_frame_step
)]
# um X-Achse Minuten anzeigen zu lassen
def
_timelabels
(
self
,
val
,
pos
):
min
,
sec
=
divmod
(
int
(
val
),
60
)
...
...
@@ -66,6 +74,12 @@ class SequencePlot(object):
return
(
ax
,
axt
)
def
saveplt
(
self
):
self
.
fig
.
tight_layout
()
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
self
.
fig
.
savefig
(
"testexp.png"
,
dpi
=
200
)
class
MultivariatePlot
(
SequencePlot
):
"""Scatterplot that shows n features per frame"""
...
...
@@ -98,27 +112,18 @@ class MultivariatePlot(SequencePlot):
class
UnivariatePlot
(
SequencePlot
):
"""Lineplot that shows one featur per fram"""
def
__init__
(
self
):
super
(
UnivariatePlot
,
self
).
__init__
()
def
__init__
(
self
,
view
):
super
(
UnivariatePlot
,
self
).
__init__
(
view
)
# TODO die können evtl. noch in die super class
self
.
fig
=
plt
.
figure
()
self
.
_ax
=
plt
.
axes
()
self
.
_ax
,
self
.
_axt
=
self
.
ittenstyle
(
self
.
_ax
,
view
)
self
.
plot
(
view
)
def
plot
(
self
,
view
):
# TODO Die Frame No. Range könnte ich auch besser zu einer Methode von Frames machen
x
=
[
nr
for
nr
in
range
(
view
.
_frames
.
start
,
view
.
_frames
.
end
,
view
.
_frame_step
)]
# um X-Achse Minuten anzeigen zu lassen
self
.
_ax
,
axt
=
self
.
ittenstyle
(
self
.
_ax
,
view
)
# Interpolation mit savitzky_golay funktioniert nicht
# contrast_points = savitzky_golay(np.array(contrast_points), 51, 7)
axt
.
plot
(
x
,
view
)
self
.
_
axt
.
plot
(
self
.
_
x
,
view
)
self
.
fig
.
tight_layout
()
self
.
fig
.
set_size_inches
(
self
.
width
,
self
.
height
)
self
.
fig
.
savefig
(
"intest.png"
,
dpi
=
200
)
return
self
.
fig
,
self
.
_ax
return
self
.
fig
testing/bootstrap.py
View file @
35c9da52
...
...
@@ -5,7 +5,7 @@ from itten.visuals import UnivariatePlot
movie
=
Movie
(
prefix
=
'rec_'
,
folder
=
'../DHd-2017/Data/Frames/Rec/'
)
cont
=
UnivariateSequence
(
movie
.
_frames
)
cont
.
seqmean
(
frm_stp
=
100
)
viz
=
UnivariatePlot
()
viz
=
UnivariatePlot
(
cont
)
viz
.
plot
(
cont
)
# viz = MultivariatePlot()
...
...
Write
Preview
Markdown
is supported
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