-
Notifications
You must be signed in to change notification settings - Fork 0
When using Linkam plans decorations are not done #521
Comments
Need to import proper command and add this to the list at the beginning of main body |
@prjemian am I correct I need to : from ..plans.command_list import before_command_list yield from before_command_list(md=md, commands=none)? |
from instrument.plans import before_command_list should work? |
That's the import, but it is not a decorator, it's plan code so you run it with If you need to modify |
OK, I will change that tomorrow and try it next weekend. |
I have modified current linkam_local.py on usaxscontrol to have: yield from before_command_list() before se start time t0, and yield from after_command_list() after all is done. I imported both commands. I think this is enough and these will work with default state, no need to modify. Hope to test on weekend. |
Tried to use this, failed here: In [9]: RE(myLinkamPlan(0, 0, 0.103, "AB174", 650, 200, 3600, 40, 1))
...:
I Sun-19:50:23 - Linkam controller PV prefix=9idcLINKAM:tc1:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-2de22bc582dd> in <module>
----> 1 RE(myLinkamPlan(0, 0, 0.103, "AB174", 650, 200, 3600, 40, 1))
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/run_engine.py in __call__(self, *args, **metadata_kw)
805 self._task_fut.add_done_callback(set_blocking_event)
806
--> 807 self._resume_task(init_func=_build_task)
808
809 if self._interrupted:
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/run_engine.py in _resume_task(self, init_func)
929 if (exc is not None
930 and not isinstance(exc, _RunEnginePanic)):
--> 931 raise exc
932
933 def install_suspender(self, suspender):
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
1498 exit_reason = str(err)
1499 self.log.exception("Run aborted")
-> 1500 raise err
1501 finally:
1502 if not exit_reason:
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
1363 else:
1364 try:
-> 1365 msg = self._plan_stack[-1].send(resp)
1366 # We have exhausted the top generator
1367 except StopIteration:
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in __call__(self, plan)
1305 plan = monitor_during_wrapper(plan, self.monitors)
1306 plan = baseline_wrapper(plan, self.baseline)
-> 1307 return (yield from plan)
1308
1309
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in baseline_wrapper(plan, devices, name)
1160 return (yield from plan)
1161 else:
-> 1162 return (yield from plan_mutator(plan, insert_baseline))
1163
1164
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
168 continue
169 else:
--> 170 raise ex
171 # if inserting / mutating, put new generator on the stack
172 # and replace the current msg with the first element from the
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
121 ret = result_stack.pop()
122 try:
--> 123 msg = plan_stack[-1].send(ret)
124 except StopIteration as e:
125 # discard the exhausted generator
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in monitor_during_wrapper(plan, signals)
801 plan1 = plan_mutator(plan, insert_after_open)
802 plan2 = plan_mutator(plan1, insert_before_close)
--> 803 return (yield from plan2)
804
805
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
168 continue
169 else:
--> 170 raise ex
171 # if inserting / mutating, put new generator on the stack
172 # and replace the current msg with the first element from the
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
121 ret = result_stack.pop()
122 try:
--> 123 msg = plan_stack[-1].send(ret)
124 except StopIteration as e:
125 # discard the exhausted generator
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
168 continue
169 else:
--> 170 raise ex
171 # if inserting / mutating, put new generator on the stack
172 # and replace the current msg with the first element from the
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
121 ret = result_stack.pop()
122 try:
--> 123 msg = plan_stack[-1].send(ret)
124 except StopIteration as e:
125 # discard the exhausted generator
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in fly_during_wrapper(plan, flyers)
859 plan1 = plan_mutator(plan, insert_after_open)
860 plan2 = plan_mutator(plan1, insert_before_close)
--> 861 return (yield from plan2)
862
863
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
168 continue
169 else:
--> 170 raise ex
171 # if inserting / mutating, put new generator on the stack
172 # and replace the current msg with the first element from the
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
121 ret = result_stack.pop()
122 try:
--> 123 msg = plan_stack[-1].send(ret)
124 except StopIteration as e:
125 # discard the exhausted generator
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
168 continue
169 else:
--> 170 raise ex
171 # if inserting / mutating, put new generator on the stack
172 # and replace the current msg with the first element from the
/share1/bluesky/conda_envs/bluesky_2021_1/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
121 ret = result_stack.pop()
122 try:
--> 123 msg = plan_stack[-1].send(ret)
124 except StopIteration as e:
125 # discard the exhausted generator
~/.ipython/user/linkam_local.py in myLinkamPlan(pos_X, pos_Y, thickness, scan_title, temp1, rate1, delay1, temp2, rate2, md)
48 logger.info(f"Linkam controller PV prefix={linkam.prefix}")
49
---> 50 yield from before_command_list() #this will run usual startup scripts for scans
51
52 t0 = time.time()
~/.ipython/profile_bluesky/startup/instrument/plans/command_list.py in before_command_list(md, commands)
103 from .scans import preUSAXStune
104
--> 105 verify_commands(commands)
106
107 if md is None:
~/.ipython/profile_bluesky/startup/instrument/plans/command_list.py in verify_commands(commands)
154 # separate commands into individual components, see execute_command_list for details
155 scan_actions = "flyscan usaxsscan saxs saxsexp waxs waxsexp".split()
--> 156 for command in commands:
157 action, args, i, raw_command = command
158 if action.lower() in scan_actions:
TypeError: 'NoneType' object is not iterable |
May be defining my own before_command_list in that function is the right thing to do? |
Using RE(myLinkamPlan...) does not set PV for Collecting data and does not run start of data collection (dark currents for detectors etc.)
The text was updated successfully, but these errors were encountered: