-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh: visualize POC methods when in preprocessing tab (close #15)
- Loading branch information
1 parent
eb46a6c
commit 3e1347d
Showing
11 changed files
with
170 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from matplotlib.figure import Figure | ||
from matplotlib.backends.backend_qt5agg import ( | ||
FigureCanvasQTAgg as FigureCanvas) | ||
|
||
from ..head import custom_widgets | ||
|
||
|
||
class MPLPreproc: | ||
def __init__(self): | ||
"""Matplotlib plot for preprocessing data""" | ||
# Add matplotlib figure | ||
self.figure = Figure(facecolor="none", tight_layout=True, | ||
frameon=True) | ||
self.axis = self.figure.add_subplot(111) | ||
self.axis.set_facecolor('#FFFFFF') | ||
self.canvas = FigureCanvas(self.figure) | ||
self.canvas.draw() | ||
|
||
def add_toolbar(self, widget): | ||
"""Add toolbar to PyQT widget""" | ||
self.toolbar = custom_widgets.NavigationToolbarPreproc( | ||
self.canvas, | ||
widget, | ||
coordinates=True | ||
) | ||
|
||
def clear(self): | ||
self.axis.clear() | ||
self.axis.grid() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Widget containing preprocessing plot""" | ||
from PyQt5 import QtWidgets | ||
|
||
from .mpl_preproc import MPLPreproc | ||
|
||
|
||
class WidgetPlotPreproc(QtWidgets.QWidget): | ||
def __init__(self, *args, **kwargs): | ||
"""Display preprocessing graph with navigation""" | ||
super(WidgetPlotPreproc, self).__init__(*args, **kwargs) | ||
|
||
self.mplvl = QtWidgets.QVBoxLayout(self) | ||
# Setup the matplotlib interface for approach retract plotting | ||
self.mpl_curve = MPLPreproc() | ||
self.mpl_curve.add_toolbar(self) | ||
self.mplvl.addWidget(self.mpl_curve.canvas) | ||
self.mplvl.addWidget(self.mpl_curve.toolbar) | ||
|
||
@property | ||
def fd(self): | ||
return self.parent().parent().parent() | ||
|
||
def update_details(self, details): | ||
"""Update UI with details""" | ||
self.mpl_curve.clear() | ||
if details is None: | ||
return | ||
elif "correct_tip_offset" in details: | ||
meth = details["correct_tip_offset"] | ||
self.mpl_curve.clear() | ||
self.mpl_curve.axis.set_title(meth["method"]) | ||
for key in meth: | ||
if key.startswith("plot "): | ||
self.mpl_curve.axis.plot(*meth[key], label=key[5:]) | ||
self.mpl_curve.axis.legend() | ||
self.mpl_curve.canvas.draw() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.