39 lines
1.6 KiB
Python
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)
|