-
Notifications
You must be signed in to change notification settings - Fork 2
Background Script IOC
John Holt edited this page Mar 2, 2020
·
12 revisions
Wiki > The Backend System > Specific Device IOC > Other > Background Script IOC
The background script IOC will run a script in the background. The script must be in python3 and be called background_script.py
and be in the python configuration directory. For the second background ioc the script must be called background_script2.py
.
If you want the IOC to register as started the user must include the lines:
sys.path.insert(1, os.path.abspath(os.path.join(os.environ["KIT_ROOT"], "ISIS", "inst_servers", "master")))
register_ioc_start("BGRSCRPT_01")
A popular use of this is to generate a background plot. This can be using the script:
import sys
import os
from time import sleep
sys.path.insert(0, os.path.abspath(os.path.join(r"C:\\", "Instrument", "scripts")))
sys.path.insert(1, os.path.abspath(os.path.join(os.environ["KIT_ROOT"], "ISIS", "inst_servers", "master")))
from technique.muon.background_plot import BackgroundBlockPlot
from genie_python import genie as g
from server_common.helpers import register_ioc_start
register_ioc_start("BGRSCRPT_01")
g.set_instrument(None)
plot=BackgroundBlockPlot((("Temp_Sample", "value"), ("Temp_SP", "set point")), "Temperature").start()
while True:
sleep(10)