Skip to content

Commit

Permalink
Actualización docstring #29
Browse files Browse the repository at this point in the history
  • Loading branch information
Enmartz committed Dec 13, 2022
1 parent 2bb7ea9 commit e40fbe9
Show file tree
Hide file tree
Showing 2 changed files with 254 additions and 0 deletions.
173 changes: 173 additions & 0 deletions Desarrollo/ReDS/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@

# custom toolbar with lorem ipsum text
class CustomToolbar(NavigationToolbar2QT):
'''
Custom toolbar for experiment reports
Parameters
----------
canvas_ : FigureCanvasQTAgg
Canvas of the figure
parent_ : QWidget
Parent widget
Attributes
----------
toolitems : tuple
Tuple of tuples with the toolbar items
'''
def __init__(self, canvas_, parent_):
self.toolitems = (
('Home', 'Volver a la vista original', 'home', 'home'),
Expand All @@ -33,6 +48,28 @@ def __init__(self, canvas_, parent_):


class PerformanceGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the performance of the experiment for main mode
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
performance_data : dict
Dictionary with the performance data
figure : Figure
Figure of the graphic
Methods
-------
update_values(iteracion, error, psnr, ssim, tv)
Update the performance data
update_figure()
Update the figure
'''
def __init__(self, is_complete=True):
self.is_complete = is_complete
self.performance_data = dict(iteracion=[], error=[], psnr=[], ssim=[], tv=[])
Expand Down Expand Up @@ -96,6 +133,28 @@ def update_figure(self):


class ReconstructionGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the reconstruction results of the experiment for main mode
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
report_data : dict
Dictionary with the reported data
figure : Figure
Figure of the graphic
Methods
-------
update_report(report_data)
Update the report data
update_figure()
Update the figure
'''
def __init__(self, is_complete=True):
self.is_complete = is_complete
self.report_data = None
Expand Down Expand Up @@ -203,6 +262,32 @@ def update_figure(self):


class TuningGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the reconstruction results of the experiment for tuning mode
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
algorithm : str
Algorithm name
tuning_data : dict
Dictionary with the tuning data
fixed_params : dict
Dictionary with the fixed parameters
figure : Figure
Figure of the graphic
Methods
-------
update_tuning(algoritm, tuning_data, fixed_params, current_scale)
Update the tuning data
update_figure()
Update the figure
'''
def __init__(self, is_complete):
self.is_complete = is_complete
self.algorithm = None
Expand Down Expand Up @@ -288,6 +373,28 @@ def update_figure(self):


class ComparisonPerformanceGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the reconstruction results of the experiment for comparison mode
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
comparison_data : dict
Dictionary with the comparision data
figure : Figure
Figure of the graphic
Methods
-------
update_values(iteracion, errors, psnrs, ssims, tvs)
Update the values
update_figure()
Update the figure
'''
def __init__(self, is_complete):
self.is_complete = is_complete
self.algorithm_names = ['FISTA', 'GAP', 'TwIST', 'ADMM']
Expand Down Expand Up @@ -351,6 +458,28 @@ def update_figure(self):


class ComparisonReconstructionGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the reconstruction results of the experiment for comparison mode
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
comparison_data : dict
Dictionary with the comparison data
figure : Figure
Figure of the graphic
Methods
-------
update_report(comparison_data)
Update the comparison data
update_figure()
Update the figure
'''
def __init__(self, is_complete):
self.is_complete = is_complete
self.algorithm_names = ['FISTA', 'GAP', 'TwIST', 'ADMM']
Expand Down Expand Up @@ -499,6 +628,28 @@ def update_figure(self):
# ---------------------------------------------- shots ----------------------------------------------

class ShotPerformanceGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the performance of the experiment for shot reconstruction
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
performance_data : dict
Dictionary with the data
figure : Figure
Figure of the graphic
Methods
-------
update_values(iteracion, error, ssim, tv)
Update the values
update_figure()
Update the figure
'''
def __init__(self, is_complete=True):
self.is_complete = is_complete
self.performance_data = dict(iteracion=[], psnr=[], ssim=[], tv=[])
Expand Down Expand Up @@ -574,6 +725,28 @@ def update_figure(self):


class ShotReconstructionGraphic(FigureCanvasQTAgg):
'''
Graphics for visualize the results of the experiment for shot reconstruction
Parameters
----------
is_complete : bool
If the experiment is complete or not
Attributes
----------
report_data : dict
Dictionary with the reported data
figure : Figure
Figure of the graphic
Methods
-------
update_report(report_data)
Update the reported data
update_figure()
Update the figure
'''
def __init__(self, is_complete=True):
self.is_complete = is_complete
self.report_data = None
Expand Down
81 changes: 81 additions & 0 deletions Desarrollo/ReDS/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@


class Worker(QtCore.QObject):
'''
Worker for run experiment in a thread in main mode
Parameters
----------
name : str
Name of the experiment
function : function
Function to run
parameters : dict
Parameters of the function
maxiter : int
Maximum number of iterations
sampling_dict : dict
Dictionary with the sampling information
performance_graphic : pyqtgraph.PlotWidget
Graphic to show the performance
report_graphic : pyqtgraph.PlotWidget
Graphic to show the report
'''
finished = QtCore.pyqtSignal(str, dict, dict)
progress = QtCore.pyqtSignal(str, int, dict, np.ndarray, dict)

Expand Down Expand Up @@ -31,6 +51,22 @@ def run(self):


class TuningWorker(QtCore.QObject):
'''
Worker for run experiment in a thread in tuning mode
Parameters
----------
name : str
Name of the experiment
function : function
Function to run
parameters : dict
Parameters of the function
maxiter : int
Maximum number of iterations
tuning_graphic : pyqtgraph.PlotWidget
Graphic to show the tuning
'''
finished = QtCore.pyqtSignal(str, dict)
progress = QtCore.pyqtSignal(str, int, dict, dict, dict)

Expand All @@ -56,6 +92,26 @@ def run(self):


class ComparisonWorker(QtCore.QObject):
'''
Worker for run experiment in a thread in comparison mode
Parameters
----------
name : str
Name of the experiment
function : function
Function to run
parameters : dict
Parameters of the function
maxiter : int
Maximum number of iterations
sampling_dict : dict
Dictionary with the sampling information
comp_performance_graphic : pyqtgraph.PlotWidget
Graphic to show the performance
comp_report_graphic : pyqtgraph.PlotWidget
Graphic to show the report
'''
finished = QtCore.pyqtSignal(str, dict, dict)
progress = QtCore.pyqtSignal(str, int, tuple, np.ndarray, dict)

Expand Down Expand Up @@ -93,6 +149,13 @@ def run(self):


class TabWorker(QtCore.QObject):
'''
Worker for run tabs in a thread
Parameters
----------
'''
finished = QtCore.pyqtSignal()
progress = QtCore.pyqtSignal()

Expand All @@ -104,6 +167,24 @@ def run(self):
# ------------------------------------------------- Shots -------------------------------------------------

class ShotWorker(QtCore.QObject):
'''
Worker for run experiment in a thread for shot reconstruction
Parameters
----------
name : str
Name of the experiment
function : function
Function to run
maxiter : int
Maximum number of iterations
sampling_dict : dict
Dictionary with the sampling information
performance_graphic : pyqtgraph.PlotWidget
Graphic to show the performance
report_graphic : pyqtgraph.PlotWidget
Graphic to show the report
'''
finished = QtCore.pyqtSignal(str, dict, dict)
progress = QtCore.pyqtSignal(str, int, dict, np.ndarray, dict)

Expand Down

0 comments on commit e40fbe9

Please sign in to comment.