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

Option to force "number" rather than "integer" in Signal #1178

Open
cjtitus opened this issue Feb 16, 2024 · 1 comment
Open

Option to force "number" rather than "integer" in Signal #1178

cjtitus opened this issue Feb 16, 2024 · 1 comment

Comments

@cjtitus
Copy link

cjtitus commented Feb 16, 2024

Summary

There are many signals where the dtype is known a-priori to be floats. However, Ophyd always looks at an example value when describe is called, and shoves that into a data_type function.

If the first value happens to be an integer, the describe method then returns integer, and all further data will be cast to an integer, even if everything else is floats. I think the true data is saved, somehow, but have never really managed to get it back out of Tiled.

There should be a way to tell a signal to treat numeric dtypes as number and not integer, so that this can be set properly on a signal-by-signal basis.

@mguijarr
Copy link

mguijarr commented Nov 12, 2024

Thanks to #1194, it is now possible to do add dtype=float to Signal arguments to force number instead of integer:

>>> from ophyd.signal import Signal
>>> s=Signal(name="mysignal", value=0, dtype=float)
>>> s.describe()
{'mysignal': {'source': 'SIM:mysignal', 'dtype': 'number', 'shape': [], 'dtype_numpy': 'float64'}}

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

2 participants