Open gfabbris opened 3 years ago
Can you post a copy of the code you used to set this up?
This uses the VM IOC:
In [1]: import gi
...: gi.require_version('Hkl', '5.0')
...: # MUST come before `import hkl`
...: from hkl.diffract import E4CV
...: from ophyd import Component, PseudoSingle, EpicsMotor
...:
...: class FourcIncidence(E4CV):
...: incidence = Component(PseudoSingle, "")
...: azimuth = Component(PseudoSingle, "")
...:
...: theta = Component(EpicsMotor, 'm41')
...: chi = Component(EpicsMotor, 'm42')
...: phi = Component(EpicsMotor, 'm43')
...: tth = Component(EpicsMotor, 'm44')
...:
...: fourc_inc = FourcIncidence("gp:", name="fouce_inc",
...: calc_kw={"engine": "incidence"})
...:
...: RE(bps.mv(
...: fourc_inc.theta, 10,
...: fourc_inc.tth, 20,
...: fourc_inc.chi, 0,
...: fourc_inc.phi, 0
...: ))
Out[1]: ()
In [2]: fourc_inc.engine._engine.parameters_values_set((0, 0, 1), 1)
Out[2]: 1
In [3]: fourc_inc.inverse(10, 0, 0, 20)
Out[3]: FourcIncidencePseudoPos(incidence=10.000000000000002, azimuth=90.0)
In [4]: fourc_inc.forward(10, 90)
---------------------------------------------------------------------------
Error Traceback (most recent call last)
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/hkl/engine.py in pseudo_positions(self, values)
230 try:
--> 231 geometry_list = self._engine.pseudo_axis_values_set(values,
232 self._units)
Error: hkl-mode-incidence-error-quark: The "incidence" engine is readonly (1)
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/hkl/calc.py in forward_iter(self, start, end, max_iters, threshold, decision_fcn)
536 try:
--> 537 self.engine.pseudo_positions = end
538 return self.engine.solutions
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/hkl/engine.py in pseudo_positions(self, values)
233 except GLib.GError as ex:
--> 234 raise ValueError('Calculation failed (%s)' % ex)
235
ValueError: Calculation failed (hkl-mode-incidence-error-quark: The "incidence" engine is readonly (1))
During handling of the above exception, another exception occurred:
UnreachableError Traceback (most recent call last)
<ipython-input-4-71eebfe36a58> in <module>
----> 1 fourc_inc.forward(10, 90)
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/ophyd/pseudopos.py in wrapped(self, *args, **kwargs)
186 pos, new_kwargs = m(*args, **kwargs)
187
--> 188 return method(self, pos, **new_kwargs)
189
190 return wrapped
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/hkl/diffract.py in forward(self, pseudo)
264 @pseudo_position_argument
265 def forward(self, pseudo):
--> 266 solutions = self.calc.forward_iter(start=self.position, end=pseudo,
267 max_iters=100)
268 logger.debug('pseudo to real: {}'.format(solutions))
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/hkl/calc.py in wrapped(self, *args, **kwargs)
47 initial_pos = self.physical_positions
48 try:
---> 49 return func(self, *args, **kwargs)
50 finally:
51 self.physical_positions = initial_pos
~/Apps/miniconda3/envs/bluesky_2021_1/lib/python3.8/site-packages/hkl/calc.py in forward_iter(self, start, end, max_iters, threshold, decision_fcn)
538 return self.engine.solutions
539 except ValueError:
--> 540 raise UnreachableError(
541 f"Unable to solve. iterations={iters}/{max_iters}\n"
542 f"Last valid position: {valid_pseudo}\n{valid_real} ",
UnreachableError: Unable to solve. iterations=100/100
Last valid position: None
None
Note the "Error: hkl-mode-incidence-error-quark: The "incidence" engine is readonly (1)"
Thanks, I'll look that one up.
Yesterday, @jwkim-anl and I had issues running the E4C incidence engine. It looks like that it's a read only engine, i.e. you can only read the incidence angle and azimuth, but not move the diffractometer angles.
@prjemian: could you check that this is indeed the case?