Skip to content
Snippets Groups Projects
Commit 0ae6af36 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Unify plot/show

parent 93f159ce
No related branches found
No related tags found
1 merge request!235Unify plot/show
Pipeline #90371 passed
...@@ -133,7 +133,7 @@ class ProcessCollection: ...@@ -133,7 +133,7 @@ class ProcessCollection:
""" """
self._collection.add(process) self._collection.add(process)
def draw_lifetime_chart( def plot(
self, self,
ax: Optional[Axes] = None, ax: Optional[Axes] = None,
show_name: bool = True, show_name: bool = True,
......
...@@ -898,7 +898,7 @@ class Schedule: ...@@ -898,7 +898,7 @@ class Schedule:
"""Reset all the y-locations in the schedule to None""" """Reset all the y-locations in the schedule to None"""
self._y_locations = defaultdict(lambda: None) self._y_locations = defaultdict(lambda: None)
def plot_in_axes(self, ax: Axes, operation_gap: Optional[float] = None) -> None: def plot(self, ax: Axes, operation_gap: Optional[float] = None) -> None:
""" """
Plot the schedule in a :class:`matplotlib.axes.Axes` or subclass. Plot the schedule in a :class:`matplotlib.axes.Axes` or subclass.
...@@ -912,9 +912,9 @@ class Schedule: ...@@ -912,9 +912,9 @@ class Schedule:
""" """
self._plot_schedule(ax, operation_gap=operation_gap) self._plot_schedule(ax, operation_gap=operation_gap)
def plot(self, operation_gap: Optional[float] = None) -> None: def show(self, operation_gap: Optional[float] = None) -> None:
""" """
Plot the schedule. Will display based on the current Matplotlib backend. Show the schedule. Will display based on the current Matplotlib backend.
Parameters Parameters
---------- ----------
......
...@@ -27,9 +27,7 @@ a0 = ConstantMultiplication(0.7, add1, "A0") ...@@ -27,9 +27,7 @@ a0 = ConstantMultiplication(0.7, add1, "A0")
add4 = Addition(a0, add3, "ADD4") add4 = Addition(a0, add3, "ADD4")
out1 = Output(add4, "OUT1") out1 = Output(add4, "OUT1")
sfg = SFG( sfg = SFG(inputs=[in1], outputs=[out1], name="Second-order direct form IIR filter")
inputs=[in1], outputs=[out1], name="Second-order direct form IIR filter"
)
# %% # %%
# Set latencies and execution times # Set latencies and execution times
...@@ -42,4 +40,4 @@ sfg.set_execution_time_of_type(Addition.type_name(), 1) ...@@ -42,4 +40,4 @@ sfg.set_execution_time_of_type(Addition.type_name(), 1)
# Create schedule # Create schedule
schedule = Schedule(sfg, cyclic=True) schedule = Schedule(sfg, cyclic=True)
schedule.plot() schedule.show()
...@@ -6,11 +6,7 @@ Three-point Winograd DFT ...@@ -6,11 +6,7 @@ Three-point Winograd DFT
from math import cos, pi, sin from math import cos, pi, sin
from b_asic.core_operations import ( from b_asic.core_operations import Addition, ConstantMultiplication, Subtraction
Addition,
ConstantMultiplication,
Subtraction,
)
from b_asic.schedule import Schedule from b_asic.schedule import Schedule
from b_asic.signal_flow_graph import SFG from b_asic.signal_flow_graph import SFG
from b_asic.special_operations import Input, Output from b_asic.special_operations import Input, Output
...@@ -53,6 +49,6 @@ sfg.set_execution_time_of_type(Subtraction.type_name(), 1) ...@@ -53,6 +49,6 @@ sfg.set_execution_time_of_type(Subtraction.type_name(), 1)
# %% # %%
# Generate schedule # Generate schedule
schedule = Schedule(sfg, cyclic=True) schedule = Schedule(sfg, cyclic=True)
schedule.plot() schedule.show()
pc = schedule.get_memory_variables() pc = schedule.get_memory_variables()
...@@ -14,13 +14,13 @@ class TestProcessCollectionPlainMemoryVariable: ...@@ -14,13 +14,13 @@ class TestProcessCollectionPlainMemoryVariable:
@pytest.mark.mpl_image_compare(style='mpl20') @pytest.mark.mpl_image_compare(style='mpl20')
def test_draw_process_collection(self, simple_collection): def test_draw_process_collection(self, simple_collection):
fig, ax = plt.subplots() fig, ax = plt.subplots()
simple_collection.draw_lifetime_chart(ax=ax, show_markers=False) simple_collection.plot(ax=ax, show_markers=False)
return fig return fig
@pytest.mark.mpl_image_compare(style='mpl20') @pytest.mark.mpl_image_compare(style='mpl20')
def test_draw_matrix_transposer_4(self): def test_draw_matrix_transposer_4(self):
fig, ax = plt.subplots() fig, ax = plt.subplots()
generate_matrix_transposer(4).draw_lifetime_chart(ax=ax) generate_matrix_transposer(4).plot(ax=ax)
return fig return fig
def test_split_memory_variable(self, simple_collection: ProcessCollection): def test_split_memory_variable(self, simple_collection: ProcessCollection):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment