Skip to content
Snippets Groups Projects
Commit 94cffaef authored by Marcel Bajdel's avatar Marcel Bajdel :rocket:
Browse files

update magics to work with SeCop devices

parent f5ca9b2b
No related branches found
No related tags found
No related merge requests found
......@@ -10,21 +10,26 @@ from .base import RE, bec
get_ipython().register_magics(BlueskyMagics)
# custom magics - it will override some standard magics
label_axis_dict = {
"dcm": ["dcm.monoz.user_readback",
"dcm.p.energy.readback",
"dcm.p.height.readback",
"dcm.p.cr2vetr.user_readback",
"dcm.p.cr2latr.user_readback",
# "r.tttz.readback",
# "r.ttrx.readback",
# "r.ttry.readback",
# "r.ttrz.readback",
# "r.ps.det1.readback",
# "r.ps.det2.readback",
]
"temperature_regulator": ["reactor_c.temperature_reg.target",
"reactor_c.temperature_reg.value",
"reactor_c.temperature_reg.ramp",
"reactor_c.temperature_reg.status",
],
"temperature_sensor": ["reactor_c.temperature_sam.value",
"reactor_c.temperature_sam.status",
],
"pressure_controller_1": ["gas_d.backpressure_contr1.target",
"gas_d.backpressure_contr1.value",
"gas_d.backpressure_contr1.ramp",
"gas_d.backpressure_contr1.status",
]
}
exclude_labels_from_wa=['detectors']
get_ipython().register_magics(BlueskyMagicsBessy(RE, get_ipython(), database_name ="db", exclude_labels_from_wa=exclude_labels_from_wa,label_axis_dict=label_axis_dict))
exclude_labels_from_wa=['detectors', 'motors']
get_ipython().register_magics(BlueskyMagicsBessy(RE,
get_ipython(),
database_name ="db",
exclude_labels_from_wa=exclude_labels_from_wa,
label_axis_dict=label_axis_dict))
simplify = Simplify(get_ipython())
simplify.autogenerate_magics('/opt/bluesky/beamlinetools/beamlinetools/BEAMLINE_CONFIG/plans.py')
......
......@@ -418,7 +418,13 @@ class BlueskyMagicsBessy(Magics, metaclass=MetaclassForClassProperties):
None
"""
try:
axis_value = eval(axis + '.get()', self.shell.user_ns)
command = f"asyncio.run({axis}.read())"
# this is the command to use once we update the container,
# Peter added it, should give directlz the value
# command = f"asyncio.run({axis}.get_value())"
axis_dict = eval(command, self.shell.user_ns)
keys = list(axis_dict.keys())
axis_value = axis_dict[keys[0]]['value']
except Exception as e:
# print(f'exception {e}')
axis_value = 'Disconnected'
......@@ -464,11 +470,13 @@ class BlueskyMagicsBessy(Magics, metaclass=MetaclassForClassProperties):
else:
# Show all labels.
labels = list(devices_dict.keys())
additional_labels = [lab for lab in self.label_axis_dict.keys() if lab not in labels]
labels.extend(additional_labels)
additional_labels = [lab for lab in self.label_axis_dict.keys() if lab not in labels]
labels.extend(additional_labels)
for label in labels:
headers = ['Positioner', 'Value']
LINE_FMT = '{: <30} {: <11} '
LINE_FMT = '{: <40} {: <11} '
lines = []
lines.append(LINE_FMT.format(*headers))
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment