Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def sort_devices(devices, scan_devices) -> list:


class LiveUpdatesTable(LiveUpdatesBase):
"""Live updates for scans using a table and a scan progess bar.
"""Live updates for scans using a table and a scan progress bar.

Args:
bec (BECClient): client instance
Expand Down
2 changes: 1 addition & 1 deletion bec_ipython_client/bec_ipython_client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _wait_for_server(self):
# pylint: disable=no-member
cmdline_args = self._BECClient__init_params["config"].config.get("cmdline_args")
# set stderr logger level to SUCCESS (will not show messages <= INFO level)
# (see issue #318), except if user explicitely asked for another level from cmd line
# (see issue #318), except if user explicitly asked for another level from cmd line
if not cmdline_args or not cmdline_args.get("log_level"):
# pylint: disable=protected-access
bec_logger._stderr_log_level = "SUCCESS"
Expand Down
2 changes: 1 addition & 1 deletion bec_ipython_client/bec_ipython_client/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def handle_signals(self):

def _procedure_mode(self):
# Catch it here to only kill scans which were started here
print("SIGINT recieved in procedure mode. Sending scan abort request and exiting.")
print("SIGINT received in procedure mode. Sending scan abort request and exiting.")
self.bec.queue.request_scan_abortion()
# Let the procedure worker shut itself down
raise KeyboardInterrupt
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/alarm_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, alarm: messages.AlarmMessage, severity: Alarms, handled=False
def __str__(self) -> str:
msg = self.alarm.info.compact_error_message or self.alarm.info.error_message
return (
f"An alarm has occured. Severity: {self.severity.name}.\n{self.alarm_type}.\n\t"
f"An alarm has occurred. Severity: {self.severity.name}.\n{self.alarm_type}.\n\t"
f" {msg}"
)

Expand Down
4 changes: 2 additions & 2 deletions bec_lib/bec_lib/bec_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _update_service_info(self):
try:
self._send_service_status()
except Exception:
# exception is not explicitely specified,
# exception is not explicitly specified,
# because it depends on the underlying connector
pass

Expand Down Expand Up @@ -342,7 +342,7 @@ def _get_metrics(self):
self.connector.set_and_publish(MessageEndpoints.metrics(self._service_name), msg)
# pylint: disable=broad-except
except Exception:
# exception is not explicitely specified,
# exception is not explicitly specified,
# because it depends on the underlying connector
pass

Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/callback_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, id: int, event_type: EventType, func: Callable, sync: bool) -

@threadlocked
def run(self, *args, **kwargs) -> None:
"""Run the callback function. If sync is True, the callback is run immediately. Otherwise, the callback is added to a queue and exectued in the next poll."""
"""Run the callback function. If sync is True, the callback is run immediately. Otherwise, the callback is added to a queue and executed in the next poll."""
if not self.sync:
self._run_cb(*args, **kwargs)
return
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def _load_scans(self):
def load_high_level_interface(self, module_name: str) -> None:
"""Load a high level interface module.
Runs a callback of type `EventType.NAMESPACE_UPDATE`
to inform clients about added objects in the namesapce.
to inform clients about added objects in the namespace.
Args:
module_name (str): The name of the module to load
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/dap_plugin_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class DAPPluginObjectAutoRun(DAPPluginObject):
@property
def auto_run(self):
"""
Set to True to start a continously running worker.
Set to True to start a continuously running worker.
"""
return self._plugin_config.get("auto_run", False)

Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/dap_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def refresh(self):
"""
Refresh the list of available DAP plugins. This is useful if new plugins have been added after
the client has been initialized. This method is called automatically when the client is initialized.
A call to this method is indempotent, meaning it can be called multiple times without side effects.
A call to this method is idempotent, meaning it can be called multiple times without side effects.
"""
self._import_dap_plugins()

Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ def set_input_signals(self, *signals) -> None:
The signals need to be valid signals and match the computation of the compute method.

Args:
signals : All signals to be added for the comput method
signals : All signals to be added for the compute method

>>> dev.<dev_name>.set_input_signals(dev.bpm4i.readback, dev.bpm5i.readback)
"""
Expand Down
4 changes: 2 additions & 2 deletions bec_lib/bec_lib/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def device_instructions():
@staticmethod
def device_instructions_response():
"""
Endpoint for device instruction repsonses. This endpoint is used by the device
Endpoint for device instruction responses. This endpoint is used by the device
server to publish responses to device instructions, typically sent by the scan
server using a messages.DeviceInstructionResponse message. The messages are used
to inform interested services about the status of device instructions.
Expand Down Expand Up @@ -1150,7 +1150,7 @@ def service_response(RID: str):
def service_request():
"""
Endpoint for service request. This endpoint is used to
request e.g. resarts of the bec server.
request e.g. restarts of the bec server.

Returns:
EndpointInfo: Endpoint for service request.
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _logger_callback(self, msg):
except Exception:
# connector disconnected?
# just ignore the error here...
# Exception is not explicitely specified,
# Exception is not explicitly specified,
# because it depends on the connector
pass

Expand Down
4 changes: 2 additions & 2 deletions bec_lib/bec_lib/macro_update_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def load_all_user_macros(self) -> None:
"""Load all macros from the `macros` directory.

Runs a callback of type `EventType.NAMESPACE_UPDATE`
to inform clients about added objects in the namesapce.
to inform clients about added objects in the namespace.
"""
self.forget_all_user_macros()
macro_files = []
Expand Down Expand Up @@ -219,7 +219,7 @@ def forget_all_user_macros(self) -> None:
"""unload / remove loaded user macros from builtins. Files will remain untouched.

Runs a callback of type `EventType.NAMESPACE_UPDATE`
to inform clients about removing objects from the namesapce.
to inform clients about removing objects from the namespace.

"""
for name, obj in self.macros.items():
Expand Down
4 changes: 2 additions & 2 deletions bec_lib/bec_lib/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def check_data(cls, v: np.ndarray):
if v.ndim == 3 and v.shape[2] == 3:
return v
raise ValueError(
f"Invalid dimenson {v.ndim} for numpy array. Must be a 2D array or 3D array for rgb v.shape[2]=3."
f"Invalid dimension {v.ndim} for numpy array. Must be a 2D array or 3D array for rgb v.shape[2]=3."
)


Expand Down Expand Up @@ -827,7 +827,7 @@ def check_data(cls, v: np.ndarray):
raise ValueError(f"Invalid array type: {type(v)}. Must be a numpy array.")
if v.ndim == 1:
return v
raise ValueError(f"Invalid dimenson {v.ndim} for numpy array. Must be a 1D array.")
raise ValueError(f"Invalid dimension {v.ndim} for numpy array. Must be a 1D array.")


