Commit c516ddfd authored by Niels-Oliver Walkowski's avatar Niels-Oliver Walkowski
Browse files

implement UnivariatePlot class

parent eb0b2e17
......@@ -349,8 +349,8 @@ class UnivariateSequence(View):
return mean, mad
# TODO: Kurve muß unbeding von cuts bereinigt werde und interpolation funktioniert da nicht
def seqmean(self, variant=['mean', 'dev'], ctrst='light_dark',
method='luminance', frm_stp=10, bins=256):
def seqmean(self, ctrst='light_dark',
method='luminance', frm_stp=10, bins=256):
"""Creates a scatterplot for the dynamic of contrast across movie frames
frm_fld: path to folder with movie images
......@@ -360,7 +360,6 @@ class UnivariateSequence(View):
save: save plot also to disk
"""
# set class properties
self._variant = variant
self._contrast = ctrst
self._method = method
self._frame_step = frm_stp
......@@ -403,8 +402,8 @@ class UnivariateSequence(View):
contrast_points = None
# TODO: Kurve muß unbeding von cuts bereinigt werde und interpolation funktioniert da nicht
def seqmad(self, variant=['mean', 'dev'], ctrst='light_dark',
method='luminance', frm_stp=10, bins=256):
def seqmad(self, ctrst='light_dark',
method='luminance', frm_stp=10, bins=256):
"""Creates a scatterplot for the dynamic of contrast across movie frames
frm_fld: path to folder with movie images
......@@ -414,7 +413,6 @@ class UnivariateSequence(View):
save: save plot also to disk
"""
# set class properties
self._variant = variant
self._contrast = ctrst
self._method = method
self._frame_step = frm_stp
......
......@@ -33,6 +33,7 @@ class SequencePlot(object):
ax.set_xlim(view._frames.start - 20, view._frames.end + 20)
# Beschriftung der Y-Achse
# TODO funktioniert nicht richtig
ax.set_ylim(-1, view._bins + 1)
loc = plticker.FixedLocator(range(0, view._bins + 1, int(view._bins / 8)))
ax.yaxis.set_major_locator(loc)
......@@ -41,6 +42,7 @@ class SequencePlot(object):
# obere x-achse mit zeitlich versetzten werten
axt = ax.twiny()
axt.set_xlim(ax.get_xlim())
axt.set_ylim(ax.get_ylim())
# loc = plticker.MultipleLocator(base=tick_freq)
# loc = plticker.LinearLocator(20)
loc = plticker.FixedLocator(range(int(tick_step / 2), view._frames.end, tick_step))
......@@ -92,3 +94,31 @@ class MultivariatePlot(SequencePlot):
self.fig.savefig("intest.png", dpi=200)
return self.fig, self._ax
class UnivariatePlot(SequencePlot):
"""Lineplot that shows one featur per fram"""
def __init__(self):
super(UnivariatePlot, self).__init__()
self.fig = plt.figure()
self._ax = plt.axes()
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.fig.tight_layout()
self.fig.set_size_inches(self.width, self.height)
self.fig.savefig("intest.png", dpi=200)
return self.fig, self._ax
from itten.movie import Movie
from itten.views import UnivariateSequence
from itten.visuals import MultivariatePlot
from itten.visuals import UnivariatePlot
movie = Movie(prefix='rec_', folder='../DHd-2017/Data/Frames/Rec/')
cont = UnivariateSequence(movie._frames)
# cont.populate(frm_stp=50)
cont.seqmean(frm_stp=100)
viz = UnivariatePlot()
viz.plot(cont)
# viz = MultivariatePlot()
# fig, ax = viz.plot(cont)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment