Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

model with DimensionalityError #33

Open
KDupraz opened this issue Nov 19, 2020 · 2 comments
Open

model with DimensionalityError #33

KDupraz opened this issue Nov 19, 2020 · 2 comments

Comments

@KDupraz
Copy link

KDupraz commented Nov 19, 2020

Hi everybody,
I am trying to understand the library. First of all thanks for developing it, but it miss a more precise documentation (see the next issues).

My problem for this issue is there is no information on how to use models and the condition to use it. For now I am trying to display a motor position in the svg. But I have a taurus error on dimension this the trace I got:
TimerLoop 1 ERROR 2020-11-19 18:10:53,928 TaurusPollingTimer[3000]: poll_reply error DimensionalityError()
TaurusTSP.W001 ERROR 2020-11-19 18:10:53,957 TaurusManager.TaurusTSP.TaurusTSP.W001: Uncaught exception running job 'poll' called from thread Dummy-1:
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/python_svgsynoptic2-4.0.0-py3.8.egg/svgsynoptic2/taurusregistry.py", line 59, in run
self._update(attributes)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/python_svgsynoptic2-4.0.0-py3.8.egg/svgsynoptic2/taurusregistry.py", line 127, in _update
self._add_listener(attr)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/python_svgsynoptic2-4.0.0-py3.8.egg/svgsynoptic2/taurusregistry.py", line 144, in _add_listener
listener.addListener(self.handle_event)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/tango/tangoattribute.py", line 628, in addListener
self._subscribeChangeEvents()
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/tango/tangoattribute.py", line 710, in _subscribeChangeEvents
self._activatePolling()
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/taurusattribute.py", line 227, in _activatePolling
self.factory().addAttributeToPolling(self, self.getPollingPeriod())
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/taurusfactory.py", line 350, in addAttributeToPolling
tmr.addAttribute(attribute, self.isPollingEnabled())
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/tauruspollingtimer.py", line 111, in addAttribute
taurus.Manager().enqueueJob(attribute.poll)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/taurusmanager.py", line 165, in enqueueJob
self._sthread_pool.add(job, callback, *job_args, **job_kwargs)
Traceback (most recent call last):
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/util/threadpool.py", line 147, in run
cmd(*args, **kw)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/tango/tangoattribute.py", line 519, in poll
self.fireEvent(TaurusEventType.Periodic, self.__attr_value)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/taurus/core/taurusmodel.py", line 297, in fireEvent
l(self, event_type, event_value)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/python_svgsynoptic2-4.0.0-py3.8.egg/svgsynoptic2/taurusregistry.py", line 104, in handle_event
self.event_callback(model, evt_src, *args)
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/python_svgsynoptic2-4.0.0-py3.8.egg/svgsynoptic2/taurussynopticwidget.py", line 232, in attribute_listener
value = fmt % value # taurus4 issue: values without format
File "/x-data/home/xline-user1/anaconda3/envs/py3.7TaurusPyQt5/lib/python3.8/site-packages/pint/quantity.py", line 834, in float
raise DimensionalityError(self._units, "dimensionless")
pint.errors.DimensionalityError: Cannot convert from 'millimeter' to 'dimensionless'

Do you know how to overcome or resolve this problem ? The DS I am trying to read is an IcePapController.
thank you very much.
best regards,

@KDupraz
Copy link
Author

KDupraz commented Nov 19, 2020

The error come from "taurussynopticwidget.py" line: 232.
value = fmt % value # taurus4 issue: values without format
To solve the bug just use the pint methods to get only the magnitude of the value (units are managed farther in the code).
This the change in the line: 232 (it is working now)
value = fmt % value.magnitude # taurus4 issue: values without format

a developer can make the change in the code for a future release ?
best regards,

@KDupraz KDupraz closed this as completed Nov 19, 2020
@KDupraz KDupraz reopened this Nov 19, 2020
@johanfforsberg
Copy link
Collaborator

Hi KDupraz,

Thanks for your informative tickets. We certainly have some documentation work to do.

Please note that we've just moved this repo to gitlab (see master README) and your issues are transferred, but I'm replying here because the new issues of course are not linked to your account. I will also archive this repo.

After a quick look, I think you are correct and that the issue is caused by changes in taurus 4. We are just about to upgrade the whole library to python3 and Qt5, maybe your issue will also be solved in that process. You can try the "develop" branch if you like. Also feel free to follow this up on gitlab.

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

No branches or pull requests

2 participants