Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@ jobs:
uv pip install --system -e ./bec/bec_ipython_client
uv pip install --system -e ./bec/bec_server[dev]
uv pip install --system -e ./bec_widgets[dev]
uv pip install --system -e ./bec_testing_plugin
uv pip install --system -e "./bec_testing_plugin[dev]"

- name: Run Pytest with Coverage
id: coverage
run: pytest --random-order --cov=./bec_testing_plugin --cov-config=./bec_testing_plugin/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./bec_testing_plugin/tests/ || test $? -eq 5
run: |
if coverage run --rcfile=./bec_testing_plugin/pyproject.toml --branch --source=./bec_testing_plugin -m pytest --random-order ./bec_testing_plugin/tests/; then
coverage xml --rcfile=./bec_testing_plugin/pyproject.toml
else
test $? -eq 5
fi
2 changes: 1 addition & 1 deletion bec_testing_plugin/scans/custom_scan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bec_server.scan_server.scans import LineScan
from bec_server.scan_server.scans.line_scan import LineScan


class CustomTestingScan(LineScan):
Expand Down
35 changes: 31 additions & 4 deletions bec_testing_plugin/scans/device_progress_scan.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
from bec_server.scan_server.scans import Scan
from bec_server.scan_server.scans import position_generators
from bec_server.scan_server.scans.grid_scan import GridScan, scan_hook


class DeviceProgressScan(Scan):
class DeviceProgressScan(GridScan):
"""A scan that simulates device progress updates."""

scan_name = "device_progress_grid_scan"

def scan_report_instructions(self):
yield from self.stubs.scan_report_instruction({"device_progress": ["waveform"]})
@scan_hook
def prepare_scan(self):
"""
Prepare the scan. This can include any steps that need to be executed
before the scan is opened, such as preparing the positions (if not done already)
or setting up the devices.
"""
self.positions = position_generators.nd_grid_positions(
self.motor_input_bundles.values(), snaked=self.snaked
)

if self.relative:
self.start_positions = self.components.get_start_positions(self.motors)
self.positions += self.start_positions

self.components.check_limits(self.motors, self.positions)

self.update_scan_info(
positions=self.positions,
num_points=len(self.positions),
num_monitored_readouts=len(self.positions) * self.burst_at_each_point,
)

self.actions.add_scan_report_instruction_device_progress(device="waveform")

self._baseline_readout_status = self.actions.read_baseline_devices(wait=False)

self._premove_motor_status = self.actions.set(self.motors, self.positions[0], wait=False)
8 changes: 3 additions & 5 deletions bec_testing_plugin/scans/scan_customization/scan_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
class BecTestingPluginScanModifier(ScanModifier):
"""
Scan modifier for bec_testing_plugin.

By inheriting from the ScanModifier base class, you get access to currently running scan (self.scan), the devices (self.dev), the scan info (self.scan_info),
the scan components (self.components) and the scan actions (self.actions).
"""

def __init__(self, **kwargs):
def __init__(self, *args, **kwargs):
"""Initialize the scan modifier."""
super().__init__(**kwargs)
super().__init__(*args, **kwargs)

# Example of running code before the scan stage for a specific scan
# @scan_hook_impl("stage", "before")
Expand All @@ -29,5 +29,3 @@ def __init__(self, **kwargs):
# self.actions.send_client_info("Custom stage logic executed by ScanModifier.")
# if self.scan_info.scan_name == "example_scan":
# self.dev.samx.set(20)


Loading