bec-widgets 0.52.1__py3-none-any.whl → 0.53.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. .git_hooks/pre-commit +3 -0
  2. .gitignore +177 -0
  3. .gitlab/issue_templates/bug_report_template.md +17 -0
  4. .gitlab/issue_templates/documentation_update_template.md +27 -0
  5. .gitlab/issue_templates/feature_request_template.md +40 -0
  6. .gitlab/merge_request_templates/default.md +28 -0
  7. .gitlab-ci.yml +225 -0
  8. .pylintrc +581 -0
  9. .readthedocs.yaml +25 -0
  10. CHANGELOG.md +176 -0
  11. PKG-INFO +33 -0
  12. bec_widgets-0.52.1.dist-info/METADATA → README.md +6 -42
  13. bec_widgets/cli/client.py +9 -9
  14. bec_widgets/cli/rpc_wigdet_handler.py +1 -3
  15. bec_widgets/examples/modular_app/___init__.py +0 -0
  16. bec_widgets/examples/modular_app/modular.ui +92 -0
  17. bec_widgets/examples/modular_app/modular_app.py +197 -0
  18. bec_widgets/examples/motor_movement/motor_control_compilations.py +1 -1
  19. bec_widgets/examples/motor_movement/motor_example.py +3 -12
  20. bec_widgets/utils/bec_dispatcher.py +1 -3
  21. bec_widgets/widgets/dock/dock_area.py +1 -4
  22. bec_widgets/widgets/figure/figure.py +3 -15
  23. bec_widgets/widgets/monitor/config_dialog.py +3 -19
  24. bec_widgets/widgets/monitor/example_configs/config_device.yaml +60 -0
  25. bec_widgets/widgets/monitor/example_configs/config_scans.yaml +92 -0
  26. bec_widgets/widgets/motor_map/motor_map.py +3 -14
  27. bec_widgets/widgets/plots/motor_map.py +2 -9
  28. bec_widgets/widgets/scan_control/scan_control.py +1 -3
  29. bec_widgets-0.53.0.dist-info/METADATA +33 -0
  30. {bec_widgets-0.52.1.dist-info → bec_widgets-0.53.0.dist-info}/RECORD +66 -23
  31. {bec_widgets-0.52.1.dist-info → bec_widgets-0.53.0.dist-info}/WHEEL +1 -2
  32. bec_widgets-0.53.0.dist-info/licenses/LICENSE +29 -0
  33. docs/Makefile +20 -0
  34. docs/_templates/custom-class-template.rst +34 -0
  35. docs/_templates/custom-module-template.rst +66 -0
  36. docs/conf.py +81 -0
  37. docs/developer/developer.md +26 -0
  38. docs/developer/reference.md +10 -0
  39. docs/index.md +39 -0
  40. docs/introduction/introduction.md +18 -0
  41. docs/make.bat +35 -0
  42. docs/requirements.txt +10 -0
  43. docs/user/apps/modular_app.md +6 -0
  44. docs/user/apps/motor_app.md +34 -0
  45. docs/user/apps/motor_app_10fps.gif +0 -0
  46. docs/user/apps/plot_app.md +6 -0
  47. docs/user/apps.md +39 -0
  48. docs/user/customisation.md +13 -0
  49. docs/user/installation.md +46 -0
  50. docs/user/user.md +38 -0
  51. docs/user/widgets/motor.gif +0 -0
  52. docs/user/widgets/scatter_2D.gif +0 -0
  53. docs/user/widgets/w1D.gif +0 -0
  54. docs/user/widgets.md +41 -0
  55. pyproject.toml +94 -0
  56. tests/unit_tests/test_bec_dispatcher.py +3 -26
  57. tests/unit_tests/test_bec_figure.py +1 -5
  58. tests/unit_tests/test_bec_motor_map.py +1 -4
  59. tests/unit_tests/test_config_dialog.py +1 -5
  60. tests/unit_tests/test_configs/config_device.yaml +33 -0
  61. tests/unit_tests/test_configs/config_device_no_entry.yaml +27 -0
  62. tests/unit_tests/test_configs/config_scan.yaml +82 -0
  63. tests/unit_tests/test_motor_control.py +1 -1
  64. tests/unit_tests/test_motor_map.py +5 -20
  65. tests/unit_tests/test_stream_plot.py +2 -12
  66. bec_widgets-0.52.1.dist-info/top_level.txt +0 -2
  67. /bec_widgets-0.52.1.dist-info/LICENSE → /LICENSE +0 -0
@@ -41,14 +41,7 @@ def send_msg_event():
41
41
 
42
42
 
43
43
  @pytest.mark.parametrize(
44
- "topics_msg_list",
45
- [
46
- (
47
- ("topic1", dummy_msg),
48
- ("topic2", dummy_msg),
49
- ("topic3", dummy_msg),
50
- )
51
- ],
44
+ "topics_msg_list", [(("topic1", dummy_msg), ("topic2", dummy_msg), ("topic3", dummy_msg))]
52
45
  )
53
46
  def test_dispatcher_disconnect_all(bec_dispatcher_w_connector, qtbot, send_msg_event):
54
47
  bec_dispatcher = bec_dispatcher_w_connector
@@ -70,15 +63,7 @@ def test_dispatcher_disconnect_all(bec_dispatcher_w_connector, qtbot, send_msg_e
70
63
  assert len(bec_dispatcher.client.connector._topics_cb) == 0
71
64
 
72
65
 
73
- @pytest.mark.parametrize(
74
- "topics_msg_list",
75
- [
76
- (
77
- ("topic1", dummy_msg),
78
- ("topic2", dummy_msg),
79
- )
80
- ],
81
- )
66
+ @pytest.mark.parametrize("topics_msg_list", [(("topic1", dummy_msg), ("topic2", dummy_msg))])
82
67
  def test_dispatcher_disconnect_one(bec_dispatcher_w_connector, qtbot, send_msg_event):
83
68
  # test for BEC issue #276
84
69
  bec_dispatcher = bec_dispatcher_w_connector
@@ -115,15 +100,7 @@ def test_dispatcher_2_cb_same_topic(bec_dispatcher_w_connector, qtbot, send_msg_
115
100
  cb2.assert_called_once()
116
101
 
117
102
 
118
- @pytest.mark.parametrize(
119
- "topics_msg_list",
120
- [
121
- (
122
- ("topic1", dummy_msg),
123
- ("topic2", dummy_msg),
124
- )
125
- ],
126
- )
103
+ @pytest.mark.parametrize("topics_msg_list", [(("topic1", dummy_msg), ("topic2", dummy_msg))])
127
104
  def test_dispatcher_2_topic_same_cb(bec_dispatcher_w_connector, qtbot, send_msg_event):
128
105
  # test for BEC issue #276
129
106
  bec_dispatcher = bec_dispatcher_w_connector
@@ -26,11 +26,7 @@ def test_bec_figure_init(bec_figure):
26
26
 
27
27
 
28
28
  def test_bec_figure_init_with_config(mocked_client):
29
- config = {
30
- "widget_class": "BECFigure",
31
- "gui_id": "test_gui_id",
32
- "theme": "dark",
33
- }
29
+ config = {"widget_class": "BECFigure", "gui_id": "test_gui_id", "theme": "dark"}
34
30
  widget = BECFigure(client=mocked_client, config=config)
35
31
  assert widget.config.gui_id == "test_gui_id"
36
32
  assert widget.config.theme == "dark"
@@ -29,10 +29,7 @@ def test_motor_map_change_motors(bec_motor_map):
29
29
 
30
30
 
31
31
  def test_motor_map_get_limits(bec_motor_map):
32
- expected_limits = {
33
- "samx": [-10, 10],
34
- "samy": [-5, 5],
35
- }
32
+ expected_limits = {"samx": [-10, 10], "samy": [-5, 5]}
36
33
 
37
34
  for motor_name, expected_limit in expected_limits.items():
38
35
  actual_limit = bec_motor_map._get_motor_limit(motor_name)
@@ -43,11 +43,7 @@ def test_load_config(config_dialog, config_name):
43
43
 
44
44
  @pytest.mark.parametrize(
45
45
  "config_name, scan_mode",
46
- [
47
- ("config_device", False),
48
- ("config_scan", True),
49
- ("config_device_no_entry", False),
50
- ],
46
+ [("config_device", False), ("config_scan", True), ("config_device_no_entry", False)],
51
47
  )
52
48
  def test_initialization(config_dialog, config_name, scan_mode):
53
49
  config = load_test_config(config_name)
@@ -0,0 +1,33 @@
1
+ plot_settings:
2
+ background_color: "black"
3
+ num_columns: 1
4
+ colormap: "plasma"
5
+ scan_types: false
6
+ plot_data:
7
+ - plot_name: "BPM4i plots vs samx"
8
+ x_label: "Motor X"
9
+ y_label: "bpm4i"
10
+ sources:
11
+ - type: "scan_segment"
12
+ signals:
13
+ x:
14
+ - name : "samx"
15
+ entry: "samx"
16
+ y:
17
+ - name : "bpm4i"
18
+ entry: "bpm4i"
19
+
20
+ - plot_name: "Gauss plots vs samx"
21
+ x_label: "Motor X"
22
+ y_label: "Gauss"
23
+ sources:
24
+ - type: "scan_segment"
25
+ signals:
26
+ x:
27
+ - name: "samx"
28
+ entry: "samx"
29
+ y:
30
+ - name: "gauss_adc1"
31
+ entry: "gauss_adc1"
32
+ - name: "gauss_adc2"
33
+ entry: "gauss_adc2"
@@ -0,0 +1,27 @@
1
+ plot_settings:
2
+ background_color: "black"
3
+ num_columns: 1
4
+ colormap: "plasma"
5
+ scan_types: false
6
+ plot_data:
7
+ - plot_name: "BPM4i plots vs samx"
8
+ x_label: "Motor X"
9
+ y_label: "bpm4i"
10
+ sources:
11
+ - type: "scan_segment"
12
+ signals:
13
+ x:
14
+ - name : "samx"
15
+ y:
16
+ - name : "bpm4i"
17
+
18
+ - plot_name: "Gauss plots vs samx"
19
+ x_label: "Motor X"
20
+ y_label: "Gauss"
21
+ sources:
22
+ - type: "scan_segment"
23
+ signals:
24
+ x:
25
+ - name: "samx"
26
+ y:
27
+ - name: "gauss_bpm"
@@ -0,0 +1,82 @@
1
+ plot_settings:
2
+ background_color: "white"
3
+ num_columns: 3
4
+ colormap: "plasma"
5
+ scan_types: true
6
+ plot_data:
7
+ grid_scan:
8
+ - plot_name: "Grid plot 1"
9
+ x_label: "Motor X"
10
+ y_label: "BPM"
11
+ sources:
12
+ - type: "scan_segment"
13
+ signals:
14
+ x:
15
+ - name: "samx"
16
+ entry: "samx"
17
+ y:
18
+ - name: "gauss_bpm"
19
+ entry: "gauss_bpm"
20
+ - plot_name: "Grid plot 2"
21
+ x_label: "Motor X"
22
+ y_label: "BPM"
23
+ sources:
24
+ - type: "scan_segment"
25
+ signals:
26
+ x:
27
+ - name: "samx"
28
+ entry: "samx"
29
+ y:
30
+ - name: "gauss_adc1"
31
+ entry: "gauss_adc1"
32
+ - plot_name: "Grid plot 3"
33
+ x_label: "Motor X"
34
+ y_label: "BPM"
35
+ sources:
36
+ - type: "scan_segment"
37
+ signals:
38
+ x:
39
+ - name: "samx"
40
+ entry: "samx"
41
+ y:
42
+ - name: "gauss_adc2"
43
+ entry: "gauss_adc2"
44
+ - plot_name: "Grid plot 4"
45
+ x_label: "Motor X"
46
+ y_label: "BPM"
47
+ sources:
48
+ - type: "scan_segment"
49
+ signals:
50
+ x:
51
+ - name: "samx"
52
+ entry: "samx"
53
+ y:
54
+ - name: "bpm4i"
55
+ entry: "bpm4i"
56
+ line_scan:
57
+ - plot_name: "Multiple Gauss Plot"
58
+ x_label: "Motor X"
59
+ y_label: "BPM"
60
+ sources:
61
+ - type: "scan_segment"
62
+ signals:
63
+ x:
64
+ - name: "samx"
65
+ y:
66
+ - name: "gauss_bpm"
67
+ entry: "gauss_bpm"
68
+ - name: "gauss_adc1"
69
+ entry: "gauss_adc1"
70
+ - name: "gauss_adc2"
71
+ entry: "gauss_adc2"
72
+ - plot_name: "BPM Plot"
73
+ x_label: "Motor X"
74
+ y_label: "BPM"
75
+ sources:
76
+ - type: "scan_segment"
77
+ signals:
78
+ x:
79
+ - name: "samx"
80
+ y:
81
+ - name: "bpm4i"
82
+ entry: "bpm4i"
@@ -50,7 +50,7 @@ CONFIG_DEFAULT = {
50
50
  "x": [{"name": "samx", "entry": "samx"}],
51
51
  "y": [{"name": "samy", "entry": "samy"}],
52
52
  },
53
- },
53
+ }
54
54
  ],
55
55
  }
56
56
 
@@ -58,7 +58,7 @@ CONFIG_ONE_DEVICE = {
58
58
  "x": [{"name": "samx", "entry": "samx"}],
59
59
  "y": [{"name": "samy", "entry": "samy"}],
60
60
  },
61
- },
61
+ }
62
62
  ],
63
63
  }
64
64
 
@@ -73,10 +73,7 @@ def motor_map(qtbot, mocked_client):
73
73
 
74
74
  def test_motor_limits_initialization(motor_map):
75
75
  # Example test to check if motor limits are correctly initialized
76
- expected_limits = {
77
- "samx": [-10, 10],
78
- "samy": [-5, 5],
79
- }
76
+ expected_limits = {"samx": [-10, 10], "samy": [-5, 5]}
80
77
  for motor_name, expected_limit in expected_limits.items():
81
78
  actual_limit = motor_map._get_motor_limit(motor_name)
82
79
  assert actual_limit == expected_limit
@@ -99,13 +96,7 @@ def test_motor_initial_position(motor_map):
99
96
  assert actual_position == expected_position
100
97
 
101
98
 
102
- @pytest.mark.parametrize(
103
- "config, number_of_plots",
104
- [
105
- (CONFIG_DEFAULT, 2),
106
- (CONFIG_ONE_DEVICE, 1),
107
- ],
108
- )
99
+ @pytest.mark.parametrize("config, number_of_plots", [(CONFIG_DEFAULT, 2), (CONFIG_ONE_DEVICE, 1)])
109
100
  def test_initialization(motor_map, config, number_of_plots):
