Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError from listdevice() #990

Closed
prjemian opened this issue Jun 29, 2024 · 5 comments · Fixed by #1013
Closed

RuntimeError from listdevice() #990

prjemian opened this issue Jun 29, 2024 · 5 comments · Fixed by #1013
Assignees
Labels
Milestone

Comments

@prjemian
Copy link
Contributor

image

@prjemian prjemian added the bug label Jun 29, 2024
@prjemian prjemian added this to the 1.6.21 milestone Jun 29, 2024
@prjemian
Copy link
Contributor Author

RuntimeError: Invalid array size (0, 0, 0) - Is that an unprimed area detector?

@prjemian
Copy link
Contributor Author

Perhaps the best way past this is to wrap

v = signal.get()

with try..except and return a value. But what value to return? The error message (Invalid array size (0, 0, 0))? Something more terse?

@prjemian
Copy link
Contributor Author

If this is an unprimed area detector situation, it is harder to re-create the initial conditions. Need to take an existing AD and change its image parameters so that the ophyd object will raise the exception.

Adding a unit test here could be contrived and possibly not realistic. Need to create a Device with a Signal that triggers the exception.

@prjemian
Copy link
Contributor Author

prjemian commented Aug 28, 2024

Ran again with this code change and an unprimed area detector. Error is now:

In [5]: listdevice(adsimdet)
Subscription value callback exception (EpicsSignal(read_pv='ad:image1:ArrayData', name='adsimdet_image_array_data', parent='adsimdet_image', value=array([], dtype=uint8), timestamp=631152000.0, auto_monitor=True, string=False, write_pv='ad:image1:ArrayData', limits=False, put_complete=False))
Traceback (most recent call last):
  File "/home/prjemian/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/ophyd/ophydobj.py", line 492, in inner
    cb(*args, **kwargs)
  File "/home/prjemian/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/ophyd/signal.py", line 696, in _derived_value_callback
    value = self.inverse(value)
            ^^^^^^^^^^^^^^^^^^^
  File "/home/prjemian/.conda/envs/bluesky_2024_2/lib/python3.11/site-packages/ophyd/areadetector/base.py", line 123, in inverse
    raise RuntimeError(f"Invalid array size {self.derived_shape}")
RuntimeError: Invalid array size (0, 0, 0)

Still an exception from ophyd.areadetector.base from the subscription, but this time listdevice() completed.

@prjemian
Copy link
Contributor Author

Summary

We can suppress that exception from causing listdevice() to fail but the same code raises an exception in the DETECTOR.image.shaped_image callback. The exception is raised in areadetector.base when the image shape tuple is all zeroes. That is an indicator of an area detector IOC that has just started and no image has been passed from the cam to the image plugin.

@prjemian prjemian self-assigned this Aug 28, 2024
prjemian added a commit that referenced this issue Aug 28, 2024
prjemian added a commit that referenced this issue Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant