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

Image array size doesn't match image1:ArraySize0 * image1:ArraySize1 #13

Open
ronpandolfi opened this issue May 20, 2019 · 4 comments
Open

Comments

@ronpandolfi
Copy link

I'm trying to use ophyd's shaped_image DerivedSignal, but I'm getting this error:

Subscription value callback exception (EpicsSignal(read_pv='ALS:701:image1:ArrayData', name='701_image1_array_data', parent='701_image1', value=array([882, 882, 882, ...,   0,   0,   0], dtype=int16), timestamp=1558385498.360814, auto_monitor=False, string=False, write_pv='ALS:701:image1:ArrayData', limits=False, put_complete=False))
Traceback (most recent call last):
  File "/home/rp/PycharmProjects/ophyd/ophyd/ophydobj.py", line 315, in inner
    cb(*args, **kwargs)
  File "/home/rp/PycharmProjects/ophyd/ophyd/signal.py", line 486, in _derived_value_callback
    value = self.inverse(value)
  File "/home/rp/PycharmProjects/ophyd/ophyd/areadetector/base.py", line 107, in inverse
    return np.array(value).reshape(array_shape)
ValueError: cannot reshape array of size 2361600 into shape (2050,960)

I can see that ...image1.shaped_image._shape[0] maps to ...image1:ArraySize1_RBV. These PVs don't match the size of the image (confirmed with caget).

Rather, ...cam1:ArraySizeX_RBV and ...cam1:ArraySizeX_RBV seem to match the shape of the image (2050,1152).

Is this an issue with the configuration of the detector, or the IOC?

@MarkRivers
Copy link
Member

The size of the array in the NDStdArrays plugin (image1:ArraySize0_RBV x image1:ArraySize1_RBV) is not necessarily the same as the camera itself (cam1:ArraySizeX_RBV, x cam1:ArraySizeY_RBV) because there could be an ROI plugin, etc. in-between. It should be using the dimensions from the stdArrays
plugin because that is what is sent to the waveform record. Recall that the waveform record is a fixed length. What is that set to in your startup script?

I have not use ophyd so I don't know the details here. ophyd should only be requesting or using the number of elements image1:ArraySize0_RBV x image1:ArraySize1_RBV.

@ronpandolfi
Copy link
Author

ronpandolfi commented May 22, 2019

Hi Mark, my understanding of the internals here is limited; I'm still learning EPICS. I think my issue here is that the array I'm getting back from image1 does not match the shape associated with image1. I think this is not correct behavior.

Only as a curiosity, cam1's shape matches image1's array size; this was also unexpected.

@MarkRivers
Copy link
Member

Hi Ron, I discussed this briefly with Dan and Tom yesterday. I think you should probably contact them directly.

@stuwilkins
Copy link
Contributor

@ronpandolfi @mrakitin and I discussed this yesterday. I believe that Ron is seeing the expected behavior. He gets a numpy array which is of the size NELEM. This is of course bigger than the image size. Therefore the array should be truncated by image1:ArraySize0 * image1:ArraySize1 and reshaped by (image1:ArraySize0,image1:ArraySize1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants