Skip to content
Merged
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
17 changes: 5 additions & 12 deletions scripts/set_instrument_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import json
import os
import sys
from typing import TypedDict
from typing import Literal, TypedDict

try:
from server_common.channel_access import ChannelAccess
Expand Down Expand Up @@ -45,7 +45,7 @@ class Instrument(TypedDict):
pvPrefix: str
isScheduled: bool
groups: list[str]
seci: bool
seci: Literal[False]


def inst_dictionary(
Expand All @@ -55,7 +55,6 @@ def inst_dictionary(
pv_prefix: str | None = None,
is_scheduled: bool = True,
groups: list[str] | None = None,
seci: bool = False,
) -> Instrument:
"""
Generate the instrument dictionary for the instrument list
Expand All @@ -67,7 +66,6 @@ def inst_dictionary(
is_scheduled: whether the instrument has scheduled users,
and so should have user details written to it;
groups: which science groups (e.g. SANS, MUONS) this instrument is in.
seci: Whether the instrument is running SECI

Returns: dictionary for instrument

Expand All @@ -86,18 +84,13 @@ def inst_dictionary(
else:
groups_to_use = groups

if seci is True:
seci_to_use = True
else:
seci_to_use = False

return {
"name": instrument_name,
"hostName": hostname_to_use,
"pvPrefix": pv_prefix_to_use,
"isScheduled": is_scheduled,
"groups": groups_to_use,
"seci": seci_to_use,
"seci": False,
}


Expand Down Expand Up @@ -130,9 +123,9 @@ def set_instlist(instruments_list: list[Instrument], pv_address: str) -> None:
# instrument list values to set (uses utility to return the dictionary,
# but you can use a dictionary directly)
instruments_list = [
inst_dictionary("ARGUS", seci=True),
inst_dictionary("ARGUS", groups=["MUONS"]),
inst_dictionary("CHRONUS", groups=["MUONS"]),
inst_dictionary("HIFI", seci=True),
inst_dictionary("HIFI", groups=["MUONS"]),
inst_dictionary("CHIPIR"),
inst_dictionary(
"CRYOLAB_R80", groups=["SUPPORT"], pv_prefix="IN:CRYOLA7E:", is_scheduled=False
Expand Down
Loading