110
101
  config_load = config
111
102
  motor_map.on_config_update(config_load)
@@ -131,16 +122,10 @@ def test_motor_movement_updates_position_and_database(motor_map):
131
122
  motor_map.on_device_readback({"signals": {"samx": {"value": new_position_samx}}})
132
123
 
133
124
  # Verify database update for 'samx'
134
- assert motor_map.database["samx"]["samx"] == [
135
- initial_position_samx,
136
- new_position_samx,
137
- ]
125
+ assert motor_map.database["samx"]["samx"] == [initial_position_samx, new_position_samx]
138
126
 
139
127
  # Verify 'samy' retains its last known position
140
- assert motor_map.database["samy"]["samy"] == [
141
- initial_position_samy,
142
- initial_position_samy,
143
- ]
128
+ assert motor_map.database["samy"]["samy"] == [initial_position_samy, initial_position_samy]
144
129
 
145
130
 
146
131
  def test_scatter_plot_rendering(motor_map):
@@ -85,12 +85,7 @@ def test_1d_plotting_data(qtbot, stream_app):
85
85
  def test_flip_even_rows(qtbot, stream_app):
86
86
  # Create a numpy array with some known data
87
87
  original_array = np.array(
88
- [
89
- [1, 2, 3, 4, 5],
90
- [6, 7, 8, 9, 10],
91
- [11, 12, 13, 14, 15],
92
- [16, 17, 18, 19, 20],
93
- ]
88
+ [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]
94
89
  )
95
90
 
96
91
  # Call flip_even_rows on the original array
@@ -98,12 +93,7 @@ def test_flip_even_rows(qtbot, stream_app):
98
93
 
99
94
  # Expected array flipped along the rows with even indices
100
95
  expected_array = np.array(
101
- [
102
- [1, 2, 3, 4, 5],
103
- [10, 9, 8, 7, 6],
104
- [11, 12, 13, 14, 15],
105
- [20, 19, 18, 17, 16],
106
- ]
96
+ [[1, 2, 3, 4, 5], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15], [20, 19, 18, 17, 16]]
107
97
  )
108
98
 
109
99
  # Check that flip_even_rows returned the expected result
@@ -1,2 +0,0 @@
1
- bec_widgets
2
- tests
File without changes