I defined a function "create_dark_frame_preprocessor" to create the dark frame preprocessor.
And then I test it in the pytest for two detectors and different configuration.
All of them report a bug like below.
xpdacq/tests/plans/test_dark_plan.py:10 (test_dark_frame_preprocessor[area_det0-None])
self = <DarkFramePreprocessor 0 snapshots cached>, state = {}
def get_snapshot(self, state):
"""
Access a darkframe.
Parameters
----------
state: dict
Mapping each of the names of the locked_signals (if any) to its
value.
"""
self._evict_old_entries()
key = frozendict(state)
try:
> creation_time, snapshot = self._cache[key]
E KeyError: <frozendict {}>
key = <frozendict {}>
self = <DarkFramePreprocessor 0 snapshots cached>
state = {}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky_darkframes/__init__.py:280: KeyError
The above exception was the direct cause of the following exception:
force_read = True
msg = Msg('trigger', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0.,......, 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={'group': 'trigger-ac53bf'}, run=None)
def insert_dark_frame(force_read, msg=None):
# Acquire a fresh Snapshot if we need one, or retrieve a cached one.
state = {}
for signal in self.locked_signals:
reading = yield from bluesky.plan_stubs.read(signal)
# Restructure
# {'data_key': {'value': <value>, 'timestamp': <timestamp>}, ...}
# into (('data_key', <value>) ...).
values_only = tuple((k, v['value']) for k, v in reading.items())
state[signal.name] = values_only
try:
> snapshot = self.get_snapshot(state)
force_read = True
msg = Msg('trigger', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={'group': 'trigger-ac53bf'}, run=None)
self = <DarkFramePreprocessor 0 snapshots cached>
state = {}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky_darkframes/__init__.py:319:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <DarkFramePreprocessor 0 snapshots cached>, state = {}
def get_snapshot(self, state):
"""
Access a darkframe.
Parameters
----------
state: dict
Mapping each of the names of the locked_signals (if any) to its
value.
"""
self._evict_old_entries()
key = frozendict(state)
try:
creation_time, snapshot = self._cache[key]
except KeyError as err:
> raise NoMatchingSnapshot(
f"No Snapshot matches the state {state}. Perhaps there *was* "
f"match but it has aged out of the cache.") from err
E bluesky_darkframes.NoMatchingSnapshot: 'No Snapshot matches the state {}. Perhaps there *was* match but it has aged out of the cache.'
key = <frozendict {}>
self = <DarkFramePreprocessor 0 snapshots cached>
state = {}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky_darkframes/__init__.py:282: NoMatchingSnapshot
During handling of the above exception, another exception occurred:
fresh_xrun = <xpdacq.xpdacq.CustomizedRunEngine object at 0x7f9f3c878790>
area_det = SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0... [0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)
locked_signals = None
@pytest.mark.parametrize(
"area_det, locked_signals",
[
(xpd_pe1c, None),
(xpd_pe1c, [xpd_pe1c.images_per_set]),
(xpd_pe1c, [xpd_pe1c.cam.acquire_time]),
(xpd_pe1c, [xpd_pe1c.images_per_set, xpd_pe1c.cam.acquire_time]),
(DiffractionDetector, None),
(DiffractionDetector, [DiffractionDetector.exposure_time])
]
)
def test_dark_frame_preprocessor(fresh_xrun, area_det, locked_signals):
RE = RunEngine()
dfp = create_dark_frame_preprocessor(
area_det=area_det,
shutter=XPD_shutter,
open_state=XPD_SHUTTER_CONF["open"],
close_state=XPD_SHUTTER_CONF["close"],
locked_signals=locked_signals,
max_age=60
)
RE.preprocessors.append(dfp)
> RE(bp.count([area_det]))
RE = <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>
area_det = SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)
dfp = <DarkFramePreprocessor 0 snapshots cached>
fresh_xrun = <xpdacq.xpdacq.CustomizedRunEngine object at 0x7f9f3c878790>
locked_signals = None
/Users/sst/PycharmProjects/xpdAcq/xpdacq/tests/plans/test_dark_plan.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/run_engine.py:807: in __call__
self._resume_task(init_func=_build_task)
_build_task = <function RunEngine.__call__.<locals>._build_task at 0x7f9f3c629ee0>
args = (<generator object count at 0x7f9f3c62ea50>,)
arguments = OrderedDict([('self', <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>),
('plan', <generator object count at 0x7f9f3c62ea50>)])
funcs = []
futs = []
gen = <generator object DarkFramePreprocessor.__call__ at 0x7f9f3c62eac0>
metadata_kw = {}
name = 'descriptor'
plan = <generator object count at 0x7f9f3c62ea50>
self = <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>
subs = None
tripped_justifications = []
wrapper_func = <DarkFramePreprocessor 0 snapshots cached>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/run_engine.py:931: in _resume_task
raise exc
exc = AttributeError("'NoneType' object has no attribute 'parent'")
init_func = <function RunEngine.__call__.<locals>._build_task at 0x7f9f3c629ee0>
mgr = <class 'bluesky.utils.SigintHandler'>
self = <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>
stack = <contextlib.ExitStack object at 0x7f9f3c894e50>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/run_engine.py:1500: in _run
raise err
coro = <bound method RunEngine._unstage of <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>>
debug = <bound method Logger.debug of <Logger bluesky.RE.msg (WARNING)>>
exit_reason = "'NoneType' object has no attribute 'parent'"
msg = Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None)
new_response = None
resp = <object object at 0x7f9f3c0cbdd0>
self = <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>
sentinel = <object object at 0x7f9f3c0cbdd0>
stashed_exception = None
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/run_engine.py:1365: in _run
msg = self._plan_stack[-1].send(resp)
coro = <bound method RunEngine._unstage of <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>>
debug = <bound method Logger.debug of <Logger bluesky.RE.msg (WARNING)>>
exit_reason = "'NoneType' object has no attribute 'parent'"
msg = Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None)
new_response = None
resp = <object object at 0x7f9f3c0cbdd0>
self = <bluesky.run_engine.RunEngine object at 0x7f9f3c894250>
sentinel = <object object at 0x7f9f3c0cbdd0>
stashed_exception = None
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky_darkframes/__init__.py:378: in __call__
return (yield from bluesky.preprocessors.plan_mutator(
insert_dark_frame = <function DarkFramePreprocessor.__call__.<locals>.insert_dark_frame at 0x7f9f3c8b0040>
maybe_insert_dark_frame = <function DarkFramePreprocessor.__call__.<locals>.maybe_insert_dark_frame at 0x7f9f3c8b0310>
plan = <generator object count at 0x7f9f3c62ea50>
self = <DarkFramePreprocessor 0 snapshots cached>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:170: in plan_mutator
raise ex
exception = None
failed_gen = <generator object count at 0x7f9f3c62ea50>
gen = None
inner_ret = None
msg = Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None)
msg_proc = <function DarkFramePreprocessor.__call__.<locals>.maybe_insert_dark_frame at 0x7f9f3c8b0310>
msgs_seen = {140321891779104: Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891779488: Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891779968: Msg('open_run', obj=None, args=(), kwargs={'detectors': ['pe1_image'], 'num_points': 1, 'num_intervals': 0, 'plan_args': {'detectors': ["SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n ...,\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)"], 'num': 1}, 'plan_name': 'count', 'hints': {'dimensions': [(('time',), 'primary')]}}, run=None),
140321891780544: Msg('checkpoint', obj=None, args=(), kwargs={}, run=None),
140321891781024: Msg('stage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891781216: Msg('trigger', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={'group': 'trigger-ac53bf'}, run=None),
140321891781312: Msg('stage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891781696: Msg('checkpoint', obj=None, args=(), kwargs={}, run=None),
140321891782368: Msg('close_run', obj=None, args=(), kwargs={'exit_status': 'fail', 'reason': "'NoneType' object has no attribute 'parent'"}, run=None)}
new_gen = None
parent_plan = <generator object count at 0x7f9f3c62ea50>
plan = <generator object count at 0x7f9f3c62ea50>
plan_stack = deque([])
result_stack = deque([])
ret = None
ret_value = None
tail_cache = {}
tail_gen = None
tail_result_cache = {}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:123: in plan_mutator
msg = plan_stack[-1].send(ret)
exception = None
failed_gen = <generator object count at 0x7f9f3c62ea50>
gen = None
inner_ret = None
msg = Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None)
msg_proc = <function DarkFramePreprocessor.__call__.<locals>.maybe_insert_dark_frame at 0x7f9f3c8b0310>
msgs_seen = {140321891779104: Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891779488: Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891779968: Msg('open_run', obj=None, args=(), kwargs={'detectors': ['pe1_image'], 'num_points': 1, 'num_intervals': 0, 'plan_args': {'detectors': ["SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n ...,\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)"], 'num': 1}, 'plan_name': 'count', 'hints': {'dimensions': [(('time',), 'primary')]}}, run=None),
140321891780544: Msg('checkpoint', obj=None, args=(), kwargs={}, run=None),
140321891781024: Msg('stage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891781216: Msg('trigger', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={'group': 'trigger-ac53bf'}, run=None),
140321891781312: Msg('stage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891781696: Msg('checkpoint', obj=None, args=(), kwargs={}, run=None),
140321891782368: Msg('close_run', obj=None, args=(), kwargs={'exit_status': 'fail', 'reason': "'NoneType' object has no attribute 'parent'"}, run=None)}
new_gen = None
parent_plan = <generator object count at 0x7f9f3c62ea50>
plan = <generator object count at 0x7f9f3c62ea50>
plan_stack = deque([])
result_stack = deque([])
ret = None
ret_value = None
tail_cache = {}
tail_gen = None
tail_result_cache = {}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plans.py:77: in count
return (yield from inner_count())
_md = {'detectors': ['pe1_image'],
'hints': {'dimensions': [(('time',), 'primary')]},
'num_intervals': 0,
'num_points': 1,
'plan_args': {'detectors': ["SynSignalWithRegistry(name='pe1_image', "
'value=array([[0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' ...,\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.]], '
'dtype=float32), timestamp=1602180513.580364)'],
'num': 1},
'plan_name': 'count'}
delay = None
detectors = [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)]
inner_count = <function count.<locals>.inner_count at 0x7f9f3c8b0940>
md = None
num = 1
num_intervals = 0
per_shot = <function one_shot at 0x7f9f3c43f280>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/utils.py:1114: in dec_inner
return (yield from plan)
args = ([SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)],)
gen_func = <function count.<locals>.inner_count at 0x7f9f3c8b0820>
inner_args = ()
inner_kwargs = {}
kwargs = {}
plan = <generator object stage_wrapper at 0x7f9f3c62ef20>
wrapper = <function stage_wrapper at 0x7f9f3c43fee0>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:952: in stage_wrapper
return (yield from finalize_wrapper(inner(), unstage_devices()))
devices = [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)]
inner = <function stage_wrapper.<locals>.inner at 0x7f9f3c8b0700>
plan = <generator object count.<locals>.inner_count at 0x7f9f3c62e7b0>
stage_devices = <function stage_wrapper.<locals>.stage_devices at 0x7f9f3c8b09d0>
unstage_devices = <function stage_wrapper.<locals>.unstage_devices at 0x7f9f3c8b0790>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:509: in finalize_wrapper
ret = yield from plan
cleanup = True
final_plan = <generator object stage_wrapper.<locals>.unstage_devices at 0x7f9f3c62e120>
final_plan_instance = <generator object stage_wrapper.<locals>.unstage_devices at 0x7f9f3c62e120>
pause_for_debug = False
plan = <generator object stage_wrapper.<locals>.inner at 0x7f9f3c62ec10>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:950: in inner
return (yield from plan)
plan = <generator object count.<locals>.inner_count at 0x7f9f3c62e7b0>
stage_devices = <function stage_wrapper.<locals>.stage_devices at 0x7f9f3c8b09d0>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/utils.py:1114: in dec_inner
return (yield from plan)
args = ()
gen_func = <function count.<locals>.inner_count at 0x7f9f3c8b08b0>
inner_args = ()
inner_kwargs = {}
kwargs = {'md': {'detectors': ['pe1_image'],
'hints': {'dimensions': [(('time',), 'primary')]},
'num_intervals': 0,
'num_points': 1,
'plan_args': {'detectors': ["SynSignalWithRegistry(name='pe1_image', "
'value=array([[0., 0., 0., ..., 0., 0., '
'0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' ...,\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.]], '
'dtype=float32), '
'timestamp=1602180513.580364)'],
'num': 1},
'plan_name': 'count'}}
plan = <generator object run_wrapper at 0x7f9f3c62ecf0>
wrapper = <function run_wrapper at 0x7f9f3c43f790>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:325: in run_wrapper
yield from contingency_wrapper(plan,
except_plan = <function run_wrapper.<locals>.except_plan at 0x7f9f3c8b0670>
md = {'detectors': ['pe1_image'],
'hints': {'dimensions': [(('time',), 'primary')]},
'num_intervals': 0,
'num_points': 1,
'plan_args': {'detectors': ["SynSignalWithRegistry(name='pe1_image', "
'value=array([[0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' ...,\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.],\n'
' [0., 0., 0., ..., 0., 0., 0.]], '
'dtype=float32), timestamp=1602180513.580364)'],
'num': 1},
'plan_name': 'count'}
plan = <generator object count.<locals>.inner_count at 0x7f9f3c62e900>
rs_uid = '877081e5-a8b8-4eac-90d0-a4c3a3e3196c'
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:575: in contingency_wrapper
ret = yield from plan
cleanup = True
else_plan = <function close_run at 0x7f9f3c43dee0>
except_plan = <function run_wrapper.<locals>.except_plan at 0x7f9f3c8b0670>
final_plan = None
pause_for_debug = False
plan = <generator object count.<locals>.inner_count at 0x7f9f3c62e900>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plans.py:74: in inner_count
return (yield from bps.repeat(partial(per_shot, detectors),
delay = None
detectors = [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)]
num = 1
per_shot = <function one_shot at 0x7f9f3c43f280>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:1183: in repeat
return (yield from repeated_plan())
delay = repeat(None)
iterator = range(0, 1)
num = 1
plan = functools.partial(<function one_shot at 0x7f9f3c43f280>, [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)])
repeated_plan = <function repeat.<locals>.repeated_plan at 0x7f9f3c8b05e0>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:1166: in repeated_plan
yield from ensure_generator(plan())
delay = repeat(None)
i = 0
iterator = range(0, 1)
now = 1602180515.504436
num = 1
plan = functools.partial(<function one_shot at 0x7f9f3c43f280>, [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)])
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:1026: in one_shot
yield from take_reading(list(detectors))
detectors = [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)]
take_reading = <function trigger_and_read at 0x7f9f3c43f040>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:911: in trigger_and_read
return (yield from rewindable_wrapper(inner_trigger_and_read(),
devices = [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)]
inner_trigger_and_read = <function trigger_and_read.<locals>.inner_trigger_and_read at 0x7f9f3c8b0550>
name = 'primary'
rewindable = True
rewindable_wrapper = <function rewindable_wrapper at 0x7f9f3c43fb80>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:693: in rewindable_wrapper
return (yield from plan)
capture_rewindable_state = <function rewindable_wrapper.<locals>.capture_rewindable_state at 0x7f9f3c8b04c0>
initial_rewindable = True
plan = <generator object trigger_and_read.<locals>.inner_trigger_and_read at 0x7f9f3c62e270>
restore_rewindable = <function rewindable_wrapper.<locals>.restore_rewindable at 0x7f9f3c8b03a0>
rewindable = True
set_rewindable = <function rewindable_wrapper.<locals>.set_rewindable at 0x7f9f3c8b0430>
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:898: in inner_trigger_and_read
yield from trigger(obj, group=grp)
devices = [SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)]
grp = 'trigger-ac53bf'
name = 'primary'
no_wait = False
obj = SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:427: in trigger
ret = yield Msg('trigger', obj, group=group)
group = 'trigger-ac53bf'
obj = SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)
wait = False
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/preprocessors.py:123: in plan_mutator
msg = plan_stack[-1].send(ret)
exception = None
failed_gen = <generator object count at 0x7f9f3c62ea50>
gen = None
inner_ret = None
msg = Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None)
msg_proc = <function DarkFramePreprocessor.__call__.<locals>.maybe_insert_dark_frame at 0x7f9f3c8b0310>
msgs_seen = {140321891779104: Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891779488: Msg('unstage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891779968: Msg('open_run', obj=None, args=(), kwargs={'detectors': ['pe1_image'], 'num_points': 1, 'num_intervals': 0, 'plan_args': {'detectors': ["SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n ...,\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.],\n [0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)"], 'num': 1}, 'plan_name': 'count', 'hints': {'dimensions': [(('time',), 'primary')]}}, run=None),
140321891780544: Msg('checkpoint', obj=None, args=(), kwargs={}, run=None),
140321891781024: Msg('stage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891781216: Msg('trigger', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={'group': 'trigger-ac53bf'}, run=None),
140321891781312: Msg('stage', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={}, run=None),
140321891781696: Msg('checkpoint', obj=None, args=(), kwargs={}, run=None),
140321891782368: Msg('close_run', obj=None, args=(), kwargs={'exit_status': 'fail', 'reason': "'NoneType' object has no attribute 'parent'"}, run=None)}
new_gen = None
parent_plan = <generator object count at 0x7f9f3c62ea50>
plan = <generator object count at 0x7f9f3c62ea50>
plan_stack = deque([])
result_stack = deque([])
ret = None
ret_value = None
tail_cache = {}
tail_gen = None
tail_result_cache = {}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky_darkframes/__init__.py:327: in insert_dark_frame
snapshot = yield from self._partialed_dark_plan()
force_read = True
msg = Msg('trigger', obj=SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364), args=(), kwargs={'group': 'trigger-ac53bf'}, run=None)
self = <DarkFramePreprocessor 0 snapshots cached>
state = {}
/Users/sst/PycharmProjects/xpdAcq/xpdacq/plans/dark_plan.py:45: in dark_plan
snapshot_device = yield from basic_dark_plan(
close_state = 0
detector = SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)
open_state = 60
shutter = None
/Users/sst/PycharmProjects/xpdAcq/xpdacq/plans/dark_plan.py:20: in basic_dark_plan
yield from bps.mv(shutter, close_state)
close_state = 0
detector = SynSignalWithRegistry(name='pe1_image', value=array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), timestamp=1602180513.580364)
open_state = 60
shutter = None
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/plan_stubs.py:254: in mv
(step,) = utils.merge_cycler(cyl)
args = (None, 0)
cyl = cycler(None, [0])
group = 'c7e4151f-6279-4c38-9bec-51adb56d336d'
kwargs = {}
status_objects = []
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/utils.py:1372: in merge_cycler
io, co, gb = merge_axis(cyc.keys)
cyc = cycler(None, [0])
my_name = <function merge_cycler.<locals>.my_name at 0x7f9f3c8b0af0>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
objs = {None}
def merge_axis(objs):
'''Merge possibly related axis
This function will take a list of objects and separate it into
- list of completely independent objects (most settable things and
detectors) that do not have coupled motion.
- list of devices who have children who are coupled (PseudoPositioner
ducked by looking for 'RealPosition' as an attribute)
Both of these lists will only contain objects directly passed in
in objs
- map between parents and objects passed in. Each value
of the map is a map between the strings
{'real', 'pseudo', 'independent'} and a list of objects. All
of the objects in the (doubly nested) map are in the input.
Parameters
----------
objs : Iterable[OphydObj]
The input devices
Returns
-------
independent_objs : List[OphydObj]
Independent 'simple' axis
complex_objs : List[PseudoPositioner]
Independent objects which have interdependent children
coupled : Dict[PseudoPositioner, Dict[str, List[OphydObj]]]
Mapping of interdependent axis passed in.
'''
def get_parent(o):
return getattr(o, 'parent')
independent_objs = set()
maybe_coupled = set()
complex_objs = set()
for o in objs:
> parent = o.parent
E AttributeError: 'NoneType' object has no attribute 'parent'
complex_objs = set()
get_parent = <function merge_axis.<locals>.get_parent at 0x7f9f3c8b0b80>
independent_objs = set()
maybe_coupled = set()
o = None
objs = {None}
/Users/sst/anaconda3/envs/dev_xpdacq/lib/python3.8/site-packages/bluesky/utils.py:1316: AttributeError
When the code raise the error below, the error should propogate to the layer above and then the "except" line should be executed. However, interestingly, the code directly reported it as an error without executing the "except" line.