mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
refactor: monitor_scatter_2D.py _init_database replaced with defaultdict
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
# pylint: disable = no-name-in-module,missing-module-docstring
|
# pylint: disable = no-name-in-module,missing-module-docstring
|
||||||
import time
|
import time
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
@ -157,15 +158,8 @@ class BECMonitor2DScatter(QWidget):
|
|||||||
dict: The database.
|
dict: The database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
database = {}
|
database = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
|
||||||
for plot in self.plot_data:
|
|
||||||
plot_name = plot.get("plot_name", "Plot")
|
|
||||||
database[plot_name] = {}
|
|
||||||
for axis in ["x", "y", "z"]:
|
|
||||||
database[plot_name][axis] = {}
|
|
||||||
for signal in plot["signals"][axis]:
|
|
||||||
database[plot_name][axis][signal["name"]] = []
|
|
||||||
print(database)
|
|
||||||
return database
|
return database
|
||||||
|
|
||||||
def _init_ui(self, num_columns: int = 3) -> None:
|
def _init_ui(self, num_columns: int = 3) -> None:
|
||||||
|
Reference in New Issue
Block a user