Open prjemian opened 3 years ago
@klauer Was this ever tested?
@prjemian I have no recollection of it
I recommend we drop this geometry for now. Otherwise, this will take some refactoring of CalcRecip
to get around this one geometry. I'd recommend the upstream libhkl be changed instead, to add a q
engine, since that is the only one that makes any sense: q = (4pi/lambda)sin(tth/2) -- hkl* makes no sense for TwoC
and that ruins the engine="hkl"
default in CalcRecip.__init__()
. TwoC
would still need a special case.
Since TwoC
is not supported by libhkl, the theta-2theta geometry seems an ideal case for support with an alternative back-end (as substitute for libhkl). See, for example, issues #14, #162, and #163. The geometry is simple but full support would require most, if not all, of the alternative back-end to be functional.
with hklpy v1.0.3:
In [1]: import hkl
...:
...: class CalcTwoC(hkl.calc.CalcRecip):
...: """Geometry: TwoC"""
...:
...: def __init__(self, **kwargs):
...: super().__init__("TwoC", **kwargs)
...:
...: class TwoC(hkl.diffract.Diffractometer):
...: """2-circle"""
...:
...: calc_class = CalcTwoC
...:
...: cc = hkl.TwoC("", name="cc", engine=None)
...:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [1], in <cell line: 14>()
10 """2-circle"""
12 calc_class = CalcTwoC
---> 14 cc = hkl.TwoC("", name="cc", engine=None)
AttributeError: module 'hkl' has no attribute 'TwoC'
Definitely for v1.2 milestone, needs
While the 2-circle geometry and calculations are admittedly trivial to implement separately in a PseudoPositioner, an exception is raised (see below) while trying to create an instance of
hkl.geometries.TwoC
or an instance ofhkl.calc.CalcTwoC
. It comes down to this inescapable fact: the list of engines for TwoC geometry is empty [as defined in the libhkl library](https://repo.or.cz/hkl.git/blob/HEAD:/hkl/hkl-engine-2c.c#l56).Since the
hkl.calc.CalcRecip
constructor provides a default"hkl"
for an undefinedengine
kwarg, it is not possible to override and pass aNone
through as theTwoC
calc is being constructed,Exception