aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/.~lock.shell.nix#1
-rw-r--r--src/Test_Plots/test.py57
-rw-r--r--src/Test_Plots/test10.py53
-rw-r--r--src/Test_Plots/test1_updating_series_data.py30
-rw-r--r--src/Test_Plots/test2_axis_limis.py40
-rw-r--r--src/Test_Plots/test3_custom_axis_labels.py34
-rw-r--r--src/Test_Plots/test4_multiple_y_axes.py25
-rw-r--r--src/Test_Plots/test5_annotations.py32
-rw-r--r--src/Test_Plots/test6_drag_points_and_lines.py26
-rw-r--r--src/Test_Plots/test7_querying.py37
-rw-r--r--src/Test_Plots/test8_custom_context_menus.py33
-rw-r--r--src/Test_Plots/test9_colors_and_styles.py50
-rwxr-xr-xsrc/sketch.py64
13 files changed, 470 insertions, 12 deletions
diff --git a/src/.~lock.shell.nix# b/src/.~lock.shell.nix#
deleted file mode 100644
index 51a425a..0000000
--- a/src/.~lock.shell.nix#
+++ /dev/null
@@ -1 +0,0 @@
-,sara,fading2.ost.ch,06.11.2021 14:06,file:///home/sara/.config/libreoffice/4; \ No newline at end of file
diff --git a/src/Test_Plots/test.py b/src/Test_Plots/test.py
new file mode 100644
index 0000000..3fb0d51
--- /dev/null
+++ b/src/Test_Plots/test.py
@@ -0,0 +1,57 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+import qpks as qp
+
+q = qp.qpsk_nogui()
+
+dpg.create_context()
+
+# data = q.analog_random_source_x_0
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+sindatay2 = []
+for i in range(0, 100):
+ sindatay2.append(2 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=500, height=400):
+ # create a theme for the plot
+ with dpg.theme(tag="plot_theme"):
+ with dpg.theme_component(dpg.mvStemSeries):
+ dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots)
+
+ with dpg.theme_component(dpg.mvScatterSeries):
+ dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots)
+
+ # create plot
+ with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1):
+
+ # optionally create legend
+ dpg.add_plot_legend()
+
+ # REQUIRED: create x and y axes
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis")
+
+ # series belong to a y axis
+ # dpg.add_stem_series(data, sindatay, label="Source", parent="yaxis", tag="series_data")
+ dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data")
+ dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2")
+
+ # apply theme to series
+ dpg.bind_item_theme("series_data", "plot_theme")
+ dpg.bind_item_theme("series_data2", "plot_theme")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file
diff --git a/src/Test_Plots/test10.py b/src/Test_Plots/test10.py
new file mode 100644
index 0000000..d478d9a
--- /dev/null
+++ b/src/Test_Plots/test10.py
@@ -0,0 +1,53 @@
+from dearpygui.core import *
+from dearpygui.simple import *
+from math import cos
+
+def plot_callback(sender, data):
+ # keeping track of frames
+ frame_count = get_data("frame_count")
+ frame_count += 1
+ add_data("frame_count", frame_count)
+
+ # updating plot data
+ plot_datax = get_data("plot_datax")
+ plot_datay = get_data("plot_datay")
+ if len(plot_datax) > 2000:
+ frame_count = 0
+ plot_datax.clear()
+ plot_datay.clear()
+ plot_datax.append(3.14 * frame_count / 180)
+ plot_datay.append(cos(3 * 3.14 * frame_count / 180))
+ add_data("plot_datax", plot_datax)
+ add_data("plot_datay", plot_datay)
+
+ # plotting new data
+ add_line_series("Plot", "Cos", plot_datax, plot_datay, weight=2)
+
+with window("Tutorial", width=500, height=500):
+ add_plot("Plot", height=-1)
+ add_data("plot_datax", [])
+ add_data("plot_datay", [])
+ add_data("frame_count", 0)
+ add_input_text("freq")
+ with menu_bar("Main Menu Bar"):
+ with menu("File"):
+ add_menu_item("test")
+ set_render_callback(plot_callback)
+
+with window("Heat", width=500, height=500):
+ add_plot("HeatPlot", show_color_scale=False, scale_min=0.0, scale_max=6.0,
+ scale_height=400, no_legend=True,
+ no_mouse_pos=True, xaxis_lock_min=True, xaxis_lock_max=True, xaxis_no_gridlines=True, xaxis_no_tick_marks=True,
+ yaxis_no_gridlines=True, yaxis_no_tick_marks=True, yaxis_lock_min=True, yaxis_lock_max=True, height=400)
+ set_color_map("HeatPlot", 6)
+ values = [0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0,
+ 2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0,
+ 1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0,
+ 0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0,
+ 0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0,
+ 1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1,
+ 0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3]
+ add_heat_series("HeatPlot", "heat data", values, 7, 7, 0, 6, format='')
+
+
+start_dearpygui() \ No newline at end of file
diff --git a/src/Test_Plots/test1_updating_series_data.py b/src/Test_Plots/test1_updating_series_data.py
new file mode 100644
index 0000000..1371008
--- /dev/null
+++ b/src/Test_Plots/test1_updating_series_data.py
@@ -0,0 +1,30 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+# creating data
+sindatax = []
+sindatay = []
+for i in range(0, 500):
+ sindatax.append(i / 1000)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 1000))
+
+with dpg.window(label="Tutorial"):
+ # create plot
+ with dpg.plot(label="Line Series", height=400, width=400):
+ # optionally create legend
+ dpg.add_plot_legend()
+
+ # REQUIRED: create x and y axes
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis")
+
+ # series belong to a y axis
+ dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file
diff --git a/src/Test_Plots/test2_axis_limis.py b/src/Test_Plots/test2_axis_limis.py
new file mode 100644
index 0000000..bdfeda1
--- /dev/null
+++ b/src/Test_Plots/test2_axis_limis.py
@@ -0,0 +1,40 @@
+import dearpygui.dearpygui as dpg
+from math import sin, cos
+
+dpg.create_context()
+
+sindatax = []
+sindatay = []
+for i in range(0, 500):
+ sindatax.append(i / 1000)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 1000))
+
+def update_series():
+
+ cosdatax = []
+ cosdatay = []
+ for i in range(0, 500):
+ cosdatax.append(i / 1000)
+ cosdatay.append(0.5 + 0.5 * cos(50 * i / 1000))
+ dpg.set_value('series_tag', [cosdatax, cosdatay])
+ dpg.set_item_label('series_tag', "0.5 + 0.5 * cos(x)")
+
+with dpg.window(label="Tutorial", tag="win"):
+ dpg.add_button(label="Update Series", callback=update_series)
+ # create plot
+ with dpg.plot(label="Line Series", height=400, width=400):
+ # optionally create legend
+ dpg.add_plot_legend()
+
+ # REQUIRED: create x and y axes
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="y_axis")
+
+ # series belong to a y axis
+ dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis", tag="series_tag")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context()
diff --git a/src/Test_Plots/test3_custom_axis_labels.py b/src/Test_Plots/test3_custom_axis_labels.py
new file mode 100644
index 0000000..be6b80b
--- /dev/null
+++ b/src/Test_Plots/test3_custom_axis_labels.py
@@ -0,0 +1,34 @@
+import dearpygui.dearpygui as dpg
+
+dpg.create_context()
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ with dpg.group(horizontal=True):
+ dpg.add_button(label="fit y", callback=lambda: dpg.fit_axis_data("y_axis"))
+ dpg.add_button(label="unlock x limits", callback=lambda: dpg.set_axis_limits_auto("x_axis"))
+ dpg.add_button(label="unlock y limits", callback=lambda: dpg.set_axis_limits_auto("y_axis"))
+ dpg.add_button(label="print limits x", callback=lambda: print(dpg.get_axis_limits("x_axis")))
+ dpg.add_button(label="print limits y", callback=lambda: print(dpg.get_axis_limits("y_axis")))
+
+ with dpg.plot(label="Bar Series", height=-1, width=-1):
+ dpg.add_plot_legend()
+
+ # create x axis
+ dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True, tag="x_axis")
+ dpg.set_axis_limits(dpg.last_item(), 9, 33)
+ dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31)))
+
+ # create y axis
+ dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="y_axis")
+ dpg.set_axis_limits("y_axis", 0, 110)
+
+ # add series to y axis
+ dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="y_axis")
+ dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="y_axis")
+ dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="y_axis")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file
diff --git a/src/Test_Plots/test4_multiple_y_axes.py b/src/Test_Plots/test4_multiple_y_axes.py
new file mode 100644
index 0000000..ebaac7e
--- /dev/null
+++ b/src/Test_Plots/test4_multiple_y_axes.py
@@ -0,0 +1,25 @@
+import dearpygui.dearpygui as dpg
+
+dpg.create_context()
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ with dpg.plot(label="Bar Series", height=-1, width=-1):
+ dpg.add_plot_legend()
+
+ # create x axis
+ dpg.add_plot_axis(dpg.mvXAxis, label="Student", no_gridlines=True)
+ dpg.set_axis_ticks(dpg.last_item(), (("S1", 11), ("S2", 21), ("S3", 31)))
+
+ # create y axis
+ dpg.add_plot_axis(dpg.mvYAxis, label="Score", tag="yaxis_tag")
+
+ # add series to y axis
+ dpg.add_bar_series([10, 20, 30], [100, 75, 90], label="Final Exam", weight=1, parent="yaxis_tag")
+ dpg.add_bar_series([11, 21, 31], [83, 75, 72], label="Midterm Exam", weight=1, parent="yaxis_tag")
+ dpg.add_bar_series([12, 22, 32], [42, 68, 23], label="Course Grade", weight=1, parent="yaxis_tag")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file
diff --git a/src/Test_Plots/test5_annotations.py b/src/Test_Plots/test5_annotations.py
new file mode 100644
index 0000000..9deff6b
--- /dev/null
+++ b/src/Test_Plots/test5_annotations.py
@@ -0,0 +1,32 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ with dpg.plot(label="Annotations", height=-1, width=-1):
+ dpg.add_plot_legend()
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y")
+ dpg.add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent=dpg.last_item())
+
+ # annotations belong to the plot NOT axis
+ dpg.add_plot_annotation(label="BL", default_value=(0.25, 0.25), offset=(-15, 15), color=[255, 255, 0, 255])
+ dpg.add_plot_annotation(label="BR", default_value=(0.75, 0.25), offset=(15, 15), color=[255, 255, 0, 255])
+ dpg.add_plot_annotation(label="TR not clampled", default_value=(0.75, 0.75), offset=(-15, -15),
+ color=[255, 255, 0, 255], clamped=False)
+ dpg.add_plot_annotation(label="TL", default_value=(0.25, 0.75), offset=(-15, -15), color=[255, 255, 0, 255])
+ dpg.add_plot_annotation(label="Center", default_value=(0.5, 0.5), color=[255, 255, 0, 255])
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context()
diff --git a/src/Test_Plots/test6_drag_points_and_lines.py b/src/Test_Plots/test6_drag_points_and_lines.py
new file mode 100644
index 0000000..c6d8862
--- /dev/null
+++ b/src/Test_Plots/test6_drag_points_and_lines.py
@@ -0,0 +1,26 @@
+import dearpygui.dearpygui as dpg
+
+dpg.create_context()
+
+def print_val(sender):
+ print(dpg.get_value(sender))
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ with dpg.plot(label="Drag Lines/Points", height=-1, width=-1):
+ dpg.add_plot_legend()
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.set_axis_limits(dpg.last_item(), -5, 5)
+ dpg.add_plot_axis(dpg.mvYAxis, label="y")
+ dpg.set_axis_limits(dpg.last_item(), -5, 5)
+
+ # drag lines/points belong to the plot NOT axis
+ dpg.add_drag_line(label="dline1", color=[255, 0, 0, 255], default_value=2.0, callback=print_val)
+ dpg.add_drag_line(label="dline2", color=[255, 255, 0, 255], vertical=False, default_value=-2, callback=print_val)
+ dpg.add_drag_point(label="dpoint1", color=[255, 0, 255, 255], default_value=(1.0, 1.0), callback=print_val)
+ dpg.add_drag_point(label="dpoint2", color=[255, 0, 255, 255], default_value=(-1.0, 1.0), callback=print_val)
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file
diff --git a/src/Test_Plots/test7_querying.py b/src/Test_Plots/test7_querying.py
new file mode 100644
index 0000000..06f3ceb
--- /dev/null
+++ b/src/Test_Plots/test7_querying.py
@@ -0,0 +1,37 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=400, height=600):
+ dpg.add_text("Click and drag the middle mouse button over the top plot!")
+
+
+ def query(sender, app_data, user_data):
+ dpg.set_axis_limits("xaxis_tag2", app_data[0], app_data[1])
+ dpg.set_axis_limits("yaxis_tag2", app_data[2], app_data[3])
+
+
+ # plot 1
+ with dpg.plot(no_title=True, height=200, callback=query, query=True, no_menus=True, width=-1):
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y")
+ dpg.add_line_series(sindatax, sindatay, parent=dpg.last_item())
+
+ # plot 2
+ with dpg.plot(no_title=True, height=200, no_menus=True, width=-1):
+ dpg.add_plot_axis(dpg.mvXAxis, label="x1", tag="xaxis_tag2")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y1", tag="yaxis_tag2")
+ dpg.add_line_series(sindatax, sindatay, parent="yaxis_tag2")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context() \ No newline at end of file
diff --git a/src/Test_Plots/test8_custom_context_menus.py b/src/Test_Plots/test8_custom_context_menus.py
new file mode 100644
index 0000000..b459d15
--- /dev/null
+++ b/src/Test_Plots/test8_custom_context_menus.py
@@ -0,0 +1,33 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=400, height=400):
+ # create plot
+ dpg.add_text("Right click a series in the legend!")
+ with dpg.plot(label="Line Series", height=-1, width=-1):
+ dpg.add_plot_legend()
+
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis")
+
+ # series 1
+ dpg.add_line_series(sindatax, sindatay, label="series 1", parent="yaxis", tag="series_1")
+ dpg.add_button(label="Delete Series 1", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_1"))
+
+ # series 2
+ dpg.add_line_series(sindatax, sindatay, label="series 2", parent="yaxis", tag="series_2")
+ dpg.add_button(label="Delete Series 2", parent=dpg.last_item(), callback=lambda: dpg.delete_item("series_2"))
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context()
diff --git a/src/Test_Plots/test9_colors_and_styles.py b/src/Test_Plots/test9_colors_and_styles.py
new file mode 100644
index 0000000..2f1c7ef
--- /dev/null
+++ b/src/Test_Plots/test9_colors_and_styles.py
@@ -0,0 +1,50 @@
+import dearpygui.dearpygui as dpg
+from math import sin
+
+dpg.create_context()
+
+sindatax = []
+sindatay = []
+for i in range(0, 100):
+ sindatax.append(i / 100)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 100))
+sindatay2 = []
+for i in range(0, 100):
+ sindatay2.append(2 + 0.5 * sin(50 * i / 100))
+
+with dpg.window(label="Tutorial", width=500, height=400):
+ # create a theme for the plot
+ with dpg.theme(tag="plot_theme"):
+ with dpg.theme_component(dpg.mvStemSeries):
+ dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 255, 0), category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Diamond, category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 7, category=dpg.mvThemeCat_Plots)
+
+ with dpg.theme_component(dpg.mvScatterSeries):
+ dpg.add_theme_color(dpg.mvPlotCol_Line, (60, 150, 200), category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_Marker, dpg.mvPlotMarker_Square, category=dpg.mvThemeCat_Plots)
+ dpg.add_theme_style(dpg.mvPlotStyleVar_MarkerSize, 4, category=dpg.mvThemeCat_Plots)
+
+ # create plot
+ with dpg.plot(tag="plot", label="Line Series", height=-1, width=-1):
+
+ # optionally create legend
+ dpg.add_plot_legend()
+
+ # REQUIRED: create x and y axes
+ dpg.add_plot_axis(dpg.mvXAxis, label="x")
+ dpg.add_plot_axis(dpg.mvYAxis, label="y", tag="yaxis")
+
+ # series belong to a y axis
+ dpg.add_stem_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="yaxis", tag="series_data")
+ dpg.add_scatter_series(sindatax, sindatay2, label="2 + 0.5 * sin(x)", parent="yaxis", tag="series_data2")
+
+ # apply theme to series
+ dpg.bind_item_theme("series_data", "plot_theme")
+ dpg.bind_item_theme("series_data2", "plot_theme")
+
+dpg.create_viewport(title='Custom Title', width=800, height=600)
+dpg.setup_dearpygui()
+dpg.show_viewport()
+dpg.start_dearpygui()
+dpg.destroy_context()
diff --git a/src/sketch.py b/src/sketch.py
index 49efd5e..a0cfa51 100755
--- a/src/sketch.py
+++ b/src/sketch.py
@@ -5,6 +5,8 @@ from dearpygui.demo import show_demo
import qpks as qp
+from math import sin #für test Sijnal
+
# Create GL context and initialize DearPyGUI
create_context()
create_viewport()
@@ -77,26 +79,39 @@ with window(label="Example Window"):
q = qp.qpsk_nogui() # Klasse initalisieren !!!
-with window(label="QPSK", width=800, height=800, on_close=_on_params_close, pos=(100,100), tag="rx_win"):
+with window(label="QPSK", width=1500, height=800, on_close=_on_params_close, pos=(100,100), tag="rx_win"):
with node_editor(callback=_on_rx_node_link, delink_callback=_on_rx_node_delink):
- with node(label="USRP Source (Random Source)", pos=(20,100)):
+ with node(label="USRP Source ", pos=(20,100)):
with node_attribute(tag="src_out", attribute_type=mvNode_Attr_Output):
- add_text("Signal from antenna")
+ add_text("Signal Source Random")
print(q.analog_random_source_x_0)
- add_text(q.analog_random_source_x_0)
- add_text(qp.test)
- add_text(q.test_2(1))
+ # TO DO: Signal Plot
+
+ with node(label="Constellation Modulator", pos=(200,200)):
+ with node_attribute(tag="modul_in", attribute_type=mvNode_Attr_Input):
+ add_text("Input")
+ add_text(f'Sample {q.sps}')
+ with node_attribute(tag="modul_out", attribute_type=mvNode_Attr_Output):
+ add_text("Output")
+
+ with node(label="Channel Model", pos=(420,100)):
+ with node_attribute(tag="channel_in", attribute_type=mvNode_Attr_Input):
+ add_text("Input")
- with node(label="Clock Sync", pos=(200,200)):
+ with node_attribute(tag="channel_out", attribute_type=mvNode_Attr_Output):
+ add_text("Output")
+
+ with node(label="Clock Sync", pos=(550,200)):
with node_attribute(tag="clksync_in", attribute_type=mvNode_Attr_Input):
add_text("Input")
with node_attribute(tag="clksync_out", attribute_type=mvNode_Attr_Output):
add_text("Synchronized")
- with node(label="Equalizer", pos=(350,100)):
+
+ with node(label="Equalizer", pos=(700,100)):
with node_attribute(attribute_type=mvNode_Attr_Static):
add_input_float(label="Gain", width=150)
@@ -106,7 +121,8 @@ with window(label="QPSK", width=800, height=800, on_close=_on_params_close, pos=
with node_attribute(tag="eq_out", attribute_type=mvNode_Attr_Output):
add_text("Equalized")
- with node(label="Phase Locked Loop", pos=(600, 200)):
+
+ with node(label="Phase Locked Loop", pos=(950, 200)):
with node_attribute(tag="pll_in", attribute_type=mvNode_Attr_Input):
add_text("Input")
@@ -114,15 +130,41 @@ with window(label="QPSK", width=800, height=800, on_close=_on_params_close, pos=
add_text("Locked")
- add_node_link(get_alias_id("src_out"), get_alias_id("clksync_in"))
+ add_node_link(get_alias_id("src_out"), get_alias_id("modul_in"))
+ add_node_link(get_alias_id("modul_out"), get_alias_id("channel_in"))
+ add_node_link(get_alias_id("channel_out"), get_alias_id("clksync_in"))
add_node_link(get_alias_id("clksync_out"), get_alias_id("eq_in"))
add_node_link(get_alias_id("eq_out"), get_alias_id("pll_in"))
+
+
#================================================
-# Plot Window
+# Plot Time Window Test
+
+# creating data
+sindatax = []
+sindatay = []
+for i in range(0, 500):
+ sindatax.append(i / 1000)
+ sindatay.append(0.5 + 0.5 * sin(50 * i / 1000))
+
with window(label="Plots"):
add_text("Hello world")
+ # create plot
+ with plot(label="Line Series", height=400, width=400):
+ # optionally create legend
+ add_plot_legend()
+
+ # REQUIRED: create x and y axes
+ add_plot_axis(mvXAxis, label="x")
+ add_plot_axis(mvYAxis, label="y", tag="y_axis")
+
+ # series belong to a y axis
+ add_line_series(sindatax, sindatay, label="0.5 + 0.5 * sin(x)", parent="y_axis")
#================================================
+
+
+
# Start window and main loop