1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-09 18:27:52 +01:00

refactor: global refactoring to use device-signal pair names

This commit is contained in:
2026-02-02 15:29:32 +01:00
parent c1d4758e4c
commit b93fbc5cd3
38 changed files with 1367 additions and 1388 deletions

View File

@@ -47,9 +47,9 @@ heatmap_widget = dock_area.new().new(gui.available_widgets.Heatmap)
# Plot a heatmap with x and y motor positions and z detector signal
heatmap_widget.plot(
x_name='samx', # X-axis motor
y_name='samy', # Y-axis motor
z_name='bpm4i', # Z-axis detector signal
device_x='samx', # X-axis motor
device_y='samy', # Y-axis motor
device_z='bpm4i', # Z-axis detector signal
color_map='plasma'
)
heatmap_widget.title = "Grid Scan - Sample Position vs BPM Intensity"
@@ -66,12 +66,12 @@ heatmap_widget = dock_area.new().new(gui.available_widgets.Heatmap)
# Plot heatmap with specific data entries
heatmap_widget.plot(
x_name='motor1',
y_name='motor2',
z_name='detector1',
x_entry='RBV', # Use readback value for x
y_entry='RBV', # Use readback value for y
z_entry='value', # Use main value for z
device_x='motor1',
device_y='motor2',
device_z='detector1',
signal_x='RBV', # Use readback value for x
signal_y='RBV', # Use readback value for y
signal_z='value', # Use main value for z
color_map='viridis',
reload=True # Force reload of data
)

View File

@@ -32,7 +32,7 @@ dock_area = gui.new()
img_widget = dock_area.new().new(gui.available_widgets.Image)
# Add an ImageWidget to the BECFigure for a 2D detector
img_widget.image(device_name='eiger', device_entry='preview')
img_widget.image(device='eiger', signal='preview')
img_widget.title = "Camera Image - Eiger Detector"
```
@@ -46,7 +46,7 @@ dock_area = gui.new()
img_widget = dock_area.new().new(gui.available_widgets.Image)
# Add an ImageWidget to the BECFigure for a 2D detector
img_widget.image(device_name='waveform', device_entry='data')
img_widget.image(device='waveform', signal='data')
img_widget.title = "Line Detector Data"
# Optional: Set the color map and value range
@@ -84,7 +84,7 @@ The Image Widget can be configured for different detectors by specifying the cor
```python
# For a 2D camera detector
img_widget = fig.image(device_name='eiger', device_entry='preview')
img_widget = fig.image(device='eiger', signal='preview')
img_widget.set_title("Eiger Camera Image")
```
@@ -92,7 +92,7 @@ img_widget.set_title("Eiger Camera Image")
```python
# For a 1D line detector
img_widget = fig.image(device_name='waveform', device_entry='data')
img_widget = fig.image(device='waveform', signal='data')
img_widget.set_title("Line Detector Data")
```

View File

@@ -29,8 +29,8 @@ mm1 = dock_area.new().new(gui.available_widgets.MotorMap)
mm2 = dock_area.new().new(gui.available_widgets.MotorMap)
# Add signals to the MotorMaps
mm1.map(x_name='samx', y_name='samy')
mm2.map(x_name='aptrx', y_name='aptry')
mm1.map(device_x='samx', device_y='samy')
mm2.map(device_x='aptrx', device_y='aptry')
```
## Example 2 - Customizing Motor Map Display
@@ -57,7 +57,7 @@ You can dynamically change the motors being tracked and reset the history of the
mm1.reset_history()
# Change the motors being tracked
mm1.map(x_name='aptrx', y_name='aptry')
mm1.map(device_x='aptrx', device_y='aptry')
```
````

View File

@@ -20,7 +20,7 @@ The 2D scatter plot widget is designed for more complex data visualization. It e
```python
# Add a new dock_area, a new dock and a BECWaveForm to the dock
plt = gui.new().new().new(gui.available_widgets.ScatterWaveform)
plt.plot(x_name='samx', y_name='samy', z_name='bpm4i')
plt.plot(device_x='samx', device_y='samy', device_z='bpm4i')
```

View File

@@ -32,8 +32,8 @@ plt1 = dock_area.new().new('Waveform')
plt2 = gui.my_new_dock_area.new().new(gui.available_widgets.Waveform) # as an alternative example via dynamic name space
# Add signals to the WaveformWidget
plt1.plot(x_name='samx', y_name='bpm4i')
plt2.plot(x_name='samx', y_name='bpm3i')
plt1.plot(device_x='samx', device_y='bpm4i')
plt2.plot(device_x='samx', device_y='bpm3i')
# set axis labels
plt1.title = "Gauss plots vs. samx"
@@ -60,10 +60,10 @@ In addition to the scan curve, you can also add a second curve that fits the sig
```python
# Add a new dock_area, dock and Waveform and plot bpm4i vs samx with a GaussianModel DAP
plt = gui.new().new().new('Waveform')
plt.plot(x_name='samx', y_name='bpm4i', dap="GaussianModel")
plt.plot(device_x='samx', device_y='bpm4i', dap="GaussianModel")
# Add a second curve to the same plot without DAP
plt.plot(x_name='samx', y_name='bpm3a')
plt.plot(device_x='samx', device_y='bpm3a')
# Add DAP to the second curve
plt.add_dap_curve(device_label='bpm3a-bpm3a', dap_name='GaussianModel')