class DevicePreviewMessage(BECMessage):
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/redis_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ def blocking_list_pop_to_set_add(
side: Literal["LEFT", "RIGHT"] = "LEFT",
timeout_s: float | None = None,
) -> _BecMsgT | None:
"""Block for up to timeout seconds to pop an item from 'list_enpoint' on side `side`,
"""Block for up to timeout seconds to pop an item from 'list_endpoint' on side `side`,
and add it to 'set_endpoint'. Returns the popped item, or None if waiting timed out.
"""
for ep, ops in [(list_endpoint, MessageOp.LIST), (set_endpoint, MessageOp.SET)]:
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/bec_lib/request_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def decision_pending(self, val: bool) -> None:

@classmethod
def from_response(cls, scan_manager: ScanManager, response: messages.RequestResponseMessage):
"""initialize a request item from a RequestReponseMessage / response message"""
"""initialize a request item from a RequestResponseMessage / response message"""
scan_req = cls(
scan_manager=scan_manager,
requestID=response.metadata["RID"],
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/tests/test_alarm_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_alarm_base_printing(msg):
alarm_msg = AlarmBase(alarm=msg, severity=Alarms.MAJOR)

# Test __str__ method
expected_str = f"An alarm has occured. Severity: MAJOR.\n{msg.info.exception_type}.\n\t {msg.info.compact_error_message}"
expected_str = f"An alarm has occurred. Severity: MAJOR.\n{msg.info.exception_type}.\n\t {msg.info.compact_error_message}"
assert str(alarm_msg) == expected_str

# Test pretty_print method (just ensure it runs without error)
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/tests/test_dap_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def test_dap_wait_for_dap_response_waits_for_RID(dap):
dap.GaussianModel._wait_for_dap_response(request_id="1234", timeout=0.1)


def test_dap_wait_for_dap_respnse_returns(dap):
def test_dap_wait_for_dap_response_returns(dap):
dap._parent.connector.get.return_value = messages.DAPResponseMessage(
success=True, data=({}, None), metadata={"RID": "1234"}
)
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/tests/test_device_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_get_devices_with_tags(test_config_yaml, dm_with_devices):
dev_names = {dev.name for dev in dev_list}
assert dev_names == set(devices)

assert len(device_manager.devices.get_devices_with_tags("someting")) == 0
assert len(device_manager.devices.get_devices_with_tags("something")) == 0


def test_get_software_triggered_devices(test_config_yaml, dm_with_devices):
Expand Down
2 changes: 1 addition & 1 deletion bec_lib/tests/test_messaging_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_scilog_messaging_service_send_image_attachment(
assert attachment.data == b"\x89PNG\r\n\x1a\n"


def test_messaging_service_attachement_raises_if_too_large(scilog_message, tmp_path):
def test_messaging_service_attachment_raises_if_too_large(scilog_message, tmp_path):
# Create a temporary file larger than 5MB
file_path = tmp_path / "large_file.bin"
with open(file_path, "wb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, *args, **kwargs):

def configure(self, scan_item=None, device=None, images=None, return_type=None, **kwargs):
# TODO Add type hints for np.ndarray and list[np.ndarray] do not work yet in the signature_serializer
# This will be adressed in a different MR, issue is created #395
# This will be addressed in a different MR, issue is created #395
# scan_item: ScanItem | str = None,
# device: DeviceBase | str = None,
# images: np.ndarray | list[np.ndarray] | None = None,
Expand Down
6 changes: 3 additions & 3 deletions bec_server/bec_server/device_server/devices/devicemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def _obj_callback_device_monitor_2d(
DEPRECATED: Use _obj_callback_preview instead.

Callback for ophyd monitor events. Sends the data to redis.
Introduces a check of the data size, and incoporates a limit which is defined in max_size (in MB)
Introduces a check of the data size, and incorporates a limit which is defined in max_size (in MB)

Args:
obj (OphydObject): ophyd object
Expand Down Expand Up @@ -830,7 +830,7 @@ def _obj_callback_device_monitor_1d(
DEPRECATED: Use _obj_callback_preview instead.

Callback for ophyd monitor events. Sends the data to redis.
Introduces a check of the data size, and incoporates a limit which is defined in max_size (in MB)
Introduces a check of the data size, and incorporates a limit which is defined in max_size (in MB)

Args:
obj (OphydObject): ophyd object
Expand Down Expand Up @@ -955,7 +955,7 @@ def _obj_callback_file_event(
obj (OphydObject): ophyd object
file_path (str): file path to the created file
done (bool): if the file is done
successfull (bool): if the file was created successfully
successful (bool): if the file was created successfully
file_type (str): Optional, file type. Default is h5.
hinted_h5_entry (dict[str, str] | None): Optional, hinted h5 entry. Please check FileMessage for more details
"""
Expand Down
2 changes: 1 addition & 1 deletion bec_server/bec_server/procedures/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def shutdown(self):
MessageEndpoints.procedure_request(), None, self._process_queue_request
)
self._conn.shutdown()
# cancel futures by hand to give us the opportunity to detatch them from redis if they have started
# cancel futures by hand to give us the opportunity to detach them from redis if they have started
with self.lock:
for entry in self._active_workers.values():
cancelled = entry["future"].cancel()
Expand Down
2 changes: 1 addition & 1 deletion bec_server/bec_server/scan_server/scan_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def scan_interception(self, scan_mod_msg: messages.ScanQueueModificationMessage)
@requires_queue
def set_pause(self, scan_id=None, queue="primary", parameter: dict | None = None) -> None:
# pylint: disable=unused-argument
"""pause the queue and the currenlty running instruction queue"""
"""pause the queue and the currently running instruction queue"""
que = self.queues[queue]
with AutoResetCM(que):
if que.worker_status == InstructionQueueStatus.RUNNING:
Expand Down
2 changes: 1 addition & 1 deletion bec_server/bec_server/scan_server/scan_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def send_rpc(
self, device: str, func_name: str, *args, metadata=None, rpc_id=None, **kwargs
) -> Generator[messages.DeviceInstructionMessage, None, ScanStubStatus]:
"""
Perfrom an RPC (remote procedure call) on a device.
Perform an RPC (remote procedure call) on a device.
For blocking calls, use :func:`send_rpc_and_wait`.
Any additional arguments and keyword arguments will be passed on to the RPC function.

Expand Down
4 changes: 2 additions & 2 deletions bec_server/bec_server/scan_server/scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def _calculate_atol(self):
raise ScanAbortion(
f"Motor {self.device} is moving too fast with the calculated tolerance. Consider reducing speed {self.motor_velocity} or increasing the atol {self.atol}"
)
# the lower udate limit is 100ms, so we set the atol to 0.2s/v if the atol is smaller
# the lower update limit is 100ms, so we set the atol to 0.2s/v if the atol is smaller
self.atol = max(self.atol, 2 * 1 / update_freq * self.motor_velocity)

def _calculate_offset(self):
Expand Down Expand Up @@ -2046,7 +2046,7 @@ def run(self):
yield from self.stubs.trigger(min_wait=self.exp_time)


class InteractiveReadMontiored(ScanComponent):
class InteractiveReadMonitored(ScanComponent):
scan_name = "_interactive_read_monitored"
required_kwargs = {"point_id": ScanArgType.INT}

Expand Down
4 changes: 2 additions & 2 deletions bec_server/tests/tests_scan_server/test_scan_server_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def test_increase_scan_number(scan_queue_msg, is_scan):
assert req_block_queue.scan_queue.queue_manager.parent.scan_number == 20


def test_pull_request_block_non_empyt_rb():
def test_pull_request_block_non_empty_rb():
req_block_queue = RequestBlockQueue(mock.MagicMock(), mock.MagicMock())
scan_queue_msg = messages.ScanQueueMessage(
scan_type="grid_scan",
Expand All @@ -888,7 +888,7 @@ def test_pull_request_block_non_empyt_rb():
rbqs.assert_not_called()


def test_pull_request_block_empyt_rb():
def test_pull_request_block_empty_rb():
req_block_queue = RequestBlockQueue(mock.MagicMock(), mock.MagicMock())
with mock.patch.object(req_block_queue, "request_blocks_queue") as rbqs:
with pytest.raises(StopIteration):
Expand Down
2 changes: 1 addition & 1 deletion bec_server/tests/tests_scan_server/test_scan_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def mock_rpc_func(*args, **kwargs):


def test_stage(stubs):
"""Test that staging wihtout a device is not blocking, the status object should resolve."""
"""Test that staging without a device is not blocking, the status object should resolve."""
# Have only rtx in the device manager with async readout priority
devices = list(stubs._device_manager.devices.values())
for device in devices:
Expand Down
6 changes: 3 additions & 3 deletions bec_server/tests/tests_scan_server/test_scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DeviceRPC,
FermatSpiralScan,
HexagonalScan,
InteractiveReadMontiored,
InteractiveReadMonitored,
InteractiveTrigger,
LineScan,
ListScan,
Expand Down Expand Up @@ -1976,7 +1976,7 @@ def test_OpenInteractiveScan(scan_assembler):
]


def test_InteractiveReadMontiored(scan_assembler):
def test_InteractiveReadMonitored(scan_assembler):
scan_msg = messages.ScanQueueMessage(
scan_type="_interactive_scan_trigger",
parameter={"args": {"samx": []}, "kwargs": {"relative": True, "exp_time": 0.1}},
Expand All @@ -1985,7 +1985,7 @@ def test_InteractiveReadMontiored(scan_assembler):
args = unpack_scan_args(scan_msg.content["parameter"]["args"])
kwargs = scan_msg.content["parameter"]["kwargs"]
request = scan_assembler(
InteractiveReadMontiored, *args, parameter=scan_msg.content["parameter"], **kwargs
InteractiveReadMonitored, *args, parameter=scan_msg.content["parameter"], **kwargs
)

ref_list = list(request.run())
Expand Down
2 changes: 1 addition & 1 deletion docs/source/developer/scans/scan_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ For each position in the scan, the method `_at_each_point` is called, providing
1. Let the device settle for a specified time (default: `settling_time=0`).
1. Send out a trigger and wait at least for the specified time (`min_wait`).
1. Read out all devices that are on `readout_priority="monitored"` and are currently enabled and assign the readout to the `point_id`.
1. Increase the `poind_id` by one.
1. Increase the `point_id` by one.

```{important}
The `point_id` is an identifier for the current point in the scan. It is used later on to bundle and correlate device readings. It is crucial that the `point_id` is increased by one for each point in the scan as as seen in the default implementation of the `_at_each_point` method.
Expand Down
Loading