Files
csaxs_bec/csaxs_bec/scripts/saxs_scan_script.py
T
appel_c 804ffef5b0
CI for csaxs_bec / test (pull_request) Successful in 1m31s
Read the Docs Deploy Trigger / trigger-rtd-webhook (push) Successful in 2s
CI for csaxs_bec / test (push) Successful in 1m34s
feat(saxs-widget): Add SAXS Widget for scanning SAXS and Tensor Tomography measurement setup
2026-07-10 16:54:37 +02:00

39 lines
1.6 KiB
Python

# List of phone numbers to send signal notifications to, example: ["+1234567890", "+0987654321"].
# If not Swiss numbers, please provide +<country_code> prefix. If empty, no signal notifications will be sent.
#############
### Example script, copy from here and edit to your needs
#############
TELEFON_NUMBERS = []
SESSION_NAME = "test_session"
# count = -1 means latest saved table from the SAXS widget, 0 means first saved table, 1 means second saved table, etc. -1 is DEFAULT
# Provide it as a kwargs if you need to fetch older table data.
msg = get_saxs_widget_table_data(SESSION_NAME)
print(
f"Fetched {len(msg.value)} rows from SAXS widget table for session '{msg.metadata.get('session_name')}'. Table data created at {msg.metadata.get('timestamp')}"
)
total_rows = len(msg.value)
for ii, row in enumerate(msg.value):
print(f"Running continuous grid scan for row {ii + 1}/{len(msg.value)}: {row}")
run_cont_grid_scan_for_table_row(
session_name=SESSION_NAME, row=row, phone_numbers=TELEFON_NUMBERS
)
if ii % 10 == 0:
# Send update to scilog every 10 scans to avoid spamming the log
msg = bec.messaging.scilog.new()
msg.add_text(
f"Completed {ii + 1}/{total_rows} continuous grid scans for session '{SESSION_NAME}'"
)
msg.send()
# Send update to signal if phone numbers are provided
if TELEFON_NUMBERS:
msg = bec.messaging.signal.new()
msg.add_text(
f"Completed {ii + 1}/{total_rows} continuous grid scans for session '{SESSION_NAME}'"
)
msg.send(scope=TELEFON_NUMBERS)