{"action":"created","issue":{"url":"https://api.github.com/repos/NSLS-II/Bug-Reports/issues/101","repository_url":"https://api.github.com/repos/NSLS-II/Bug-Reports","labels_url":"https://api.github.com/repos/NSLS-II/Bug-Reports/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/NSLS-II/Bug-Reports/issues/101/comments","events_url":"https://api.github.com/repos/NSLS-II/Bug-Reports/issues/101/events","html_url":"https://github.com/NSLS-II/Bug-Reports/issues/101","id":148801050,"number":101,"title":"[CSX] HKL problems with calculations","user":{"login":"cmazzoli","id":11068694,"avatar_url":"https://avatars.githubusercontent.com/u/11068694?v=3","gravatar_id":"","url":"https://api.github.com/users/cmazzoli","html_url":"https://github.com/cmazzoli","followers_url":"https://api.github.com/users/cmazzoli/followers","following_url":"https://api.github.com/users/cmazzoli/following{/other_user}","gists_url":"https://api.github.com/users/cmazzoli/gists{/gist_id}","starred_url":"https://api.github.com/users/cmazzoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmazzoli/subscriptions","organizations_url":"https://api.github.com/users/cmazzoli/orgs","repos_url":"https://api.github.com/users/cmazzoli/repos","events_url":"https://api.github.com/users/cmazzoli/events{/privacy}","received_events_url":"https://api.github.com/users/cmazzoli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-16T00:54:57Z","updated_at":"2016-04-18T21:10:41Z","closed_at":null,"body":"@dchabot, @klauer \r\nHKL libs somtimes cannot calculate accessible positions. If suitably guided, then a reasonable solution is proposed.\r\n\r\n````\r\nIn [117]: tardis.move([0,0,0.4375*3])\r\n---------------------------------------------------------------------------\r\nGError                                    Traceback (most recent call last)\r\n/home/xf23id1/Repos/hklpy/hkl/engine.py in pseudo_positions(self, values)\r\n    191             geometry_list = self._engine.pseudo_axis_values_set(values,\r\n--> 192                                                                 self._units)\r\n    193         except GLib.GError as ex:\r\n\r\nGError: none of the functions were solved !!!\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nValueError                                Traceback (most recent call last)\r\n/home/xf23id1/Beamline/BDT/2016_04_14/2016_04_15.py in <module>()\r\n----> 1 tardis.move([0,0,0.4375*3])\r\n\r\n/home/xf23id1/conda_envs/collection/lib/python3.4/site-packages/ophyd/pseudopos.py in wrapped(self, *args, **kwargs)\r\n    171                 pos, new_kwargs = self.to_real_tuple(*args, **kwargs)\r\n    172 \r\n--> 173             return method(self, pos, **new_kwargs)\r\n    174 \r\n    175         return wrapped\r\n\r\n/home/xf23id1/conda_envs/collection/lib/python3.4/site-packages/ophyd/pseudopos.py in move(self, position, wait, timeout, moved_cb)\r\n    734         '''\r\n    735         return super().move(position, wait=wait, timeout=timeout,\r\n--> 736                             moved_cb=moved_cb)\r\n    737 \r\n    738     move.__doc__ = SoftPositioner.move.__doc__\r\n\r\n/home/xf23id1/conda_envs/collection/lib/python3.4/site-packages/ophyd/positioner.py in move(self, position, wait, timeout, moved_cb)\r\n    282             If motion fails other than timing out\r\n    283         '''\r\n--> 284         status = super().move(position, moved_cb=moved_cb, timeout=timeout)\r\n    285 \r\n    286         self._setup_move(position, status)\r\n\r\n/home/xf23id1/conda_envs/collection/lib/python3.4/site-packages/ophyd/positioner.py in move(self, position, moved_cb, timeout)\r\n    113             timeout = self._timeout\r\n    114 \r\n--> 115         self.check_value(position)\r\n    116 \r\n    117         self._run_subs(sub_type=self._SUB_REQ_DONE, success=False)\r\n\r\n/home/xf23id1/conda_envs/collection/lib/python3.4/site-packages/ophyd/pseudopos.py in check_value(self, pseudo_pos)\r\n    518                                                             pos, high))\r\n    519 \r\n--> 520         real_pos = self.forward(pseudo_pos)\r\n    521         for real, pos in zip(self._real, real_pos):\r\n    522             real.check_value(pos)\r\n\r\n/home/xf23id1/Repos/hklpy/hkl/diffract.py in forward(self, pseudo)\r\n     89 \r\n     90     def forward(self, pseudo):\r\n---> 91         solutions = self._calc.forward(pseudo)\r\n     92         logger.debug('pseudo to real: {}'.format(solutions))\r\n     93 \r\n\r\n/home/xf23id1/Repos/hklpy/hkl/calc.py in forward(self, position, engine)\r\n    313                 raise ValueError('Engine unset')\r\n    314 \r\n--> 315             self.engine.pseudo_positions = position\r\n    316             return self.engine.solutions\r\n    317 \r\n\r\n/home/xf23id1/Repos/hklpy/hkl/engine.py in pseudo_positions(self, values)\r\n    192                                                                 self._units)\r\n    193         except GLib.GError as ex:\r\n--> 194             raise ValueError('Calculation failed (%s)' % ex)\r\n    195 \r\n    196         Position = self._calc.Position\r\n\r\nValueError: Calculation failed (none of the functions were solved !!!)\r\n\r\nIn [118]: tardis.calc.energy\r\nOut[118]: 0.07769768884\r\n\r\nIn [119]: tardis.calc.energy = (pgm_en.readback.value+7)/10000\r\n\r\nIn [120]: tardis.move([0,0,1])\r\nOut[120]: MoveStatus(done=True, pos=tardis, elapsed=62.0, success=True, settle_time=0.0)\r\n\r\nIn [121]: 0.4375*3\r\nOut[121]: 1.3125\r\n\r\nIn [122]: tardis.move([0,0,0.4375*2.6])\r\nOut[122]: MoveStatus(done=True, pos=tardis, elapsed=23.2, success=True, settle_time=0.0)\r\n\r\nIn [123]: tardis.calc.forward([0,0,0.4375*2.6])\r\nOut[123]: (PosCalcE6C(theta=59.75450175095632, omega=0.0, chi=0.0, phi=0.0, delta=119.50900350191284, gamma=3.285004519304743e-14),)\r\n\r\nIn [124]: tardis.calc.forward([0,0,0.4375*2.8])\r\nOut[124]: (PosCalcE6C(theta=68.48584832920217, omega=0.0, chi=0.0, phi=0.0, delta=136.97169657924374, gamma=2.2732917903030795e-22),)\r\n\r\nIn [125]: tardis.calc.forward([0,0,0.4375*2.9])\r\nOut[125]: (PosCalcE6C(theta=74.48340045343471, omega=0.0, chi=0.0, phi=0.0, delta=148.96679929368838, gamma=-8.326468246403186e-22),)\r\n\r\nIn [126]: tardis.calc.forward([0,0,0.4375*2.95])\r\nOut[126]: (PosCalcE6C(theta=78.56953890967387, omega=0.0, chi=0.0, phi=0.0, delta=157.13907810479606, gamma=-1.848441392744114e-22),)\r\n\r\nIn [127]: tardis.calc.forward([0,0,0.4375*2.98])\r\nOut[127]: (PosCalcE6C(theta=81.94489018387564, omega=0.0, chi=0.0, phi=0.0, delta=163.8897804748048, gamma=-4.7699760202894017e-23),)\r\n\r\nIn [128]: tardis.calc.forward([0,0,0.4375*2.99])\r\nOut[128]: (PosCalcE6C(theta=83.44177541564504, omega=0.0, chi=0.0, phi=0.0, delta=166.88355226396592, gamma=-4.353838974164389e-22),)\r\n\r\nIn [129]: tardis.calc.forward([0,0,0.4375*3])\r\nOut[129]: (PosCalcE6C(theta=85.40006166682436, omega=0.0, chi=0.0, phi=0.0, delta=170.80012249813058, gamma=3.0309245044027176e-22),)\r\n\r\n````"},"comment":{"url":"https://api.github.com/repos/NSLS-II/Bug-Reports/issues/comments/211578802","html_url":"https://github.com/NSLS-II/Bug-Reports/issues/101#issuecomment-211578802","issue_url":"https://api.github.com/repos/NSLS-II/Bug-Reports/issues/101","id":211578802,"user":{"login":"cmazzoli","id":11068694,"avatar_url":"https://avatars.githubusercontent.com/u/11068694?v=3","gravatar_id":"","url":"https://api.github.com/users/cmazzoli","html_url":"https://github.com/cmazzoli","followers_url":"https://api.github.com/users/cmazzoli/followers","following_url":"https://api.github.com/users/cmazzoli/following{/other_user}","gists_url":"https://api.github.com/users/cmazzoli/gists{/gist_id}","starred_url":"https://api.github.com/users/cmazzoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmazzoli/subscriptions","organizations_url":"https://api.github.com/users/cmazzoli/orgs","repos_url":"https://api.github.com/users/cmazzoli/repos","events_url":"https://api.github.com/users/cmazzoli/events{/privacy}","received_events_url":"https://api.github.com/users/cmazzoli/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T21:10:41Z","updated_at":"2016-04-18T21:10:41Z","body":"Guys,\nsorry for my delay.\n\nAbout the conversion: the program uses SI internally so we need to cheat a bit if we want to use Angstrom and keV, from where the conversion factor (10^4). So, the numbers I reported READ as 770 eV, exactly where I wanted to be. Indeed I found the reflections..\n\nSorry, I should have been more detailed but you should consider that I was performing an experiment (funny behavior = problem) and it was already quite late in the night. Let’s concentrate on the problem then:\nI don’t know why actualizing the energy (already declared identically few lines above the reported ones..) made the calculation to find the spot after having failed the first try. I could have reported many other cases where either by moving motors, getting closer to position you would like to drive the diffractometer, or even asking for its current position, SOMETIMES ended up in a successful calculation (and sometimes still not..).\n\nThis is the thing that we should sort out because at the moment it is difficult to trust the program (that actually works perfectly if you have the patience of driving it to an acceptable solution..).\n\nAbout the “fitting” parameters: if they are fixed by the geometry, you need to required them to stay fixed. This is the way in which the solutions are managed (i.e. the system stays constrained.. otherwise would be extra redundant and potentially infinite sets of solutions would be found). Does it make sense? now I don’t know if for some reasons the syntax of the libraries may require something different but ,as a matter of fact, several times we correctly found solutions and tested them as correct in the experimental geometry.\n\nCla.\nPS: what in the hell AFAIU means!!!???\n\n\n\n\n\nOn Apr 18, 2016, at 10:35 AM, dchabot <notifications@github.com> wrote:\n\n> @stuwilkins, yes, AFAIU the energies are expected in keV and wavelengths in Angstroms.\n> \n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly or view it on GitHub\n> \n\n"}}